| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 class PPB_ImageData_Impl; | 104 class PPB_ImageData_Impl; |
| 105 class PPB_URLLoader_Impl; | 105 class PPB_URLLoader_Impl; |
| 106 | 106 |
| 107 // Represents one time a plugin appears on one web page. | 107 // Represents one time a plugin appears on one web page. |
| 108 // | 108 // |
| 109 // Note: to get from a PP_Instance to a PluginInstance*, use the | 109 // Note: to get from a PP_Instance to a PluginInstance*, use the |
| 110 // ResourceTracker. | 110 // ResourceTracker. |
| 111 class WEBKIT_PLUGINS_EXPORT PluginInstance : | 111 class WEBKIT_PLUGINS_EXPORT PluginInstance : |
| 112 public base::RefCounted<PluginInstance>, | 112 public base::RefCounted<PluginInstance>, |
| 113 public base::SupportsWeakPtr<PluginInstance>, | 113 public base::SupportsWeakPtr<PluginInstance>, |
| 114 public ::ppapi::PPB_Instance_Shared, | 114 public ::ppapi::PPB_Instance_Shared { |
| 115 public NON_EXPORTED_BASE(cc::TextureLayerClient) { | |
| 116 public: | 115 public: |
| 117 // Create and return a PluginInstance object which supports the most recent | 116 // Create and return a PluginInstance object which supports the most recent |
| 118 // version of PPP_Instance possible by querying the given get_plugin_interface | 117 // version of PPP_Instance possible by querying the given get_plugin_interface |
| 119 // function. If the plugin does not support any valid PPP_Instance interface, | 118 // function. If the plugin does not support any valid PPP_Instance interface, |
| 120 // returns NULL. | 119 // returns NULL. |
| 121 static PluginInstance* Create(PluginDelegate* delegate, | 120 static PluginInstance* Create(PluginDelegate* delegate, |
| 122 PluginModule* module, | 121 PluginModule* module, |
| 123 WebKit::WebPluginContainer* container, | 122 WebKit::WebPluginContainer* container, |
| 124 const GURL& plugin_url); | 123 const GURL& plugin_url); |
| 125 // Delete should be called by the WebPlugin before this destructor. | 124 // Delete should be called by the WebPlugin before this destructor. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // relative to the top-left of the plugin. This does nothing if the plugin | 159 // relative to the top-left of the plugin. This does nothing if the plugin |
| 161 // has not yet been positioned. You can supply an empty gfx::Rect() to | 160 // has not yet been positioned. You can supply an empty gfx::Rect() to |
| 162 // invalidate the entire plugin. | 161 // invalidate the entire plugin. |
| 163 void InvalidateRect(const gfx::Rect& rect); | 162 void InvalidateRect(const gfx::Rect& rect); |
| 164 | 163 |
| 165 // Schedules a scroll of the plugin. This uses optimized scrolling only for | 164 // Schedules a scroll of the plugin. This uses optimized scrolling only for |
| 166 // full-frame plugins, as otherwise there could be other elements on top. The | 165 // full-frame plugins, as otherwise there could be other elements on top. The |
| 167 // slow path can also be triggered if there is an overlapping frame. | 166 // slow path can also be triggered if there is an overlapping frame. |
| 168 void ScrollRect(int dx, int dy, const gfx::Rect& rect); | 167 void ScrollRect(int dx, int dy, const gfx::Rect& rect); |
| 169 | 168 |
| 170 // If the plugin instance is backed by a texture, return its texture ID in the | |
| 171 // compositor's namespace. Otherwise return 0. Returns 0 by default. | |
| 172 unsigned GetBackingTextureId(); | |
| 173 | |
| 174 // Commit the backing texture to the screen once the side effects some | 169 // Commit the backing texture to the screen once the side effects some |
| 175 // rendering up to an offscreen SwapBuffers are visible. | 170 // rendering up to an offscreen SwapBuffers are visible. |
| 176 void CommitBackingTexture(); | 171 void CommitBackingTexture(); |
| 177 | 172 |
| 178 // Called when the out-of-process plugin implementing this instance crashed. | 173 // Called when the out-of-process plugin implementing this instance crashed. |
| 179 void InstanceCrashed(); | 174 void InstanceCrashed(); |
| 180 | 175 |
| 181 // PPB_Instance and PPB_Instance_Private implementation. | 176 // PPB_Instance and PPB_Instance_Private implementation. |
| 182 const GURL& plugin_url() const { return plugin_url_; } | 177 const GURL& plugin_url() const { return plugin_url_; } |
| 183 bool full_frame() const { return full_frame_; } | 178 bool full_frame() const { return full_frame_; } |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 virtual void DecoderResetDone(PP_Instance instance, | 472 virtual void DecoderResetDone(PP_Instance instance, |
| 478 PP_DecryptorStreamType decoder_type, | 473 PP_DecryptorStreamType decoder_type, |
| 479 uint32_t request_id) OVERRIDE; | 474 uint32_t request_id) OVERRIDE; |
| 480 virtual void DeliverFrame(PP_Instance instance, | 475 virtual void DeliverFrame(PP_Instance instance, |
| 481 PP_Resource decrypted_frame, | 476 PP_Resource decrypted_frame, |
| 482 const PP_DecryptedFrameInfo* frame_info) OVERRIDE; | 477 const PP_DecryptedFrameInfo* frame_info) OVERRIDE; |
| 483 virtual void DeliverSamples(PP_Instance instance, | 478 virtual void DeliverSamples(PP_Instance instance, |
| 484 PP_Resource audio_frames, | 479 PP_Resource audio_frames, |
| 485 const PP_DecryptedBlockInfo* block_info) OVERRIDE; | 480 const PP_DecryptedBlockInfo* block_info) OVERRIDE; |
| 486 | 481 |
| 487 // TextureLayerClient implementation. | |
| 488 virtual unsigned PrepareTexture(cc::ResourceUpdateQueue* queue) OVERRIDE; | |
| 489 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE; | |
| 490 virtual bool PrepareTextureMailbox(cc::TextureMailbox* mailbox) OVERRIDE; | |
| 491 | |
| 492 // Reset this instance as proxied. Assigns the instance a new module, resets | 482 // Reset this instance as proxied. Assigns the instance a new module, resets |
| 493 // cached interfaces to point to the out-of-process proxy and re-sends | 483 // cached interfaces to point to the out-of-process proxy and re-sends |
| 494 // DidCreate, DidChangeView, and HandleDocumentLoad (if necessary). | 484 // DidCreate, DidChangeView, and HandleDocumentLoad (if necessary). |
| 495 // This should be used only when switching a trusted NaCl in-process instance | 485 // This should be used only when switching a trusted NaCl in-process instance |
| 496 // to an untrusted NaCl out-of-process instance. | 486 // to an untrusted NaCl out-of-process instance. |
| 497 PP_NaClResult ResetAsProxied(scoped_refptr<PluginModule> module); | 487 PP_NaClResult ResetAsProxied(scoped_refptr<PluginModule> module); |
| 498 | 488 |
| 499 // Checks whether this is a valid instance of the given module. After calling | 489 // Checks whether this is a valid instance of the given module. After calling |
| 500 // ResetAsProxied above, a NaCl plugin instance's module changes, so external | 490 // ResetAsProxied above, a NaCl plugin instance's module changes, so external |
| 501 // hosts won't recognize it as a valid instance of the original module. This | 491 // hosts won't recognize it as a valid instance of the original module. This |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 scoped_ptr<struct _NPP> npp_; | 834 scoped_ptr<struct _NPP> npp_; |
| 845 | 835 |
| 846 friend class PpapiPluginInstanceTest; | 836 friend class PpapiPluginInstanceTest; |
| 847 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 837 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
| 848 }; | 838 }; |
| 849 | 839 |
| 850 } // namespace ppapi | 840 } // namespace ppapi |
| 851 } // namespace webkit | 841 } // namespace webkit |
| 852 | 842 |
| 853 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 843 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
| OLD | NEW |