| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PPB_GRAPHICS_3D_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_callback_factory.h" | 8 #include "base/memory/scoped_callback_factory.h" |
| 9 #include "ppapi/shared_impl/graphics_3d_impl.h" | 9 #include "ppapi/shared_impl/graphics_3d_impl.h" |
| 10 #include "ppapi/shared_impl/resource.h" |
| 10 #include "webkit/plugins/ppapi/plugin_delegate.h" | 11 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 11 #include "webkit/plugins/ppapi/resource.h" | |
| 12 | 12 |
| 13 namespace webkit { | 13 namespace webkit { |
| 14 namespace ppapi { | 14 namespace ppapi { |
| 15 | 15 |
| 16 class PPB_Graphics3D_Impl : public Resource, | 16 class PPB_Graphics3D_Impl : public ::ppapi::Resource, |
| 17 public ::ppapi::Graphics3DImpl { | 17 public ::ppapi::Graphics3DImpl { |
| 18 public: | 18 public: |
| 19 virtual ~PPB_Graphics3D_Impl(); | 19 virtual ~PPB_Graphics3D_Impl(); |
| 20 | 20 |
| 21 static PP_Resource Create(PluginInstance* instance, | 21 static PP_Resource Create(PP_Instance instance, |
| 22 PP_Resource share_context, | 22 PP_Resource share_context, |
| 23 const int32_t* attrib_list); | 23 const int32_t* attrib_list); |
| 24 static PP_Resource CreateRaw(PluginInstance* instance, | 24 static PP_Resource CreateRaw(PP_Instance instance, |
| 25 PP_Resource share_context, | 25 PP_Resource share_context, |
| 26 const int32_t* attrib_list); | 26 const int32_t* attrib_list); |
| 27 | 27 |
| 28 // Resource override. | 28 // Resource override. |
| 29 virtual ::ppapi::thunk::PPB_Graphics3D_API* AsPPB_Graphics3D_API() OVERRIDE; | 29 virtual ::ppapi::thunk::PPB_Graphics3D_API* AsPPB_Graphics3D_API() OVERRIDE; |
| 30 | 30 |
| 31 // PPB_Graphics3D_API trusted implementation. | 31 // PPB_Graphics3D_API trusted implementation. |
| 32 virtual PP_Bool InitCommandBuffer(int32_t size) OVERRIDE; | 32 virtual PP_Bool InitCommandBuffer(int32_t size) OVERRIDE; |
| 33 virtual PP_Bool GetRingBuffer(int* shm_handle, | 33 virtual PP_Bool GetRingBuffer(int* shm_handle, |
| 34 uint32_t* shm_size) OVERRIDE; | 34 uint32_t* shm_size) OVERRIDE; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 56 // the plugin. | 56 // the plugin. |
| 57 void ViewInitiatedPaint(); | 57 void ViewInitiatedPaint(); |
| 58 void ViewFlushedPaint(); | 58 void ViewFlushedPaint(); |
| 59 | 59 |
| 60 protected: | 60 protected: |
| 61 // ppapi::Graphics3DImpl overrides. | 61 // ppapi::Graphics3DImpl overrides. |
| 62 virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE; | 62 virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE; |
| 63 virtual int32 DoSwapBuffers() OVERRIDE; | 63 virtual int32 DoSwapBuffers() OVERRIDE; |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 explicit PPB_Graphics3D_Impl(PluginInstance* instance); | 66 explicit PPB_Graphics3D_Impl(PP_Instance instance); |
| 67 | 67 |
| 68 bool Init(PP_Resource share_context, | 68 bool Init(PP_Resource share_context, |
| 69 const int32_t* attrib_list); | 69 const int32_t* attrib_list); |
| 70 bool InitRaw(PP_Resource share_context, | 70 bool InitRaw(PP_Resource share_context, |
| 71 const int32_t* attrib_list); | 71 const int32_t* attrib_list); |
| 72 | 72 |
| 73 // Notifications received from the GPU process. | 73 // Notifications received from the GPU process. |
| 74 void OnSwapBuffers(); | 74 void OnSwapBuffers(); |
| 75 void OnContextLost(); | 75 void OnContextLost(); |
| 76 // Notifications sent to plugin. | 76 // Notifications sent to plugin. |
| 77 void SendContextLost(); | 77 void SendContextLost(); |
| 78 | 78 |
| 79 // True if context is bound to instance. | 79 // True if context is bound to instance. |
| 80 bool bound_to_instance_; | 80 bool bound_to_instance_; |
| 81 // True when waiting for compositor to commit our backing texture. | 81 // True when waiting for compositor to commit our backing texture. |
| 82 bool commit_pending_; | 82 bool commit_pending_; |
| 83 // PluginDelegate's 3D Context. Responsible for providing the command buffer. | 83 // PluginDelegate's 3D Context. Responsible for providing the command buffer. |
| 84 scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_; | 84 scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_; |
| 85 base::ScopedCallbackFactory<PPB_Graphics3D_Impl> callback_factory_; | 85 base::ScopedCallbackFactory<PPB_Graphics3D_Impl> callback_factory_; |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); | 87 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace ppapi | 90 } // namespace ppapi |
| 91 } // namespace webkit | 91 } // namespace webkit |
| 92 | 92 |
| 93 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ | 93 #endif // WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_ |
| OLD | NEW |