Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/JsEngine.cpp

Issue 29499617: Noissue - set default values for platform interfaces to nullptr (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created July 27, 2017, 10:16 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld