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: rebase and move 'isolate' into the proper scopes Created Feb. 5, 2015, 3:18 p.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 <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 73 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
Felix Dahlke 2015/02/06 04:17:27 Unrelated as well.
95 try 94 try
96 { 95 {
97 AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(a rguments); 96 AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::FromArguments(a rguments);
98 AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(arguments) ; 97 AdblockPlus::JsValueList converted = jsEngine->ConvertArguments(arguments) ;
99 if (converted.size() != 3u) 98 if (converted.size() != 3u)
100 throw std::runtime_error("GET requires exactly 3 arguments"); 99 throw std::runtime_error("GET requires exactly 3 arguments");
101 thread = new WebRequestThread(jsEngine, converted); 100 thread = new WebRequestThread(jsEngine, converted);
102 } 101 }
103 catch (const std::exception& e) 102 catch (const std::exception& e)
104 { 103 {
105 using AdblockPlus::Utils::ToV8String; 104 using AdblockPlus::Utils::ToV8String;
106 v8::Isolate* isolate = arguments.GetIsolate(); 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