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

Side by Side Diff: extensions/renderer/guest_view/extensions_guest_view_container.cc

Issue 1167423002: Use V8 Maybe APIs in extensions/renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
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/guest_view/extensions_guest_view_container.h" 5 #include "extensions/renderer/guest_view/extensions_guest_view_container.h"
6 6
7 #include "content/public/renderer/render_frame.h" 7 #include "content/public/renderer/render_frame.h"
8 #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" 8 #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h"
9 #include "ui/gfx/geometry/size.h" 9 #include "ui/gfx/geometry/size.h"
10 10
(...skipping 13 matching lines...) Expand all
24 v8::HandleScope handle_scope(destruction_isolate_); 24 v8::HandleScope handle_scope(destruction_isolate_);
25 v8::Local<v8::Function> callback = v8::Local<v8::Function>::New( 25 v8::Local<v8::Function> callback = v8::Local<v8::Function>::New(
26 destruction_isolate_, destruction_callback_); 26 destruction_isolate_, destruction_callback_);
27 v8::Local<v8::Context> context = callback->CreationContext(); 27 v8::Local<v8::Context> context = callback->CreationContext();
28 if (context.IsEmpty()) 28 if (context.IsEmpty())
29 return; 29 return;
30 30
31 v8::Context::Scope context_scope(context); 31 v8::Context::Scope context_scope(context);
32 blink::WebScopedMicrotaskSuppression suppression; 32 blink::WebScopedMicrotaskSuppression suppression;
33 33
34 callback->Call(context->Global(), 0 /* argc */, nullptr); 34 auto maybe =
35 callback->Call(context, context->Global(), 0 /* argc */, nullptr);
36 DCHECK(!maybe.IsEmpty());
35 } 37 }
36 } 38 }
37 39
38 void ExtensionsGuestViewContainer::RegisterDestructionCallback( 40 void ExtensionsGuestViewContainer::RegisterDestructionCallback(
39 v8::Local<v8::Function> callback, 41 v8::Local<v8::Function> callback,
40 v8::Isolate* isolate) { 42 v8::Isolate* isolate) {
41 destruction_callback_.Reset(isolate, callback); 43 destruction_callback_.Reset(isolate, callback);
42 destruction_isolate_ = isolate; 44 destruction_isolate_ = isolate;
43 } 45 }
44 46
(...skipping 25 matching lines...) Expand all
70 return; 72 return;
71 73
72 const int argc = 2; 74 const int argc = 2;
73 v8::Local<v8::Value> argv[argc] = { 75 v8::Local<v8::Value> argv[argc] = {
74 v8::Integer::New(element_resize_isolate_, new_size.width()), 76 v8::Integer::New(element_resize_isolate_, new_size.width()),
75 v8::Integer::New(element_resize_isolate_, new_size.height())}; 77 v8::Integer::New(element_resize_isolate_, new_size.height())};
76 78
77 v8::Context::Scope context_scope(context); 79 v8::Context::Scope context_scope(context);
78 blink::WebScopedMicrotaskSuppression suppression; 80 blink::WebScopedMicrotaskSuppression suppression;
79 81
80 callback->Call(context->Global(), argc, argv); 82 auto maybe = callback->Call(context, context->Global(), argc, argv);
83 DCHECK(!maybe.IsEmpty());
81 } 84 }
82 85
83 } // namespace extensions 86 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/file_system_natives.cc ('k') | extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698