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

Side by Side Diff: src/JsEngine.cpp

Issue 6584950149087232: Issue 1280 - Update v8 (Closed)
Patch Set: get rid of auto and fix friends of JsValue Created Oct. 31, 2014, 5:11 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
OLDNEW
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-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 { 48 {
49 } 49 }
50 50
51 AdblockPlus::JsEnginePtr AdblockPlus::JsEngine::New(const AppInfo& appInfo) 51 AdblockPlus::JsEnginePtr AdblockPlus::JsEngine::New(const AppInfo& appInfo)
52 { 52 {
53 JsEnginePtr result(new JsEngine()); 53 JsEnginePtr result(new JsEngine());
54 54
55 const v8::Locker locker(result->isolate); 55 const v8::Locker locker(result->isolate);
56 const v8::HandleScope handleScope; 56 const v8::HandleScope handleScope;
57 57
58 result->context.reset(result->isolate, v8::Context::New()); 58 result->context.reset(result->isolate, v8::Context::New(result->isolate));
59 AdblockPlus::GlobalJsObject::Setup(result, appInfo, 59 AdblockPlus::GlobalJsObject::Setup(result, appInfo,
60 JsValuePtr(new JsValue(result, result->context->Global()))); 60 JsValuePtr(new JsValue(result, v8::Local<v8::Context>::New(result->isolate , result->context)->Global())));
Wladimir Palant 2014/11/01 22:30:25 Why do you need to create a new handle for the con
sergei 2014/11/03 12:58:19 Not sure that I correctly understand what you mean
Felix Dahlke 2014/11/03 15:46:24 I see. Looked through the docs a bit, unfortunatel
Wladimir Palant 2014/11/03 18:06:33 I see, so v8::Persistent cannot be used as a handl
61 return result; 61 return result;
62 } 62 }
63 63
64 AdblockPlus::JsValuePtr AdblockPlus::JsEngine::Evaluate(const std::string& sourc e, 64 AdblockPlus::JsValuePtr AdblockPlus::JsEngine::Evaluate(const std::string& sourc e,
65 const std::string& filename) 65 const std::string& filename)
66 { 66 {
67 const JsContext context(shared_from_this()); 67 const JsContext context(shared_from_this());
68 const v8::TryCatch tryCatch; 68 const v8::TryCatch tryCatch;
69 const v8::Handle<v8::Script> script = CompileScript(source, filename); 69 const v8::Handle<v8::Script> script = CompileScript(source, filename);
70 CheckTryCatch(tryCatch); 70 CheckTryCatch(tryCatch);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 return logSystem; 193 return logSystem;
194 } 194 }
195 195
196 void AdblockPlus::JsEngine::SetLogSystem(AdblockPlus::LogSystemPtr val) 196 void AdblockPlus::JsEngine::SetLogSystem(AdblockPlus::LogSystemPtr val)
197 { 197 {
198 if (!val) 198 if (!val)
199 throw std::runtime_error("LogSystem cannot be null"); 199 throw std::runtime_error("LogSystem cannot be null");
200 200
201 logSystem = val; 201 logSystem = val;
202 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld