| OLD | NEW | 
|---|
| 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 | 
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 270      * instance by default, which might be sufficient. | 270      * instance by default, which might be sufficient. | 
| 271      * @param The `LogSystem` instance to use. | 271      * @param The `LogSystem` instance to use. | 
| 272      */ | 272      */ | 
| 273     void SetLogSystem(const LogSystemPtr& val); | 273     void SetLogSystem(const LogSystemPtr& val); | 
| 274 | 274 | 
| 275     /** | 275     /** | 
| 276      * Sets a global property that can be accessed by all the scripts. | 276      * Sets a global property that can be accessed by all the scripts. | 
| 277      * @param name Name of the property to set. | 277      * @param name Name of the property to set. | 
| 278      * @param value Value of the property to set. | 278      * @param value Value of the property to set. | 
| 279      */ | 279      */ | 
| 280     void SetGlobalProperty(const std::string& name, const AdblockPlus::JsValuePt
     r& value); | 280     void SetGlobalProperty(const std::string& name, const AdblockPlus::JsValue& 
     value); | 
| 281 | 281 | 
| 282     /** | 282     /** | 
| 283      * Returns a pointer to associated v8::Isolate. | 283      * Returns a pointer to associated v8::Isolate. | 
| 284      */ | 284      */ | 
| 285     v8::Isolate* GetIsolate() | 285     v8::Isolate* GetIsolate() | 
| 286     { | 286     { | 
| 287       return isolate->Get(); | 287       return isolate->Get(); | 
| 288     } | 288     } | 
| 289 | 289 | 
| 290   private: | 290   private: | 
| 291     struct TimerTask | 291     struct TimerTask | 
| 292     { | 292     { | 
| 293       ~TimerTask(); | 293       ~TimerTask(); | 
| 294       std::vector<std::unique_ptr<v8::Persistent<v8::Value>>> arguments; | 294       std::vector<std::unique_ptr<v8::Persistent<v8::Value>>> arguments; | 
| 295     }; | 295     }; | 
| 296     typedef std::list<TimerTask> TimerTasks; | 296     typedef std::list<TimerTask> TimerTasks; | 
| 297     void CallTimerTask(const TimerTasks::const_iterator& timerTaskIterator); | 297     void CallTimerTask(const TimerTasks::const_iterator& timerTaskIterator); | 
| 298 | 298 | 
| 299     explicit JsEngine(const ScopedV8IsolatePtr& isolate, TimerPtr timer); | 299     explicit JsEngine(const ScopedV8IsolatePtr& isolate, TimerPtr timer); | 
| 300 | 300 | 
| 301     JsValuePtr GetGlobalObject(); | 301     JsValue GetGlobalObject(); | 
| 302 | 302 | 
| 303     /// Isolate must be disposed only after disposing of all objects which are | 303     /// Isolate must be disposed only after disposing of all objects which are | 
| 304     /// using it. | 304     /// using it. | 
| 305     ScopedV8IsolatePtr isolate; | 305     ScopedV8IsolatePtr isolate; | 
| 306 | 306 | 
| 307     FileSystemPtr fileSystem; | 307     FileSystemPtr fileSystem; | 
| 308     WebRequestPtr webRequest; | 308     WebRequestPtr webRequest; | 
| 309     LogSystemPtr logSystem; | 309     LogSystemPtr logSystem; | 
| 310     std::unique_ptr<v8::Persistent<v8::Context>> context; | 310     std::unique_ptr<v8::Persistent<v8::Context>> context; | 
| 311     EventMap eventCallbacks; | 311     EventMap eventCallbacks; | 
| 312     std::mutex eventCallbacksMutex; | 312     std::mutex eventCallbacksMutex; | 
| 313     mutable std::mutex isConnectionAllowedMutex; | 313     mutable std::mutex isConnectionAllowedMutex; | 
| 314     IsConnectionAllowedCallback isConnectionAllowed; | 314     IsConnectionAllowedCallback isConnectionAllowed; | 
| 315     TimerTasks timerTasks; | 315     TimerTasks timerTasks; | 
| 316     TimerPtr timer; | 316     TimerPtr timer; | 
| 317   }; | 317   }; | 
| 318 } | 318 } | 
| 319 | 319 | 
| 320 #endif | 320 #endif | 
| OLD | NEW | 
|---|