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

Side by Side Diff: src/FileSystemJsObject.cpp

Issue 29661564: Template out V8 and prepare for other JS engine implementations
Patch Set: Created Jan. 10, 2018, 1:29 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/ConsoleJsObject.h ('k') | src/GlobalJsObject.h » ('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-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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 auto jsValues = jsEngine->TakeJsValues(weakCallback); 123 auto jsValues = jsEngine->TakeJsValues(weakCallback);
124 if (!error.empty()) 124 if (!error.empty())
125 { 125 {
126 jsValues[1].Call(jsEngine->NewValue(error)); 126 jsValues[1].Call(jsEngine->NewValue(error));
127 return; 127 return;
128 } 128 }
129 129
130 auto processFunc = jsValues[0].UnwrapValue().As<v8::Function>(); 130 auto processFunc = jsValues[0].UnwrapValue().As<v8::Function>();
131 131
132 auto globalContext = context.GetV8Context()->Global(); 132 auto globalContext = context.GetJSEngineContext()->Global();
133 if (!globalContext->IsObject()) 133 if (!globalContext->IsObject())
134 throw std::runtime_error("`this` pointer has to be an object"); 134 throw std::runtime_error("`this` pointer has to be an object");
135 135
136 const v8::TryCatch tryCatch; 136 const v8::TryCatch tryCatch;
137 137
138 const auto contentEnd = content.cend(); 138 const auto contentEnd = content.cend();
139 auto stringBegin = SkipEndOfLine(content.begin(), contentEnd); 139 auto stringBegin = SkipEndOfLine(content.begin(), contentEnd);
140 do 140 do
141 { 141 {
142 auto stringEnd = AdvanceToEndOfLine(stringBegin, contentEnd); 142 auto stringEnd = AdvanceToEndOfLine(stringBegin, contentEnd);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 JsValue& FileSystemJsObject::Setup(JsEngine& jsEngine, JsValue& obj) 308 JsValue& FileSystemJsObject::Setup(JsEngine& jsEngine, JsValue& obj)
309 { 309 {
310 obj.SetProperty("read", jsEngine.NewCallback(::ReadCallback)); 310 obj.SetProperty("read", jsEngine.NewCallback(::ReadCallback));
311 obj.SetProperty("readFromFile", jsEngine.NewCallback(::ReadFromFileCallback)); 311 obj.SetProperty("readFromFile", jsEngine.NewCallback(::ReadFromFileCallback));
312 obj.SetProperty("write", jsEngine.NewCallback(::WriteCallback)); 312 obj.SetProperty("write", jsEngine.NewCallback(::WriteCallback));
313 obj.SetProperty("move", jsEngine.NewCallback(::MoveCallback)); 313 obj.SetProperty("move", jsEngine.NewCallback(::MoveCallback));
314 obj.SetProperty("remove", jsEngine.NewCallback(::RemoveCallback)); 314 obj.SetProperty("remove", jsEngine.NewCallback(::RemoveCallback));
315 obj.SetProperty("stat", jsEngine.NewCallback(::StatCallback)); 315 obj.SetProperty("stat", jsEngine.NewCallback(::StatCallback));
316 return obj; 316 return obj;
317 } 317 }
OLDNEW
« no previous file with comments | « src/ConsoleJsObject.h ('k') | src/GlobalJsObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld