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

Delta Between Two Patch Sets: src/FileSystemJsObject.cpp

Issue 29812649: Issue 6526 - *ToV8String() return MaybeLocal<> and check Call() return value (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Left Patch Set: Introduce CHECKED_TO_LOCAL_NOTHROW and use it. Created June 22, 2018, 3:49 p.m.
Right Patch Set: Wrap macro arguments in brackets. Created Aug. 6, 2018, 1:25 p.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 | « no previous file | src/JsEngine.cpp » ('j') | 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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 throw std::runtime_error("`this` pointer has to be an object"); 180 throw std::runtime_error("`this` pointer has to be an object");
181 181
182 auto isolate = jsEngine->GetIsolate(); 182 auto isolate = jsEngine->GetIsolate();
183 const v8::TryCatch tryCatch(isolate); 183 const v8::TryCatch tryCatch(isolate);
184 const auto contentEnd = content.cend(); 184 const auto contentEnd = content.cend();
185 auto stringBegin = SkipEndOfLine(content.begin(), contentEnd); 185 auto stringBegin = SkipEndOfLine(content.begin(), contentEnd);
186 auto v8Context = isolate->GetCurrentContext(); 186 auto v8Context = isolate->GetCurrentContext();
187 do 187 do
188 { 188 {
189 auto stringEnd = AdvanceToEndOfLine(stringBegin, contentEnd); 189 auto stringEnd = AdvanceToEndOfLine(stringBegin, contentEnd);
190 auto jsLine = CHECKED_TO_LOCAL( 190 auto jsLine = CHECKED_TO_LOCAL_WITH_TRY_CATCH(
191 isolate, 191 isolate,
192 Utils::StringBufferToV8String( 192 Utils::StringBufferToV8String(
193 isolate, StringBuffer(stringBegin, stringEnd)), 193 isolate, StringBuffer(stringBegin, stringEnd)),
194 tryCatch).As<v8::Value>(); 194 tryCatch).As<v8::Value>();
195 195
196 CHECKED_TO_LOCAL( 196 CHECKED_TO_LOCAL_WITH_TRY_CATCH(
197 isolate, processFunc->Call(v8Context, globalContext, 1, &jsLin e), 197 isolate, processFunc->Call(v8Context, globalContext, 1, &jsLin e),
198 tryCatch); 198 tryCatch);
199 199
200 stringBegin = SkipEndOfLine(stringEnd, contentEnd); 200 stringBegin = SkipEndOfLine(stringEnd, contentEnd);
201 } while (stringBegin != contentEnd); 201 } while (stringBegin != contentEnd);
202 jsEngine->GetJsValues(weakData->weakResolveCallback)[0].Call(); 202 jsEngine->GetJsValues(weakData->weakResolveCallback)[0].Call();
203 }, [weakData](const std::string& error) 203 }, [weakData](const std::string& error)
204 { 204 {
205 if (error.empty()) 205 if (error.empty())
206 return; 206 return;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 JsValue& FileSystemJsObject::Setup(JsEngine& jsEngine, JsValue& obj) 367 JsValue& FileSystemJsObject::Setup(JsEngine& jsEngine, JsValue& obj)
368 { 368 {
369 obj.SetProperty("read", jsEngine.NewCallback(::ReadCallback::V8Callback)); 369 obj.SetProperty("read", jsEngine.NewCallback(::ReadCallback::V8Callback));
370 obj.SetProperty("readFromFile", jsEngine.NewCallback(::ReadFromFileCallback::V 8Callback)); 370 obj.SetProperty("readFromFile", jsEngine.NewCallback(::ReadFromFileCallback::V 8Callback));
371 obj.SetProperty("write", jsEngine.NewCallback(::WriteCallback)); 371 obj.SetProperty("write", jsEngine.NewCallback(::WriteCallback));
372 obj.SetProperty("move", jsEngine.NewCallback(::MoveCallback)); 372 obj.SetProperty("move", jsEngine.NewCallback(::MoveCallback));
373 obj.SetProperty("remove", jsEngine.NewCallback(::RemoveCallback)); 373 obj.SetProperty("remove", jsEngine.NewCallback(::RemoveCallback));
374 obj.SetProperty("stat", jsEngine.NewCallback(::StatCallback)); 374 obj.SetProperty("stat", jsEngine.NewCallback(::StatCallback));
375 return obj; 375 return obj;
376 } 376 }
LEFTRIGHT
« no previous file | src/JsEngine.cpp » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld