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

Delta Between Two Patch Sets: src/WebRequestJsObject.cpp

Issue 6112412478472192: Issue 1547 - Pass isolate to v8::API (Closed)
Left Patch Set: Created Nov. 10, 2014, 9:05 a.m.
Right Patch Set: remove new empty lines Created Feb. 9, 2015, 11:02 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/Utils.cpp ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2014 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
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 *
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 private: 84 private:
85 AdblockPlus::JsEnginePtr jsEngine; 85 AdblockPlus::JsEnginePtr jsEngine;
86 std::string url; 86 std::string url;
87 AdblockPlus::HeaderList headers; 87 AdblockPlus::HeaderList headers;
88 AdblockPlus::JsValuePtr callback; 88 AdblockPlus::JsValuePtr callback;
89 }; 89 };
90 90
91 v8::Handle<v8::Value> GETCallback(const v8::Arguments& arguments) 91 v8::Handle<v8::Value> GETCallback(const v8::Arguments& arguments)
92 { 92 {
93 WebRequestThread* thread; 93 WebRequestThread* thread;
94
95 v8::Isolate* isolate = arguments.GetIsolate();
Felix Dahlke 2015/02/05 04:58:24 Unnecessarily large scope again.
96 try 94 try
97 { 95 {
98 AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(a rguments); 96 AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(a rguments);
99 AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(arguments) ; 97 AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(arguments) ;
100 if (converted.size() != 3u) 98 if (converted.size() != 3u)
101 throw std::runtime_error("GET requires exactly 3 arguments"); 99 throw std::runtime_error("GET requires exactly 3 arguments");
102 thread = new WebRequestThread(jsEngine, converted); 100 thread = new WebRequestThread(jsEngine, converted);
103 } 101 }
104 catch (const std::exception& e) 102 catch (const std::exception& e)
105 { 103 {
106 using AdblockPlus::Utils::ToV8String; 104 using AdblockPlus::Utils::ToV8String;
105 v8::Isolate* isolate = arguments.GetIsolate();
107 return v8::ThrowException(ToV8String(isolate, e.what())); 106 return v8::ThrowException(ToV8String(isolate, e.what()));
108 } 107 }
109 thread->Start(); 108 thread->Start();
110 return v8::Undefined(); 109 return v8::Undefined();
111 } 110 }
112 } 111 }
113 112
114 AdblockPlus::JsValuePtr AdblockPlus::WebRequestJsObject::Setup( 113 AdblockPlus::JsValuePtr AdblockPlus::WebRequestJsObject::Setup(
115 AdblockPlus::JsEnginePtr jsEngine, AdblockPlus::JsValuePtr obj) 114 AdblockPlus::JsEnginePtr jsEngine, AdblockPlus::JsValuePtr obj)
116 { 115 {
117 obj->SetProperty("GET", jsEngine->NewCallback(::GETCallback)); 116 obj->SetProperty("GET", jsEngine->NewCallback(::GETCallback));
118 return obj; 117 return obj;
119 } 118 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld