diff options
author | tfarina <tfarina@chromium.org> | 2015-04-29 10:03:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-29 17:04:18 +0000 |
commit | f85316f2347d04f10ecc1bb8114aec6a9cd5c87a (patch) | |
tree | acfb466ba16e2bd06acc2e08c49f7ab9368e1348 /extensions/renderer/guest_view | |
parent | a5bea75424e5db11fbcdb2a99b2ccd6d4868cf65 (diff) | |
download | chromium_src-f85316f2347d04f10ecc1bb8114aec6a9cd5c87a.zip chromium_src-f85316f2347d04f10ecc1bb8114aec6a9cd5c87a.tar.gz chromium_src-f85316f2347d04f10ecc1bb8114aec6a9cd5c87a.tar.bz2 |
extensions/renderer: Use v8::Local instead of v8::Handle.
Turns out, Handle is just an alias for Local:
https://chromium.googlesource.com/v8/v8.git/+/master/include/v8.h#334
BUG=424445
R=scheib@chromium.org
Review URL: https://codereview.chromium.org/1115563002
Cr-Commit-Position: refs/heads/master@{#327515}
Diffstat (limited to 'extensions/renderer/guest_view')
5 files changed, 47 insertions, 53 deletions
diff --git a/extensions/renderer/guest_view/extensions_guest_view_container.cc b/extensions/renderer/guest_view/extensions_guest_view_container.cc index e5cdc57..f453030 100644 --- a/extensions/renderer/guest_view/extensions_guest_view_container.cc +++ b/extensions/renderer/guest_view/extensions_guest_view_container.cc @@ -21,10 +21,9 @@ static base::LazyInstance<ExtensionsGuestViewContainerMap> namespace extensions { -ExtensionsGuestViewContainer::Request::Request( - GuestViewContainer* container, - v8::Handle<v8::Function> callback, - v8::Isolate* isolate) +ExtensionsGuestViewContainer::Request::Request(GuestViewContainer* container, + v8::Local<v8::Function> callback, + v8::Isolate* isolate) : container_(container), callback_(isolate, callback), isolate_(isolate) { } @@ -35,19 +34,20 @@ bool ExtensionsGuestViewContainer::Request::HasCallback() const { return !callback_.IsEmpty(); } -v8::Handle<v8::Function> -ExtensionsGuestViewContainer::Request::GetCallback() const { +v8::Local<v8::Function> ExtensionsGuestViewContainer::Request::GetCallback() + const { return v8::Local<v8::Function>::New(isolate_, callback_); } void ExtensionsGuestViewContainer::Request::ExecuteCallbackIfAvailable( - int argc, scoped_ptr<v8::Handle<v8::Value>[]> argv) { + int argc, + scoped_ptr<v8::Local<v8::Value>[]> argv) { if (!HasCallback()) return; v8::HandleScope handle_scope(isolate()); - v8::Handle<v8::Function> callback = GetCallback(); - v8::Handle<v8::Context> context = callback->CreationContext(); + v8::Local<v8::Function> callback = GetCallback(); + v8::Local<v8::Context> context = callback->CreationContext(); if (context.IsEmpty()) return; @@ -63,7 +63,7 @@ ExtensionsGuestViewContainer::AttachRequest::AttachRequest( GuestViewContainer* container, int guest_instance_id, scoped_ptr<base::DictionaryValue> params, - v8::Handle<v8::Function> callback, + v8::Local<v8::Function> callback, v8::Isolate* isolate) : Request(container, callback, isolate), guest_instance_id_(guest_instance_id), @@ -104,7 +104,7 @@ void ExtensionsGuestViewContainer::AttachRequest::HandleResponse( v8::Local<v8::Value> window = frame->mainWorldScriptContext()->Global(); const int argc = 1; - scoped_ptr<v8::Handle<v8::Value>[]> argv(new v8::Handle<v8::Value>[argc]); + scoped_ptr<v8::Local<v8::Value>[]> argv(new v8::Local<v8::Value>[argc]); argv[0] = window; ExecuteCallbackIfAvailable(argc, argv.Pass()); @@ -112,7 +112,7 @@ void ExtensionsGuestViewContainer::AttachRequest::HandleResponse( ExtensionsGuestViewContainer::DetachRequest::DetachRequest( GuestViewContainer* container, - v8::Handle<v8::Function> callback, + v8::Local<v8::Function> callback, v8::Isolate* isolate) : Request(container, callback, isolate) { } @@ -158,10 +158,9 @@ ExtensionsGuestViewContainer::~ExtensionsGuestViewContainer() { // Call the destruction callback, if one is registered. if (!destruction_callback_.IsEmpty()) { v8::HandleScope handle_scope(destruction_isolate_); - v8::Handle<v8::Function> callback = - v8::Local<v8::Function>::New(destruction_isolate_, - destruction_callback_); - v8::Handle<v8::Context> context = callback->CreationContext(); + v8::Local<v8::Function> callback = v8::Local<v8::Function>::New( + destruction_isolate_, destruction_callback_); + v8::Local<v8::Context> context = callback->CreationContext(); if (context.IsEmpty()) return; @@ -186,14 +185,14 @@ void ExtensionsGuestViewContainer::IssueRequest(linked_ptr<Request> request) { } void ExtensionsGuestViewContainer::RegisterDestructionCallback( - v8::Handle<v8::Function> callback, + v8::Local<v8::Function> callback, v8::Isolate* isolate) { destruction_callback_.Reset(isolate, callback); destruction_isolate_ = isolate; } void ExtensionsGuestViewContainer::RegisterElementResizeCallback( - v8::Handle<v8::Function> callback, + v8::Local<v8::Function> callback, v8::Isolate* isolate) { element_resize_callback_.Reset(isolate, callback); element_resize_isolate_ = isolate; @@ -245,18 +244,18 @@ void ExtensionsGuestViewContainer::CallElementResizeCallback( const gfx::Size& old_size, const gfx::Size& new_size) { v8::HandleScope handle_scope(element_resize_isolate_); - v8::Handle<v8::Function> callback = v8::Local<v8::Function>::New( + v8::Local<v8::Function> callback = v8::Local<v8::Function>::New( element_resize_isolate_, element_resize_callback_); - v8::Handle<v8::Context> context = callback->CreationContext(); + v8::Local<v8::Context> context = callback->CreationContext(); if (context.IsEmpty()) return; const int argc = 4; - v8::Handle<v8::Value> argv[argc] = { - v8::Integer::New(element_resize_isolate_, old_size.width()), - v8::Integer::New(element_resize_isolate_, old_size.height()), - v8::Integer::New(element_resize_isolate_, new_size.width()), - v8::Integer::New(element_resize_isolate_, new_size.height())}; + v8::Local<v8::Value> argv[argc] = { + v8::Integer::New(element_resize_isolate_, old_size.width()), + v8::Integer::New(element_resize_isolate_, old_size.height()), + v8::Integer::New(element_resize_isolate_, new_size.width()), + v8::Integer::New(element_resize_isolate_, new_size.height())}; v8::Context::Scope context_scope(context); blink::WebScopedMicrotaskSuppression suppression; diff --git a/extensions/renderer/guest_view/extensions_guest_view_container.h b/extensions/renderer/guest_view/extensions_guest_view_container.h index 75e2169..f1a6622 100644 --- a/extensions/renderer/guest_view/extensions_guest_view_container.h +++ b/extensions/renderer/guest_view/extensions_guest_view_container.h @@ -25,7 +25,7 @@ class ExtensionsGuestViewContainer : public GuestViewContainer { class Request { public: Request(GuestViewContainer* container, - v8::Handle<v8::Function> callback, + v8::Local<v8::Function> callback, v8::Isolate* isolate); virtual ~Request(); @@ -33,13 +33,13 @@ class ExtensionsGuestViewContainer : public GuestViewContainer { virtual void HandleResponse(const IPC::Message& message) = 0; void ExecuteCallbackIfAvailable(int argc, - scoped_ptr<v8::Handle<v8::Value>[]> argv); + scoped_ptr<v8::Local<v8::Value>[]> argv); GuestViewContainer* container() const { return container_; } bool HasCallback() const; - v8::Handle<v8::Function> GetCallback() const; + v8::Local<v8::Function> GetCallback() const; v8::Isolate* isolate() const { return isolate_; } @@ -58,7 +58,7 @@ class ExtensionsGuestViewContainer : public GuestViewContainer { AttachRequest(GuestViewContainer* container, int guest_instance_id, scoped_ptr<base::DictionaryValue> params, - v8::Handle<v8::Function> callback, + v8::Local<v8::Function> callback, v8::Isolate* isolate); ~AttachRequest() override; @@ -73,7 +73,7 @@ class ExtensionsGuestViewContainer : public GuestViewContainer { class DetachRequest : public Request { public: DetachRequest(GuestViewContainer* container, - v8::Handle<v8::Function> callback, + v8::Local<v8::Function> callback, v8::Isolate* isolate); ~DetachRequest() override; @@ -87,9 +87,9 @@ class ExtensionsGuestViewContainer : public GuestViewContainer { static ExtensionsGuestViewContainer* FromID(int element_instance_id); void IssueRequest(linked_ptr<Request> request); - void RegisterDestructionCallback(v8::Handle<v8::Function> callback, + void RegisterDestructionCallback(v8::Local<v8::Function> callback, v8::Isolate* isolate); - void RegisterElementResizeCallback(v8::Handle<v8::Function> callback, + void RegisterElementResizeCallback(v8::Local<v8::Function> callback, v8::Isolate* isolate); // BrowserPluginDelegate implementation. diff --git a/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc b/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc index 8bc2a2e..2310d3d 100644 --- a/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc +++ b/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc @@ -91,11 +91,9 @@ void GuestViewInternalCustomBindings::AttachGuest( linked_ptr<ExtensionsGuestViewContainer::Request> request( new ExtensionsGuestViewContainer::AttachRequest( - guest_view_container, - guest_instance_id, - params.Pass(), - args.Length() == 4 ? args[3].As<v8::Function>() : - v8::Handle<v8::Function>(), + guest_view_container, guest_instance_id, params.Pass(), + args.Length() == 4 ? args[3].As<v8::Function>() + : v8::Local<v8::Function>(), args.GetIsolate())); guest_view_container->IssueRequest(request); @@ -123,9 +121,8 @@ void GuestViewInternalCustomBindings::DetachGuest( linked_ptr<ExtensionsGuestViewContainer::Request> request( new ExtensionsGuestViewContainer::DetachRequest( - guest_view_container, - args.Length() == 2 ? args[1].As<v8::Function>() : - v8::Handle<v8::Function>(), + guest_view_container, args.Length() == 2 ? args[1].As<v8::Function>() + : v8::Local<v8::Function>(), args.GetIsolate())); guest_view_container->IssueRequest(request); @@ -209,8 +206,8 @@ void GuestViewInternalCustomBindings::RunWithGesture( blink::WebScopedUserGesture user_gesture; CHECK_EQ(args.Length(), 1); CHECK(args[0]->IsFunction()); - v8::Handle<v8::Value> no_args; - context()->CallFunction(v8::Handle<v8::Function>::Cast(args[0]), 0, &no_args); + v8::Local<v8::Value> no_args; + context()->CallFunction(v8::Local<v8::Function>::Cast(args[0]), 0, &no_args); } } // namespace extensions diff --git a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc index d71d6a2..c8b6afa 100644 --- a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc +++ b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc @@ -38,7 +38,7 @@ class ScriptableObject : public gin::Wrappable<ScriptableObject>, public: static gin::WrapperInfo kWrapperInfo; - static v8::Handle<v8::Object> Create( + static v8::Local<v8::Object> Create( v8::Isolate* isolate, base::WeakPtr<MimeHandlerViewContainer> container) { ScriptableObject* scriptable_object = @@ -209,7 +209,7 @@ void MimeHandlerViewContainer::didFinishLoading( } void MimeHandlerViewContainer::PostMessage(v8::Isolate* isolate, - v8::Handle<v8::Value> message) { + v8::Local<v8::Value> message) { if (!guest_loaded_) { linked_ptr<v8::Global<v8::Value>> global( new v8::Global<v8::Value>(isolate, message)); @@ -231,16 +231,15 @@ void MimeHandlerViewContainer::PostMessage(v8::Isolate* isolate, v8::Local<v8::Object> guest_proxy_window = guest_proxy_frame->mainWorldScriptContext()->Global(); gin::Dictionary window_object(isolate, guest_proxy_window); - v8::Handle<v8::Function> post_message; + v8::Local<v8::Function> post_message; if (!window_object.Get(std::string(kPostMessageName), &post_message)) return; - v8::Handle<v8::Value> args[] = { - message, - // Post the message to any domain inside the browser plugin. The embedder - // should already know what is embedded. - gin::StringToV8(isolate, "*") - }; + v8::Local<v8::Value> args[] = { + message, + // Post the message to any domain inside the browser plugin. The embedder + // should already know what is embedded. + gin::StringToV8(isolate, "*")}; guest_proxy_frame->callFunctionEvenIfScriptDisabled( post_message.As<v8::Function>(), guest_proxy_window, diff --git a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h index 329b58b..b08f1c9 100644 --- a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h +++ b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h @@ -68,8 +68,7 @@ class MimeHandlerViewContainer : public GuestViewContainer, void OnRenderFrameDestroyed() override; // Post a JavaScript message to the guest. - void PostMessage(v8::Isolate* isolate, - v8::Handle<v8::Value> message); + void PostMessage(v8::Isolate* isolate, v8::Local<v8::Value> message); // Post |message| to the guest. void PostMessageFromValue(const base::Value& message); |