Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: chrome/content/ui/sendReport.js

Issue 5743717579227136: Get rid of Utils.threadManager (Closed)
Patch Set: Removed a line that is no longer in use Created March 13, 2014, 11:52 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | lib/requestNotifier.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 this._context.strokeStyle = "rgba(255, 0, 0, 0.7)"; 374 this._context.strokeStyle = "rgba(255, 0, 0, 0.7)";
375 this._context.lineWidth = 3; 375 this._context.lineWidth = 3;
376 this._context.lineJoin = "round"; 376 this._context.lineJoin = "round";
377 377
378 // Reduce colors asynchronously 378 // Reduce colors asynchronously
379 this._pixelData = this._context.getImageData(this.imageOffset, this.imageOff set, 379 this._pixelData = this._context.getImageData(this.imageOffset, this.imageOff set,
380 this._canvas.width - this.imageOffset * 2, 380 this._canvas.width - this.imageOffset * 2,
381 this._canvas.height - this.imageOffset * 2 ); 381 this._canvas.height - this.imageOffset * 2 );
382 this._max = this._pixelData.width * this._pixelData.height * 4; 382 this._max = this._pixelData.width * this._pixelData.height * 4;
383 this._i = 0; 383 this._i = 0;
384 Utils.threadManager.currentThread.dispatch(this, Ci.nsIEventTarget.DISPATCH_ NORMAL); 384 Utils.runAsync(this.run.bind(this));
385 }, 385 },
386 386
387 run: function() 387 run: function()
388 { 388 {
389 // Process only 5000 bytes at a time to prevent browser hangs 389 // Process only 5000 bytes at a time to prevent browser hangs
390 let endIndex = Math.min(this._i + 5000, this._max); 390 let endIndex = Math.min(this._i + 5000, this._max);
391 let i = this._i; 391 let i = this._i;
392 for (; i < endIndex; i++) 392 for (; i < endIndex; i++)
393 this._pixelData.data[i] = this._mapping[this._pixelData.data[i] >> 6]; 393 this._pixelData.data[i] = this._mapping[this._pixelData.data[i] >> 6];
394 394
395 if (i >= this._max) 395 if (i >= this._max)
396 { 396 {
397 // Save data back and we are done 397 // Save data back and we are done
398 this._context.putImageData(this._pixelData, this.imageOffset, this.imageOf fset); 398 this._context.putImageData(this._pixelData, this.imageOffset, this.imageOf fset);
399 this._callback(); 399 this._callback();
400 } 400 }
401 else 401 else
402 { 402 {
403 this._i = i; 403 this._i = i;
404 Utils.threadManager.currentThread.dispatch(this, Ci.nsIEventTarget.DISPATC H_NORMAL); 404 Utils.runAsync(this.run.bind(this));
405 } 405 }
406 }, 406 },
407 407
408 get enabled() this._enabled, 408 get enabled() this._enabled,
409 set enabled(enabled) 409 set enabled(enabled)
410 { 410 {
411 if (this._enabled == enabled) 411 if (this._enabled == enabled)
412 return; 412 return;
413 413
414 this._enabled = enabled; 414 this._enabled = enabled;
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 1562
1563 function censorURL(url) 1563 function censorURL(url)
1564 { 1564 {
1565 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*"); 1565 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*");
1566 } 1566 }
1567 1567
1568 function encodeHTML(str) 1568 function encodeHTML(str)
1569 { 1569 {
1570 return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"). replace(/"/g, "&quot;"); 1570 return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"). replace(/"/g, "&quot;");
1571 } 1571 }
OLDNEW
« no previous file with comments | « no previous file | lib/requestNotifier.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld