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 |
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 #include <AdblockPlus.h> | 18 #include <AdblockPlus.h> |
19 #include "GlobalJsObject.h" | 19 #include "GlobalJsObject.h" |
20 #include "JsContext.h" | 20 #include "JsContext.h" |
21 #include "JsError.h" | 21 #include "JsError.h" |
22 #include "Utils.h" | 22 #include "Utils.h" |
23 #include "DefaultTimer.h" | 23 #include "DefaultTimer.h" |
24 #include "DefaultWebRequest.h" | 24 #include "DefaultWebRequest.h" |
| 25 #include "DefaultFileSystem.h" |
25 #include <libplatform/libplatform.h> | 26 #include <libplatform/libplatform.h> |
26 | 27 |
27 namespace | 28 namespace |
28 { | 29 { |
29 v8::Handle<v8::Script> CompileScript(v8::Isolate* isolate, | 30 v8::Handle<v8::Script> CompileScript(v8::Isolate* isolate, |
30 const std::string& source, const std::string& filename) | 31 const std::string& source, const std::string& filename) |
31 { | 32 { |
32 using AdblockPlus::Utils::ToV8String; | 33 using AdblockPlus::Utils::ToV8String; |
33 const v8::Handle<v8::String> v8Source = ToV8String(isolate, source); | 34 const v8::Handle<v8::String> v8Source = ToV8String(isolate, source); |
34 if (filename.length()) | 35 if (filename.length()) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 75 |
75 using namespace AdblockPlus; | 76 using namespace AdblockPlus; |
76 | 77 |
77 TimerPtr AdblockPlus::CreateDefaultTimer() | 78 TimerPtr AdblockPlus::CreateDefaultTimer() |
78 { | 79 { |
79 return TimerPtr(new DefaultTimer()); | 80 return TimerPtr(new DefaultTimer()); |
80 } | 81 } |
81 | 82 |
82 FileSystemPtr AdblockPlus::CreateDefaultFileSystem() | 83 FileSystemPtr AdblockPlus::CreateDefaultFileSystem() |
83 { | 84 { |
84 return FileSystemPtr(new DefaultFileSystem(std::make_shared<DefaultFileSystemS
ync>())); | 85 return FileSystemPtr(new DefaultFileSystem(std::unique_ptr<DefaultFileSystemSy
nc>(new DefaultFileSystemSync()))); |
85 } | 86 } |
86 | 87 |
87 WebRequestPtr AdblockPlus::CreateDefaultWebRequest() | 88 WebRequestPtr AdblockPlus::CreateDefaultWebRequest() |
88 { | 89 { |
89 return WebRequestPtr(new DefaultWebRequest(std::unique_ptr<DefaultWebRequestSy
nc>(new DefaultWebRequestSync()))); | 90 return WebRequestPtr(new DefaultWebRequest(std::unique_ptr<DefaultWebRequestSy
nc>(new DefaultWebRequestSync()))); |
90 } | 91 } |
91 | 92 |
92 LogSystemPtr AdblockPlus::CreateDefaultLogSystem() | 93 LogSystemPtr AdblockPlus::CreateDefaultLogSystem() |
93 { | 94 { |
94 return LogSystemPtr(new DefaultLogSystem()); | 95 return LogSystemPtr(new DefaultLogSystem()); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 { | 336 { |
336 return *logSystem; | 337 return *logSystem; |
337 } | 338 } |
338 | 339 |
339 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name, | 340 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name, |
340 const AdblockPlus::JsValue& value) | 341 const AdblockPlus::JsValue& value) |
341 { | 342 { |
342 auto global = GetGlobalObject(); | 343 auto global = GetGlobalObject(); |
343 global.SetProperty(name, value); | 344 global.SetProperty(name, value); |
344 } | 345 } |
OLD | NEW |