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

Side by Side Diff: lib/dataCollector.js

Issue 29333297: Issue 3375 - Issue reporter: move screenshot creation into the content process (Closed)
Patch Set: Made sure screenshotDataCollector is always initialized Created Jan. 7, 2016, 6:57 p.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 | « lib/child/main.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 /**
19 * @fileOverview Collects some data for a content window, to be attached to
20 * issue reports.
21 */
22
23 "use strict";
24
25 let {Utils} = require("utils");
26
27 let maxResponseID = 0;
28 let callbacks = new Map();
29
30 let messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"]
31 .getService(Ci.nsIMessageListenerManager)
32 .QueryInterface(Ci.nsIMessageBroadcaster);
33
34 Utils.addChildMessageListener("AdblockPlus:CollectDataResponse", onResponse);
35
36 function onResponse({responseID, data})
37 {
38 let callback = callbacks.get(responseID);
39 callbacks.delete(responseID);
40 if (typeof callback == "function")
41 callback(data);
42 }
43
44 /**
45 * Collects data for the given window.
46 * @param {number} outerWindowID the ID of the window
47 * @param {number} screenshotWidth width of the screenshot to be created
48 * @param {Function} callback function to be called with the data
49 */
50 function collectData(outerWindowID, screenshotWidth, callback)
51 {
52 let id = ++maxResponseID;
53 callbacks.set(id, callback);
54
55 messageManager.broadcastAsyncMessage("AdblockPlus:CollectData", {
56 outerWindowID,
57 screenshotWidth,
58 responseID: id
59 });
60 }
61 exports.collectData = collectData;
OLDNEW
« no previous file with comments | « lib/child/main.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld