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

Unified Diff: content/renderer/pepper/pepper_plugin_instance_impl.h

Issue 459553003: Replace NPObject usage in ppapi with gin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/pepper/message_channel.cc ('k') | content/renderer/pepper/pepper_plugin_instance_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/pepper_plugin_instance_impl.h
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.h b/content/renderer/pepper/pepper_plugin_instance_impl.h
index 4b86e6e67c2eb6af8a76fbc077e6ba8be9674188..6ef11c2e3ed42d0ccfef2e3e632454320638394a 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.h
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.h
@@ -23,6 +23,7 @@
#include "content/public/renderer/pepper_plugin_instance.h"
#include "content/public/renderer/render_frame_observer.h"
#include "content/renderer/mouse_lock_dispatcher.h"
+#include "gin/handle.h"
#include "ppapi/c/dev/pp_cursor_type_dev.h"
#include "ppapi/c/dev/ppp_printing_dev.h"
#include "ppapi/c/dev/ppp_selection_dev.h"
@@ -131,7 +132,6 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
const GURL& plugin_url);
RenderFrameImpl* render_frame() const { return render_frame_; }
PluginModule* module() const { return module_.get(); }
- MessageChannel& message_channel() { return *message_channel_; }
blink::WebPluginContainer* container() const { return container_; }
@@ -143,6 +143,12 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
return *resource_creation_.get();
}
+ MessageChannel* message_channel() { return message_channel_; }
+ v8::Local<v8::Object> GetMessageChannelObject();
+ // Called when |message_channel_| is destroyed as it may be destroyed prior to
+ // the plugin being destroyed.
+ void MessageChannelDestroyed();
+
// Return the v8 context that the plugin is in.
v8::Local<v8::Context> GetContext();
@@ -189,7 +195,7 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
bool HandleDocumentLoad(const blink::WebURLResponse& response);
bool HandleInputEvent(const blink::WebInputEvent& event,
blink::WebCursorInfo* cursor_info);
- PP_Var GetInstanceObject();
+ PP_Var GetInstanceObject(v8::Isolate* isolate);
void ViewChanged(const gfx::Rect& position,
const gfx::Rect& clip,
const std::vector<gfx::Rect>& cut_outs_rects);
@@ -518,10 +524,6 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
// the given module.
bool IsValidInstanceOf(PluginModule* module);
- // Returns the plugin NPP identifier that this plugin will use to identify
- // itself when making NPObject scripting calls to WebBindings.
- struct _NPP* instanceNPP();
-
// cc::TextureLayerClient implementation.
virtual bool PrepareTextureMailbox(
cc::TextureMailbox* mailbox,
@@ -830,7 +832,11 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
// The MessageChannel used to implement bidirectional postMessage for the
// instance.
- scoped_ptr<MessageChannel> message_channel_;
+ v8::Persistent<v8::Object> message_channel_object_;
+
+ // A pointer to the MessageChannel underlying |message_channel_object_|. It is
+ // only valid as long as |message_channel_object_| is alive.
+ MessageChannel* message_channel_;
// Bitmap for crashed plugin. Lazily initialized, non-owning pointer.
SkBitmap* sad_plugin_;
@@ -880,10 +886,6 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
// The link currently under the cursor.
base::string16 link_under_cursor_;
- // Dummy NPP value used when calling in to WebBindings, to allow the bindings
- // to correctly track NPObjects belonging to this plugin instance.
- scoped_ptr<struct _NPP> npp_;
-
// We store the isolate at construction so that we can be sure to use the
// Isolate in which this Instance was created when interacting with v8.
v8::Isolate* isolate_;
« no previous file with comments | « content/renderer/pepper/message_channel.cc ('k') | content/renderer/pepper/pepper_plugin_instance_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698