| 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-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 18 matching lines...) Expand all  Loading... | 
| 29 #include <AdblockPlus/JsValue.h> | 29 #include <AdblockPlus/JsValue.h> | 
| 30 #include <AdblockPlus/WebRequest.h> | 30 #include <AdblockPlus/WebRequest.h> | 
| 31 | 31 | 
| 32 namespace v8 | 32 namespace v8 | 
| 33 { | 33 { | 
| 34   class Arguments; | 34   class Arguments; | 
| 35   class Isolate; | 35   class Isolate; | 
| 36   class Value; | 36   class Value; | 
| 37   class Context; | 37   class Context; | 
| 38   template<class T> class Handle; | 38   template<class T> class Handle; | 
| 39   typedef Handle<Value>(*InvocationCallback)(const Arguments &args); | 39   template<typename T> class FunctionCallbackInfo; | 
|  | 40   typedef void(*FunctionCallback)(const FunctionCallbackInfo<v8::Value>& info); | 
| 40 } | 41 } | 
| 41 | 42 | 
| 42 namespace AdblockPlus | 43 namespace AdblockPlus | 
| 43 { | 44 { | 
| 44   class JsEngine; | 45   class JsEngine; | 
| 45 | 46 | 
| 46   /** | 47   /** | 
| 47    * Shared smart pointer to a `JsEngine` instance. | 48    * Shared smart pointer to a `JsEngine` instance. | 
| 48    */ | 49    */ | 
| 49   typedef std::shared_ptr<JsEngine> JsEnginePtr; | 50   typedef std::shared_ptr<JsEngine> JsEnginePtr; | 
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 163      */ | 164      */ | 
| 164     JsValuePtr NewObject(); | 165     JsValuePtr NewObject(); | 
| 165 | 166 | 
| 166     /** | 167     /** | 
| 167      * Creates a JavaScript function that invokes a C++ callback. | 168      * Creates a JavaScript function that invokes a C++ callback. | 
| 168      * @param callback C++ callback to invoke. The callback receives a | 169      * @param callback C++ callback to invoke. The callback receives a | 
| 169      *        `v8::Arguments` object and can use `FromArguments()` to retrieve | 170      *        `v8::Arguments` object and can use `FromArguments()` to retrieve | 
| 170      *        the current `JsEngine`. | 171      *        the current `JsEngine`. | 
| 171      * @return New `JsValue` instance. | 172      * @return New `JsValue` instance. | 
| 172      */ | 173      */ | 
| 173     JsValuePtr NewCallback(v8::InvocationCallback callback); | 174     JsValuePtr NewCallback(v8::FunctionCallback callback); | 
| 174 | 175 | 
| 175     /** | 176     /** | 
| 176      * Returns a `JsEngine` instance contained in a `v8::Arguments` object. | 177      * Returns a `JsEngine` instance contained in a `v8::Arguments` object. | 
| 177      * Use this in callbacks created via `NewCallback()` to retrieve the current | 178      * Use this in callbacks created via `NewCallback()` to retrieve the current | 
| 178      * `JsEngine`. | 179      * `JsEngine`. | 
| 179      * @param arguments `v8::Arguments` object containing the `JsEngine` | 180      * @param arguments `v8::Arguments` object containing the `JsEngine` | 
| 180      *        instance. | 181      *        instance. | 
| 181      * @return `JsEngine` instance from `v8::Arguments`. | 182      * @return `JsEngine` instance from `v8::Arguments`. | 
| 182      */ | 183      */ | 
| 183     static JsEnginePtr FromArguments(const v8::Arguments& arguments); | 184     static JsEnginePtr FromArguments(const v8::FunctionCallbackInfo<v8::Value>& 
     arguments); | 
| 184 | 185 | 
| 185     /** | 186     /** | 
| 186      * Converts v8 arguments to `JsValue` objects. | 187      * Converts v8 arguments to `JsValue` objects. | 
| 187      * @param arguments `v8::Arguments` object containing the arguments to | 188      * @param arguments `v8::Arguments` object containing the arguments to | 
| 188      *        convert. | 189      *        convert. | 
| 189      * @return List of arguments converted to `JsValue` objects. | 190      * @return List of arguments converted to `JsValue` objects. | 
| 190      */ | 191      */ | 
| 191     JsValueList ConvertArguments(const v8::Arguments& arguments); | 192     JsValueList ConvertArguments(const v8::FunctionCallbackInfo<v8::Value>& argu
     ments); | 
| 192 | 193 | 
| 193     /** | 194     /** | 
| 194      * @see `SetFileSystem()`. | 195      * @see `SetFileSystem()`. | 
| 195      */ | 196      */ | 
| 196     FileSystemPtr GetFileSystem(); | 197     FileSystemPtr GetFileSystem(); | 
| 197 | 198 | 
| 198     /** | 199     /** | 
| 199      * Sets the `FileSystem` implementation used for all file I/O. | 200      * Sets the `FileSystem` implementation used for all file I/O. | 
| 200      * Setting this is optional, the engine will use a `DefaultFileSystem` | 201      * Setting this is optional, the engine will use a `DefaultFileSystem` | 
| 201      * instance by default, which might be sufficient. | 202      * instance by default, which might be sufficient. | 
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 248   private: | 249   private: | 
| 249     explicit JsEngine(const ScopedV8IsolatePtr& isolate); | 250     explicit JsEngine(const ScopedV8IsolatePtr& isolate); | 
| 250 | 251 | 
| 251     /// Isolate must be disposed only after disposing of all objects which are | 252     /// Isolate must be disposed only after disposing of all objects which are | 
| 252     /// using it. | 253     /// using it. | 
| 253     ScopedV8IsolatePtr isolate; | 254     ScopedV8IsolatePtr isolate; | 
| 254 | 255 | 
| 255     FileSystemPtr fileSystem; | 256     FileSystemPtr fileSystem; | 
| 256     WebRequestPtr webRequest; | 257     WebRequestPtr webRequest; | 
| 257     LogSystemPtr logSystem; | 258     LogSystemPtr logSystem; | 
| 258     std::unique_ptr<v8::Persistent<v8::Context>> context; | 259     std::unique_ptr<v8::UniquePersistent<v8::Context>> context; | 
| 259     EventMap eventCallbacks; | 260     EventMap eventCallbacks; | 
| 260     JsValuePtr globalJsObject; | 261     JsValuePtr globalJsObject; | 
| 261   }; | 262   }; | 
| 262 } | 263 } | 
| 263 | 264 | 
| 264 #endif | 265 #endif | 
| OLD | NEW | 
|---|