| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 <stdexcept> | 21 #include <stdexcept> |
| 22 #include <stdint.h> | 22 #include <stdint.h> |
| 23 #include <string> | 23 #include <string> |
| 24 #include <v8.h> | 24 #include <v8.h> |
| 25 #include <AdblockPlus/AppInfo.h> | 25 #include <AdblockPlus/AppInfo.h> |
| 26 #include <AdblockPlus/ErrorCallback.h> | 26 #include <AdblockPlus/LogSystem.h> |
| 27 #include <AdblockPlus/FileSystem.h> | 27 #include <AdblockPlus/FileSystem.h> |
| 28 #include <AdblockPlus/JsValue.h> | 28 #include <AdblockPlus/JsValue.h> |
| 29 #include <AdblockPlus/WebRequest.h> | 29 #include <AdblockPlus/WebRequest.h> |
| 30 | 30 |
| 31 #include "tr1_memory.h" | 31 #include "tr1_memory.h" |
| 32 | 32 |
| 33 namespace AdblockPlus | 33 namespace AdblockPlus |
| 34 { | 34 { |
| 35 class JsError : public std::runtime_error | 35 class JsError : public std::runtime_error |
| 36 { | 36 { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 #endif | 70 #endif |
| 71 JsValuePtr NewObject(); | 71 JsValuePtr NewObject(); |
| 72 JsValuePtr NewCallback(v8::InvocationCallback callback); | 72 JsValuePtr NewCallback(v8::InvocationCallback callback); |
| 73 static JsEnginePtr FromArguments(const v8::Arguments& arguments); | 73 static JsEnginePtr FromArguments(const v8::Arguments& arguments); |
| 74 JsValueList ConvertArguments(const v8::Arguments& arguments); | 74 JsValueList ConvertArguments(const v8::Arguments& arguments); |
| 75 | 75 |
| 76 FileSystemPtr GetFileSystem(); | 76 FileSystemPtr GetFileSystem(); |
| 77 void SetFileSystem(FileSystemPtr val); | 77 void SetFileSystem(FileSystemPtr val); |
| 78 WebRequestPtr GetWebRequest(); | 78 WebRequestPtr GetWebRequest(); |
| 79 void SetWebRequest(WebRequestPtr val); | 79 void SetWebRequest(WebRequestPtr val); |
| 80 ErrorCallbackPtr GetErrorCallback(); | 80 LogSystemPtr GetLogSystem(); |
| 81 void SetErrorCallback(ErrorCallbackPtr val); | 81 void SetLogSystem(LogSystemPtr val); |
| 82 | 82 |
| 83 class Context | 83 class Context |
| 84 { | 84 { |
| 85 public: | 85 public: |
| 86 Context(const JsEnginePtr jsEngine); | 86 Context(const JsEnginePtr jsEngine); |
| 87 virtual inline ~Context() {}; | 87 virtual inline ~Context() {}; |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 const v8::Locker locker; | 90 const v8::Locker locker; |
| 91 const v8::HandleScope handleScope; | 91 const v8::HandleScope handleScope; |
| 92 const v8::Context::Scope contextScope; | 92 const v8::Context::Scope contextScope; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 JsEngine(); | 96 JsEngine(); |
| 97 | 97 |
| 98 FileSystemPtr fileSystem; | 98 FileSystemPtr fileSystem; |
| 99 WebRequestPtr webRequest; | 99 WebRequestPtr webRequest; |
| 100 ErrorCallbackPtr errorCallback; | 100 LogSystemPtr logSystem; |
| 101 v8::Isolate* isolate; | 101 v8::Isolate* isolate; |
| 102 v8::Persistent<v8::Context> context; | 102 v8::Persistent<v8::Context> context; |
| 103 }; | 103 }; |
| 104 } | 104 } |
| 105 | 105 |
| 106 #endif | 106 #endif |
| OLD | NEW |