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

Side by Side Diff: include/AdblockPlus/JsEngine.h

Issue 29361562: Issue 3594 - remove circular references JsEngine-JsValue-JsEngine (Closed)
Patch Set: temporary workaround for race condition Created Dec. 1, 2016, 10:26 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 | include/AdblockPlus/JsValue.h » ('j') | src/JsValue.cpp » ('J')
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 * Event callback function. 86 * Event callback function.
87 */ 87 */
88 typedef std::function<void(JsValueList& params)> EventCallback; 88 typedef std::function<void(JsValueList& params)> EventCallback;
89 89
90 /** 90 /**
91 * Maps events to callback functions. 91 * Maps events to callback functions.
92 */ 92 */
93 typedef std::map<std::string, EventCallback> EventMap; 93 typedef std::map<std::string, EventCallback> EventMap;
94 94
95 /** 95 /**
96 * Exception which is thrown when JsEngine is not available.
97 *
98 * For instance, if JsEngine is already released but someone calls a method
99 * on JsValue this exception will be thrown.
100 */
101 class JsEngineNotAvailableException : public std::runtime_error
102 {
103 public:
104 JsEngineNotAvailableException()
105 : std::runtime_error("JsEngine is not available")
106 {
107 }
108 };
109
110 /**
96 * Creates a new JavaScript engine instance. 111 * Creates a new JavaScript engine instance.
97 * @param appInfo Information about the app. 112 * @param appInfo Information about the app.
98 * @param isolate v8::Isolate wrapper. This parameter should be considered 113 * @param isolate v8::Isolate wrapper. This parameter should be considered
99 * as a temporary hack for tests, it will go away. Issue #3593. 114 * as a temporary hack for tests, it will go away. Issue #3593.
100 * @return New `JsEngine` instance. 115 * @return New `JsEngine` instance.
101 */ 116 */
102 static JsEnginePtr New(const AppInfo& appInfo = AppInfo(), const ScopedV8Iso latePtr& isolate = ScopedV8IsolatePtr(new ScopedV8Isolate())); 117 static JsEnginePtr New(const AppInfo& appInfo = AppInfo(), const ScopedV8Iso latePtr& isolate = ScopedV8IsolatePtr(new ScopedV8Isolate()));
103 118
104 /** 119 /**
105 * Registers the callback function for an event. 120 * Registers the callback function for an event.
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 FileSystemPtr fileSystem; 275 FileSystemPtr fileSystem;
261 WebRequestPtr webRequest; 276 WebRequestPtr webRequest;
262 LogSystemPtr logSystem; 277 LogSystemPtr logSystem;
263 std::unique_ptr<v8::Persistent<v8::Context>> context; 278 std::unique_ptr<v8::Persistent<v8::Context>> context;
264 EventMap eventCallbacks; 279 EventMap eventCallbacks;
265 JsValuePtr globalJsObject; 280 JsValuePtr globalJsObject;
266 }; 281 };
267 } 282 }
268 283
269 #endif 284 #endif
OLDNEW
« no previous file with comments | « no previous file | include/AdblockPlus/JsValue.h » ('j') | src/JsValue.cpp » ('J')

Powered by Google App Engine
This is Rietveld