| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 : fileSystem(std::move(fileSystem)) | 154 : fileSystem(std::move(fileSystem)) |
| 155 , timer(std::move(timer)) | 155 , timer(std::move(timer)) |
| 156 , webRequest(std::move(webRequest)) | 156 , webRequest(std::move(webRequest)) |
| 157 , logSystem(std::move(logSystem)) | 157 , logSystem(std::move(logSystem)) |
| 158 { | 158 { |
| 159 } | 159 } |
| 160 | 160 |
| 161 AdblockPlus::JsEnginePtr AdblockPlus::JsEngine::New(const AppInfo& appInfo, | 161 AdblockPlus::JsEnginePtr AdblockPlus::JsEngine::New(const AppInfo& appInfo, |
| 162 TimerPtr timer, FileSystemPtr fileSystem, WebRequestPtr webRequest, LogSystemP
tr logSystem) | 162 TimerPtr timer, FileSystemPtr fileSystem, WebRequestPtr webRequest, LogSystemP
tr logSystem) |
| 163 { | 163 { |
| 164 JsEnginePtr result(new JsEngine(std::move(timer), | 164 JsEnginePtr result(new JsEngine(timer ? std::move(timer) : CreateDefaultTimer(
), |
| 165 std::move(fileSystem), | 165 fileSystem ? std::move(fileSystem) : CreateDefaultFileSystem(), |
| 166 std::move(webRequest), | 166 webRequest ? std::move(webRequest) : CreateDefaultWebRequest(), |
| 167 std::move(logSystem))); | 167 logSystem ? std::move(logSystem) : CreateDefaultLogSystem())); |
| 168 | 168 |
| 169 const v8::Locker locker(result->GetIsolate()); | 169 const v8::Locker locker(result->GetIsolate()); |
| 170 const v8::Isolate::Scope isolateScope(result->GetIsolate()); | 170 const v8::Isolate::Scope isolateScope(result->GetIsolate()); |
| 171 const v8::HandleScope handleScope(result->GetIsolate()); | 171 const v8::HandleScope handleScope(result->GetIsolate()); |
| 172 | 172 |
| 173 result->context.reset(new v8::Global<v8::Context>(result->GetIsolate(), | 173 result->context.reset(new v8::Global<v8::Context>(result->GetIsolate(), |
| 174 v8::Context::New(result->GetIsolate()))); | 174 v8::Context::New(result->GetIsolate()))); |
| 175 auto global = result->GetGlobalObject(); | 175 auto global = result->GetGlobalObject(); |
| 176 AdblockPlus::GlobalJsObject::Setup(*result, appInfo, global); | 176 AdblockPlus::GlobalJsObject::Setup(*result, appInfo, global); |
| 177 return result; | 177 return result; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 { | 336 { |
| 337 return *logSystem; | 337 return *logSystem; |
| 338 } | 338 } |
| 339 | 339 |
| 340 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name, | 340 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name, |
| 341 const AdblockPlus::JsValue& value) | 341 const AdblockPlus::JsValue& value) |
| 342 { | 342 { |
| 343 auto global = GetGlobalObject(); | 343 auto global = GetGlobalObject(); |
| 344 global.SetProperty(name, value); | 344 global.SetProperty(name, value); |
| 345 } | 345 } |
| OLD | NEW |