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

Side by Side Diff: src/JsEngine.cpp

Issue 5598762307158016: Issue 1550 - Get rid of V8ValueHolder.h (Closed)
Patch Set: update Created June 11, 2015, 1:02 p.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 | « src/JsContext.cpp ('k') | src/JsValue.cpp » ('j') | 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-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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 AdblockPlus::JsEnginePtr AdblockPlus::JsEngine::New(const AppInfo& appInfo) 83 AdblockPlus::JsEnginePtr AdblockPlus::JsEngine::New(const AppInfo& appInfo)
84 { 84 {
85 V8Initializer::Init(); 85 V8Initializer::Init();
86 JsEnginePtr result(new JsEngine()); 86 JsEnginePtr result(new JsEngine());
87 87
88 const v8::Locker locker(result->isolate); 88 const v8::Locker locker(result->isolate);
89 const v8::Isolate::Scope isolateScope(result->isolate); 89 const v8::Isolate::Scope isolateScope(result->isolate);
90 const v8::HandleScope handleScope(result->isolate); 90 const v8::HandleScope handleScope(result->isolate);
91 91
92 result->context.reset(result->isolate, v8::Context::New(result->isolate)); 92 result->context.reset(new v8::Persistent<v8::Context>(result->isolate,
93 v8::Context::New(result->isolate)));
93 v8::Local<v8::Object> globalContext = v8::Local<v8::Context>::New( 94 v8::Local<v8::Object> globalContext = v8::Local<v8::Context>::New(
94 result->isolate, result->context)->Global(); 95 result->isolate, *result->context)->Global();
95 AdblockPlus::GlobalJsObject::Setup(result, appInfo, 96 AdblockPlus::GlobalJsObject::Setup(result, appInfo,
96 JsValuePtr(new JsValue(result, globalContext))); 97 JsValuePtr(new JsValue(result, globalContext)));
97 return result; 98 return result;
98 } 99 }
99 100
100 AdblockPlus::JsValuePtr AdblockPlus::JsEngine::Evaluate(const std::string& sourc e, 101 AdblockPlus::JsValuePtr AdblockPlus::JsEngine::Evaluate(const std::string& sourc e,
101 const std::string& filename) 102 const std::string& filename)
102 { 103 {
103 const JsContext context(shared_from_this()); 104 const JsContext context(shared_from_this());
104 const v8::TryCatch tryCatch; 105 const v8::TryCatch tryCatch;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 return logSystem; 232 return logSystem;
232 } 233 }
233 234
234 void AdblockPlus::JsEngine::SetLogSystem(AdblockPlus::LogSystemPtr val) 235 void AdblockPlus::JsEngine::SetLogSystem(AdblockPlus::LogSystemPtr val)
235 { 236 {
236 if (!val) 237 if (!val)
237 throw std::runtime_error("LogSystem cannot be null"); 238 throw std::runtime_error("LogSystem cannot be null");
238 239
239 logSystem = val; 240 logSystem = val;
240 } 241 }
OLDNEW
« no previous file with comments | « src/JsContext.cpp ('k') | src/JsValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld