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 "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "gpu/command_buffer/common/mailbox.h" | 10 #include "gpu/command_buffer/common/mailbox.h" |
11 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" | 11 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" |
12 #include "ppapi/shared_impl/resource.h" | 12 #include "ppapi/shared_impl/resource.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class CommandBufferProxyImpl; | 15 class CommandBufferProxyImpl; |
16 class GpuChannelHost; | 16 class GpuChannelHost; |
17 | 17 |
18 class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared { | 18 class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared { |
19 public: | 19 public: |
20 static PP_Resource Create(PP_Instance instance, | 20 static PP_Resource Create(PP_Instance instance, |
21 PP_Resource share_context, | 21 PP_Resource share_context, |
22 const int32_t* attrib_list); | 22 const int32_t* attrib_list); |
23 static PP_Resource CreateRaw( | 23 static PP_Resource CreateRaw( |
24 PP_Instance instance, | 24 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 base::SharedMemoryHandle* shared_state_handle); | 27 base::SharedMemoryHandle* shared_state_handle); |
28 | 28 |
29 // PPB_Graphics3D_API trusted implementation. | 29 // PPB_Graphics3D_API trusted implementation. |
30 virtual PP_Bool SetGetBuffer(int32_t transfer_buffer_id) OVERRIDE; | 30 virtual PP_Bool SetGetBuffer(int32_t transfer_buffer_id) override; |
31 virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size, | 31 virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size, |
32 int32* id) OVERRIDE; | 32 int32* id) override; |
33 virtual PP_Bool DestroyTransferBuffer(int32_t id) OVERRIDE; | 33 virtual PP_Bool DestroyTransferBuffer(int32_t id) override; |
34 virtual PP_Bool Flush(int32_t put_offset) OVERRIDE; | 34 virtual PP_Bool Flush(int32_t put_offset) override; |
35 virtual gpu::CommandBuffer::State WaitForTokenInRange(int32_t start, | 35 virtual gpu::CommandBuffer::State WaitForTokenInRange(int32_t start, |
36 int32_t end) OVERRIDE; | 36 int32_t end) override; |
37 virtual gpu::CommandBuffer::State WaitForGetOffsetInRange(int32_t start, | 37 virtual gpu::CommandBuffer::State WaitForGetOffsetInRange(int32_t start, |
38 int32_t end) | 38 int32_t end) |
39 OVERRIDE; | 39 override; |
40 virtual uint32_t InsertSyncPoint() OVERRIDE; | 40 virtual uint32_t InsertSyncPoint() override; |
41 virtual uint32_t InsertFutureSyncPoint() OVERRIDE; | 41 virtual uint32_t InsertFutureSyncPoint() override; |
42 virtual void RetireSyncPoint(uint32_t) OVERRIDE; | 42 virtual void RetireSyncPoint(uint32_t) override; |
43 | 43 |
44 // Binds/unbinds the graphics of this context with the associated instance. | 44 // Binds/unbinds the graphics of this context with the associated instance. |
45 // Returns true if binding/unbinding is successful. | 45 // Returns true if binding/unbinding is successful. |
46 bool BindToInstance(bool bind); | 46 bool BindToInstance(bool bind); |
47 | 47 |
48 // Returns true if the backing texture is always opaque. | 48 // Returns true if the backing texture is always opaque. |
49 bool IsOpaque(); | 49 bool IsOpaque(); |
50 | 50 |
51 // Notifications about the view's progress painting. See PluginInstance. | 51 // Notifications about the view's progress painting. See PluginInstance. |
52 // These messages are used to send Flush callbacks to the plugin. | 52 // These messages are used to send Flush callbacks to the plugin. |
53 void ViewInitiatedPaint(); | 53 void ViewInitiatedPaint(); |
54 void ViewFlushedPaint(); | 54 void ViewFlushedPaint(); |
55 | 55 |
56 void GetBackingMailbox(gpu::Mailbox* mailbox, uint32* sync_point) { | 56 void GetBackingMailbox(gpu::Mailbox* mailbox, uint32* sync_point) { |
57 *mailbox = mailbox_; | 57 *mailbox = mailbox_; |
58 *sync_point = sync_point_; | 58 *sync_point = sync_point_; |
59 } | 59 } |
60 | 60 |
61 int GetCommandBufferRouteId(); | 61 int GetCommandBufferRouteId(); |
62 | 62 |
63 GpuChannelHost* channel() { return channel_.get(); } | 63 GpuChannelHost* channel() { return channel_.get(); } |
64 | 64 |
65 protected: | 65 protected: |
66 virtual ~PPB_Graphics3D_Impl(); | 66 virtual ~PPB_Graphics3D_Impl(); |
67 // ppapi::PPB_Graphics3D_Shared overrides. | 67 // ppapi::PPB_Graphics3D_Shared overrides. |
68 virtual gpu::CommandBuffer* GetCommandBuffer() OVERRIDE; | 68 virtual gpu::CommandBuffer* GetCommandBuffer() override; |
69 virtual gpu::GpuControl* GetGpuControl() OVERRIDE; | 69 virtual gpu::GpuControl* GetGpuControl() override; |
70 virtual int32 DoSwapBuffers() OVERRIDE; | 70 virtual int32 DoSwapBuffers() override; |
71 | 71 |
72 private: | 72 private: |
73 explicit PPB_Graphics3D_Impl(PP_Instance instance); | 73 explicit PPB_Graphics3D_Impl(PP_Instance instance); |
74 | 74 |
75 bool Init(PPB_Graphics3D_API* share_context, const int32_t* attrib_list); | 75 bool Init(PPB_Graphics3D_API* share_context, const int32_t* attrib_list); |
76 bool InitRaw(PPB_Graphics3D_API* share_context, | 76 bool InitRaw(PPB_Graphics3D_API* share_context, |
77 const int32_t* attrib_list, | 77 const int32_t* attrib_list, |
78 base::SharedMemoryHandle* shared_state_handle); | 78 base::SharedMemoryHandle* shared_state_handle); |
79 | 79 |
80 // Notifications received from the GPU process. | 80 // Notifications received from the GPU process. |
(...skipping 15 matching lines...) Expand all Loading... |
96 CommandBufferProxyImpl* command_buffer_; | 96 CommandBufferProxyImpl* command_buffer_; |
97 | 97 |
98 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; | 98 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; |
99 | 99 |
100 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); | 100 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); |
101 }; | 101 }; |
102 | 102 |
103 } // namespace content | 103 } // namespace content |
104 | 104 |
105 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ | 105 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ |
OLD | NEW |