Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(608)

Side by Side Diff: extensions/renderer/safe_builtins.cc

Issue 1765423004: Revert of Use v8::MicrotasksScope internally in V8RecursionScope. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8rs-2-endofscope
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/renderer/module_system_test.cc ('k') | gin/run_microtasks_observer.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/renderer/safe_builtins.h" 5 #include "extensions/renderer/safe_builtins.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "extensions/renderer/script_context.h" 10 #include "extensions/renderer/script_context.h"
11 #include "extensions/renderer/v8_helpers.h" 11 #include "extensions/renderer/v8_helpers.h"
12 #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h"
13 12
14 namespace extensions { 13 namespace extensions {
15 14
16 using namespace v8_helpers; 15 using namespace v8_helpers;
17 16
18 namespace { 17 namespace {
19 18
20 const char kClassName[] = "extensions::SafeBuiltins"; 19 const char kClassName[] = "extensions::SafeBuiltins";
21 20
22 // Documentation for makeCallback in the JavaScript, out here to reduce the 21 // Documentation for makeCallback in the JavaScript, out here to reduce the
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext(); 193 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
195 int argc = args_length - first_arg_index; 194 int argc = args_length - first_arg_index;
196 scoped_ptr<v8::Local<v8::Value> []> argv(new v8::Local<v8::Value>[argc]); 195 scoped_ptr<v8::Local<v8::Value> []> argv(new v8::Local<v8::Value>[argc]);
197 for (int i = 0; i < argc; ++i) { 196 for (int i = 0; i < argc; ++i) {
198 CHECK(IsTrue(args->Has(context, i + first_arg_index))); 197 CHECK(IsTrue(args->Has(context, i + first_arg_index)));
199 // Getting a property value could throw an exception. 198 // Getting a property value could throw an exception.
200 if (!GetProperty(context, args, i + first_arg_index, &argv[i])) 199 if (!GetProperty(context, args, i + first_arg_index, &argv[i]))
201 return; 200 return;
202 } 201 }
203 202
204 blink::WebScopedMicrotaskSuppression microtasks_scope;
205 v8::Local<v8::Value> return_value; 203 v8::Local<v8::Value> return_value;
206 if (function->Call(context, recv, argc, argv.get()).ToLocal(&return_value)) 204 if (function->Call(context, recv, argc, argv.get()).ToLocal(&return_value))
207 info.GetReturnValue().Set(return_value); 205 info.GetReturnValue().Set(return_value);
208 } 206 }
209 207
210 static void Save(const v8::FunctionCallbackInfo<v8::Value>& info) { 208 static void Save(const v8::FunctionCallbackInfo<v8::Value>& info) {
211 CHECK(info.Length() == 2 && info[0]->IsString() && info[1]->IsObject()); 209 CHECK(info.Length() == 2 && info[0]->IsString() && info[1]->IsObject());
212 SaveImpl(*v8::String::Utf8Value(info[0]), 210 SaveImpl(*v8::String::Utf8Value(info[0]),
213 info[1], 211 info[1],
214 info.GetIsolate()->GetCurrentContext()); 212 info.GetIsolate()->GetCurrentContext());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 244
247 v8::Local<v8::Object> SafeBuiltins::GetString() const { 245 v8::Local<v8::Object> SafeBuiltins::GetString() const {
248 return Load("String", context_->v8_context()); 246 return Load("String", context_->v8_context());
249 } 247 }
250 248
251 v8::Local<v8::Object> SafeBuiltins::GetError() const { 249 v8::Local<v8::Object> SafeBuiltins::GetError() const {
252 return Load("Error", context_->v8_context()); 250 return Load("Error", context_->v8_context());
253 } 251 }
254 252
255 } // namespace extensions 253 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/module_system_test.cc ('k') | gin/run_microtasks_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698