diff options
author | kalman <kalman@chromium.org> | 2015-03-09 11:19:39 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-09 18:20:43 +0000 |
commit | 078a21994451a696f3cad1d26872adf590dfc651 (patch) | |
tree | c8d70b10281c25dd879220e7eca0a1e395b053cd /extensions/renderer/guest_view | |
parent | 1a64f1ce6246785c3b5c02fc6e36a9de4157d180 (diff) | |
download | chromium_src-078a21994451a696f3cad1d26872adf590dfc651.zip chromium_src-078a21994451a696f3cad1d26872adf590dfc651.tar.gz chromium_src-078a21994451a696f3cad1d26872adf590dfc651.tar.bz2 |
Replace extensions::ScopedPersistent with v8::UniquePersistent.
R=jochen@chromium.org
Review URL: https://codereview.chromium.org/983793003
Cr-Commit-Position: refs/heads/master@{#319688}
Diffstat (limited to 'extensions/renderer/guest_view')
4 files changed, 18 insertions, 21 deletions
diff --git a/extensions/renderer/guest_view/extensions_guest_view_container.cc b/extensions/renderer/guest_view/extensions_guest_view_container.cc index 5936ee8..fe9570c 100644 --- a/extensions/renderer/guest_view/extensions_guest_view_container.cc +++ b/extensions/renderer/guest_view/extensions_guest_view_container.cc @@ -25,9 +25,7 @@ ExtensionsGuestViewContainer::Request::Request( GuestViewContainer* container, v8::Handle<v8::Function> callback, v8::Isolate* isolate) - : container_(container), - callback_(callback), - isolate_(isolate) { + : container_(container), callback_(isolate, callback), isolate_(isolate) { } ExtensionsGuestViewContainer::Request::~Request() { @@ -39,7 +37,7 @@ bool ExtensionsGuestViewContainer::Request::HasCallback() const { v8::Handle<v8::Function> ExtensionsGuestViewContainer::Request::GetCallback() const { - return callback_.NewHandle(isolate_); + return v8::Local<v8::Function>::New(isolate_, callback_); } ExtensionsGuestViewContainer::AttachRequest::AttachRequest( @@ -161,7 +159,7 @@ ExtensionsGuestViewContainer::~ExtensionsGuestViewContainer() { return; v8::HandleScope handle_scope(destruction_isolate_); v8::Handle<v8::Function> callback = - destruction_callback_.NewHandle(destruction_isolate_); + v8::Local<v8::Function>::New(destruction_isolate_, destruction_callback_); v8::Handle<v8::Context> context = callback->CreationContext(); if (context.IsEmpty()) return; @@ -188,14 +186,14 @@ void ExtensionsGuestViewContainer::IssueRequest(linked_ptr<Request> request) { void ExtensionsGuestViewContainer::RegisterDestructionCallback( v8::Handle<v8::Function> callback, v8::Isolate* isolate) { - destruction_callback_.reset(callback); + destruction_callback_.Reset(isolate, callback); destruction_isolate_ = isolate; } void ExtensionsGuestViewContainer::RegisterElementResizeCallback( v8::Handle<v8::Function> callback, v8::Isolate* isolate) { - element_resize_callback_.reset(callback); + element_resize_callback_.Reset(isolate, callback); element_resize_isolate_ = isolate; } @@ -245,8 +243,8 @@ 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 = - element_resize_callback_.NewHandle(element_resize_isolate_); + v8::Handle<v8::Function> callback = v8::Local<v8::Function>::New( + element_resize_isolate_, element_resize_callback_); v8::Handle<v8::Context> context = callback->CreationContext(); if (context.IsEmpty()) return; diff --git a/extensions/renderer/guest_view/extensions_guest_view_container.h b/extensions/renderer/guest_view/extensions_guest_view_container.h index df257f1..cd03f63 100644 --- a/extensions/renderer/guest_view/extensions_guest_view_container.h +++ b/extensions/renderer/guest_view/extensions_guest_view_container.h @@ -11,7 +11,7 @@ #include "base/memory/scoped_ptr.h" #include "base/values.h" #include "extensions/renderer/guest_view/guest_view_container.h" -#include "extensions/renderer/scoped_persistent.h" +#include "v8/include/v8.h" namespace gfx { class Size; @@ -42,7 +42,7 @@ class ExtensionsGuestViewContainer : public GuestViewContainer { private: GuestViewContainer* container_; - ScopedPersistent<v8::Function> callback_; + v8::UniquePersistent<v8::Function> callback_; v8::Isolate* const isolate_; }; @@ -110,10 +110,10 @@ class ExtensionsGuestViewContainer : public GuestViewContainer { std::deque<linked_ptr<Request> > pending_requests_; linked_ptr<Request> pending_response_; - ScopedPersistent<v8::Function> destruction_callback_; + v8::UniquePersistent<v8::Function> destruction_callback_; v8::Isolate* destruction_isolate_; - ScopedPersistent<v8::Function> element_resize_callback_; + v8::UniquePersistent<v8::Function> element_resize_callback_; v8::Isolate* element_resize_isolate_; // Weak pointer factory used for calling the element resize callback. 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 b50d5ad..bc7758c 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 @@ -177,9 +177,9 @@ v8::Local<v8::Object> MimeHandlerViewContainer::V8ScriptableObject( if (scriptable_object_.IsEmpty()) { v8::Local<v8::Object> object = ScriptableObject::Create(isolate, weak_factory_.GetWeakPtr()); - scriptable_object_.reset(object); + scriptable_object_.Reset(isolate, object); } - return scriptable_object_.NewHandle(isolate); + return v8::Local<v8::Object>::New(isolate, scriptable_object_); } void MimeHandlerViewContainer::didReceiveData(blink::WebURLLoader* /* unused */, @@ -200,8 +200,8 @@ void MimeHandlerViewContainer::didFinishLoading( void MimeHandlerViewContainer::PostMessage(v8::Isolate* isolate, v8::Handle<v8::Value> message) { if (!guest_loaded_) { - linked_ptr<ScopedPersistent<v8::Value>> scoped_persistent( - new ScopedPersistent<v8::Value>(isolate, message)); + linked_ptr<v8::UniquePersistent<v8::Value>> scoped_persistent( + new v8::UniquePersistent<v8::Value>(isolate, message)); pending_messages_.push_back(scoped_persistent); return; } @@ -288,7 +288,7 @@ void MimeHandlerViewContainer::OnMimeHandlerViewGuestOnLoadCompleted( v8::HandleScope handle_scope(isolate); v8::Context::Scope context_scope(frame->mainWorldScriptContext()); for (const auto& pending_message : pending_messages_) - PostMessage(isolate, pending_message->NewHandle(isolate)); + PostMessage(isolate, v8::Local<v8::Value>::New(isolate, *pending_message)); pending_messages_.clear(); } 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 b7cee75..a58ee8a 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 @@ -11,7 +11,6 @@ #include "base/memory/linked_ptr.h" #include "base/memory/weak_ptr.h" #include "extensions/renderer/guest_view/guest_view_container.h" -#include "extensions/renderer/scoped_persistent.h" #include "third_party/WebKit/public/platform/WebURLLoader.h" #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" #include "ui/gfx/geometry/size.h" @@ -104,12 +103,12 @@ class MimeHandlerViewContainer : public GuestViewContainer, scoped_ptr<blink::WebURLLoader> loader_; // The scriptable object that backs the plugin. - ScopedPersistent<v8::Object> scriptable_object_; + v8::UniquePersistent<v8::Object> scriptable_object_; // Pending postMessage messages that need to be sent to the guest. These are // queued while the guest is loading and once it is fully loaded they are // delivered so that messages aren't lost. - std::vector<linked_ptr<ScopedPersistent<v8::Value>>> pending_messages_; + std::vector<linked_ptr<v8::UniquePersistent<v8::Value>>> pending_messages_; // True if the guest page has fully loaded and its JavaScript onload function // has been called. |