| 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 CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "gpu/command_buffer/common/mailbox.h" | 13 #include "gpu/command_buffer/common/mailbox.h" |
| 14 #include "gpu/command_buffer/common/sync_token.h" |
| 14 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" | 15 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" |
| 15 #include "ppapi/shared_impl/resource.h" | 16 #include "ppapi/shared_impl/resource.h" |
| 16 | 17 |
| 17 namespace gpu { | 18 namespace gpu { |
| 18 struct Capabilities; | 19 struct Capabilities; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace content { | 22 namespace content { |
| 22 class CommandBufferProxyImpl; | 23 class CommandBufferProxyImpl; |
| 23 class GpuChannelHost; | 24 class GpuChannelHost; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 54 // Returns true if binding/unbinding is successful. | 55 // Returns true if binding/unbinding is successful. |
| 55 bool BindToInstance(bool bind); | 56 bool BindToInstance(bool bind); |
| 56 | 57 |
| 57 // Returns true if the backing texture is always opaque. | 58 // Returns true if the backing texture is always opaque. |
| 58 bool IsOpaque(); | 59 bool IsOpaque(); |
| 59 | 60 |
| 60 // Notifications about the view's progress painting. See PluginInstance. | 61 // Notifications about the view's progress painting. See PluginInstance. |
| 61 // These messages are used to send Flush callbacks to the plugin. | 62 // These messages are used to send Flush callbacks to the plugin. |
| 62 void ViewInitiatedPaint(); | 63 void ViewInitiatedPaint(); |
| 63 | 64 |
| 64 void GetBackingMailbox(gpu::Mailbox* mailbox, uint32_t* sync_point) { | 65 void GetBackingMailbox(gpu::Mailbox* mailbox, gpu::SyncToken* sync_token) { |
| 65 *mailbox = mailbox_; | 66 *mailbox = mailbox_; |
| 66 *sync_point = sync_point_; | 67 *sync_token = sync_token_; |
| 67 } | 68 } |
| 68 | 69 |
| 69 CommandBufferProxyImpl* GetCommandBufferProxy(); | 70 CommandBufferProxyImpl* GetCommandBufferProxy(); |
| 70 | 71 |
| 71 GpuChannelHost* channel() { return channel_.get(); } | 72 GpuChannelHost* channel() { return channel_.get(); } |
| 72 | 73 |
| 73 protected: | 74 protected: |
| 74 ~PPB_Graphics3D_Impl() override; | 75 ~PPB_Graphics3D_Impl() override; |
| 75 // ppapi::PPB_Graphics3D_Shared overrides. | 76 // ppapi::PPB_Graphics3D_Shared overrides. |
| 76 gpu::CommandBuffer* GetCommandBuffer() override; | 77 gpu::CommandBuffer* GetCommandBuffer() override; |
| 77 gpu::GpuControl* GetGpuControl() override; | 78 gpu::GpuControl* GetGpuControl() override; |
| 78 int32_t DoSwapBuffers() override; | 79 int32_t DoSwapBuffers(const gpu::SyncToken& sync_token) override; |
| 79 | 80 |
| 80 private: | 81 private: |
| 81 explicit PPB_Graphics3D_Impl(PP_Instance instance); | 82 explicit PPB_Graphics3D_Impl(PP_Instance instance); |
| 82 | 83 |
| 83 bool Init(PPB_Graphics3D_API* share_context, const int32_t* attrib_list); | 84 bool Init(PPB_Graphics3D_API* share_context, const int32_t* attrib_list); |
| 84 bool InitRaw(PPB_Graphics3D_API* share_context, | 85 bool InitRaw(PPB_Graphics3D_API* share_context, |
| 85 const int32_t* attrib_list, | 86 const int32_t* attrib_list, |
| 86 gpu::Capabilities* capabilities, | 87 gpu::Capabilities* capabilities, |
| 87 base::SharedMemoryHandle* shared_state_handle, | 88 base::SharedMemoryHandle* shared_state_handle, |
| 88 uint64_t* command_buffer_id); | 89 uint64_t* command_buffer_id); |
| 89 | 90 |
| 90 // Notifications received from the GPU process. | 91 // Notifications received from the GPU process. |
| 91 void OnSwapBuffers(); | 92 void OnSwapBuffers(); |
| 92 void OnContextLost(); | 93 void OnContextLost(); |
| 93 void OnConsoleMessage(const std::string& msg, int id); | 94 void OnConsoleMessage(const std::string& msg, int id); |
| 94 // Notifications sent to plugin. | 95 // Notifications sent to plugin. |
| 95 void SendContextLost(); | 96 void SendContextLost(); |
| 96 | 97 |
| 97 // True if context is bound to instance. | 98 // True if context is bound to instance. |
| 98 bool bound_to_instance_; | 99 bool bound_to_instance_; |
| 99 // True when waiting for compositor to commit our backing texture. | 100 // True when waiting for compositor to commit our backing texture. |
| 100 bool commit_pending_; | 101 bool commit_pending_; |
| 101 | 102 |
| 102 gpu::Mailbox mailbox_; | 103 gpu::Mailbox mailbox_; |
| 103 uint32_t sync_point_; | 104 gpu::SyncToken sync_token_; |
| 104 bool has_alpha_; | 105 bool has_alpha_; |
| 105 scoped_refptr<GpuChannelHost> channel_; | 106 scoped_refptr<GpuChannelHost> channel_; |
| 106 scoped_ptr<CommandBufferProxyImpl> command_buffer_; | 107 scoped_ptr<CommandBufferProxyImpl> command_buffer_; |
| 107 | 108 |
| 108 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; | 109 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; |
| 109 | 110 |
| 110 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); | 111 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); |
| 111 }; | 112 }; |
| 112 | 113 |
| 113 } // namespace content | 114 } // namespace content |
| 114 | 115 |
| 115 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ | 116 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ |
| OLD | NEW |