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

Delta Between Two Patch Sets: include/AdblockPlus/JsEngine.h

Issue 29391555: Issue 4948 - add possibility to not send data depending on connection properties (Closed)
Left Patch Set: update to libadblockplus hg:ec8e2edc66af Created March 22, 2017, 5:25 a.m.
Right Patch Set: update to libadblockplus hg:1d708e673634 Created March 27, 2017, 5:29 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « include/AdblockPlus/FilterEngine.h ('k') | include/AdblockPlus/JsValue.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 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/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #ifndef ADBLOCK_PLUS_JS_ENGINE_H 18 #ifndef ADBLOCK_PLUS_JS_ENGINE_H
19 #define ADBLOCK_PLUS_JS_ENGINE_H 19 #define ADBLOCK_PLUS_JS_ENGINE_H
20 20
21 #include <functional> 21 #include <functional>
22 #include <map> 22 #include <map>
23 #include <list>
23 #include <stdexcept> 24 #include <stdexcept>
24 #include <stdint.h> 25 #include <stdint.h>
25 #include <string> 26 #include <string>
26 #include <mutex> 27 #include <mutex>
27 #include <AdblockPlus/AppInfo.h> 28 #include <AdblockPlus/AppInfo.h>
28 #include <AdblockPlus/LogSystem.h> 29 #include <AdblockPlus/LogSystem.h>
29 #include <AdblockPlus/FileSystem.h> 30 #include <AdblockPlus/FileSystem.h>
30 #include <AdblockPlus/JsValue.h> 31 #include <AdblockPlus/JsValue.h>
31 #include <AdblockPlus/WebRequest.h> 32 #include <AdblockPlus/WebRequest.h>
32 33
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 void SetGlobalProperty(const std::string& name, AdblockPlus::JsValuePtr valu e); 264 void SetGlobalProperty(const std::string& name, AdblockPlus::JsValuePtr valu e);
264 265
265 /** 266 /**
266 * Returns a pointer to associated v8::Isolate. 267 * Returns a pointer to associated v8::Isolate.
267 */ 268 */
268 v8::Isolate* GetIsolate() 269 v8::Isolate* GetIsolate()
269 { 270 {
270 return isolate->Get(); 271 return isolate->Get();
271 } 272 }
272 273
274 // Private functionality required to implement timers.
275 struct TimerTaskInfo
276 {
277 ~TimerTaskInfo();
278 int delay;
279 std::vector<std::unique_ptr<v8::Persistent<v8::Value>>> arguments;
280 };
281 typedef std::list<TimerTaskInfo> TimerTaskInfos;
282 struct TimerTask
283 {
284 std::weak_ptr<JsEngine> weakJsEngine;
285 TimerTaskInfos::const_iterator taskInfoIterator;
286 };
287 TimerTask CreateTimerTask(const v8::Arguments& arguments);
288 void CallTimerTask(TimerTaskInfos::const_iterator taskInfoIterator);
273 private: 289 private:
274 explicit JsEngine(const ScopedV8IsolatePtr& isolate); 290 explicit JsEngine(const ScopedV8IsolatePtr& isolate);
275 291
276 JsValuePtr GetGlobalObject(); 292 JsValuePtr GetGlobalObject();
277 293
278 /// Isolate must be disposed only after disposing of all objects which are 294 /// Isolate must be disposed only after disposing of all objects which are
279 /// using it. 295 /// using it.
280 ScopedV8IsolatePtr isolate; 296 ScopedV8IsolatePtr isolate;
281 297
282 FileSystemPtr fileSystem; 298 FileSystemPtr fileSystem;
283 WebRequestPtr webRequest; 299 WebRequestPtr webRequest;
284 LogSystemPtr logSystem; 300 LogSystemPtr logSystem;
285 std::unique_ptr<v8::Persistent<v8::Context>> context; 301 std::unique_ptr<v8::Persistent<v8::Context>> context;
286 EventMap eventCallbacks; 302 EventMap eventCallbacks;
287 std::mutex eventCallbacksMutex; 303 std::mutex eventCallbacksMutex;
288 std::mutex isConnectionAllowedMutex; 304 std::mutex isConnectionAllowedMutex;
289 IsConnectionAllowedCallback isConnectionAllowed; 305 IsConnectionAllowedCallback isConnectionAllowed;
306 TimerTaskInfos timerTaskInfos;
290 }; 307 };
291 } 308 }
292 309
293 #endif 310 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld