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

Side by Side Diff: lib/child/bootstrap.js

Issue 29332950: Issue 3449 - Use sendRpcMessage instead of sendSyncMessage (Closed)
Patch Set: Created Dec. 22, 2015, 10:08 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 | 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
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 30 matching lines...) Expand all
41 let index = shutdownHandlers.indexOf(handler); 41 let index = shutdownHandlers.indexOf(handler);
42 if (index >= 0) 42 if (index >= 0)
43 shutdownHandlers.splice(index, 1); 43 shutdownHandlers.splice(index, 1);
44 } 44 }
45 }; 45 };
46 46
47 let callbackPrefix = Services.appinfo.processID + " "; 47 let callbackPrefix = Services.appinfo.processID + " ";
48 let maxCallbackID = 0; 48 let maxCallbackID = 0;
49 let callbacks = new Map(); 49 let callbacks = new Map();
50 50
51 function sendSyncMessageSingleResponse(messageName, data) 51 function sendSyncMessageSingleResponse(messageName, data)
saroyanm 2015/12/28 10:01:44 nit: I think you can also change the function name
Wladimir Palant 2015/12/28 13:11:03 I don't think the name should be changed - that's
52 { 52 {
53 return sendSyncMessage(messageName, {data})[0]; 53 return sendRpcMessage(messageName, {data})[0];
54 } 54 }
55 55
56 function sendAsyncMessageWithResponse(messageName, data, callback) 56 function sendAsyncMessageWithResponse(messageName, data, callback)
57 { 57 {
58 data = {data}; 58 data = {data};
59 if (callback) 59 if (callback)
60 { 60 {
61 let callbackID = callbackPrefix + (++maxCallbackID); 61 let callbackID = callbackPrefix + (++maxCallbackID);
62 callbacks.set(callbackID, callback); 62 callbacks.set(callbackID, callback);
63 data.callbackID = callbackID; 63 data.callbackID = callbackID;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 118
119 sendAsyncMessageWithResponse("AdblockPlus:GetInfo", null, init); 119 sendAsyncMessageWithResponse("AdblockPlus:GetInfo", null, init);
120 addMessageListener("AdblockPlus:Response", onResponse); 120 addMessageListener("AdblockPlus:Response", onResponse);
121 addMessageListener("AdblockPlus:Shutdown", shutdown); 121 addMessageListener("AdblockPlus:Shutdown", shutdown);
122 onShutdown.add(() => { 122 onShutdown.add(() => {
123 removeMessageListener("AdblockPlus:Response", onResponse); 123 removeMessageListener("AdblockPlus:Response", onResponse);
124 removeMessageListener("AdblockPlus:Shutdown", shutdown); 124 removeMessageListener("AdblockPlus:Shutdown", shutdown);
125 }); 125 });
126 })(); 126 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld