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> |
| 9 |
| 10 #include "base/macros.h" |
8 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
9 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
10 #include "gpu/command_buffer/common/mailbox.h" | 13 #include "gpu/command_buffer/common/mailbox.h" |
11 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" | 14 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" |
12 #include "ppapi/shared_impl/resource.h" | 15 #include "ppapi/shared_impl/resource.h" |
13 | 16 |
14 namespace gpu { | 17 namespace gpu { |
15 struct Capabilities; | 18 struct Capabilities; |
16 } | 19 } |
17 | 20 |
(...skipping 10 matching lines...) Expand all Loading... |
28 PP_Instance instance, | 31 PP_Instance instance, |
29 PP_Resource share_context, | 32 PP_Resource share_context, |
30 const int32_t* attrib_list, | 33 const int32_t* attrib_list, |
31 gpu::Capabilities* capabilities, | 34 gpu::Capabilities* capabilities, |
32 base::SharedMemoryHandle* shared_state_handle, | 35 base::SharedMemoryHandle* shared_state_handle, |
33 uint64_t* command_buffer_id); | 36 uint64_t* command_buffer_id); |
34 | 37 |
35 // PPB_Graphics3D_API trusted implementation. | 38 // PPB_Graphics3D_API trusted implementation. |
36 PP_Bool SetGetBuffer(int32_t transfer_buffer_id) override; | 39 PP_Bool SetGetBuffer(int32_t transfer_buffer_id) override; |
37 scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size, | 40 scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size, |
38 int32* id) override; | 41 int32_t* id) override; |
39 PP_Bool DestroyTransferBuffer(int32_t id) override; | 42 PP_Bool DestroyTransferBuffer(int32_t id) override; |
40 PP_Bool Flush(int32_t put_offset) override; | 43 PP_Bool Flush(int32_t put_offset) override; |
41 gpu::CommandBuffer::State WaitForTokenInRange(int32_t start, | 44 gpu::CommandBuffer::State WaitForTokenInRange(int32_t start, |
42 int32_t end) override; | 45 int32_t end) override; |
43 gpu::CommandBuffer::State WaitForGetOffsetInRange(int32_t start, | 46 gpu::CommandBuffer::State WaitForGetOffsetInRange(int32_t start, |
44 int32_t end) override; | 47 int32_t end) override; |
45 uint32_t InsertSyncPoint() override; | 48 uint32_t InsertSyncPoint() override; |
46 uint32_t InsertFutureSyncPoint() override; | 49 uint32_t InsertFutureSyncPoint() override; |
47 void RetireSyncPoint(uint32_t) override; | 50 void RetireSyncPoint(uint32_t) override; |
48 | 51 |
49 // Binds/unbinds the graphics of this context with the associated instance. | 52 // Binds/unbinds the graphics of this context with the associated instance. |
50 // Returns true if binding/unbinding is successful. | 53 // Returns true if binding/unbinding is successful. |
51 bool BindToInstance(bool bind); | 54 bool BindToInstance(bool bind); |
52 | 55 |
53 // Returns true if the backing texture is always opaque. | 56 // Returns true if the backing texture is always opaque. |
54 bool IsOpaque(); | 57 bool IsOpaque(); |
55 | 58 |
56 // Notifications about the view's progress painting. See PluginInstance. | 59 // Notifications about the view's progress painting. See PluginInstance. |
57 // These messages are used to send Flush callbacks to the plugin. | 60 // These messages are used to send Flush callbacks to the plugin. |
58 void ViewInitiatedPaint(); | 61 void ViewInitiatedPaint(); |
59 | 62 |
60 void GetBackingMailbox(gpu::Mailbox* mailbox, uint32* sync_point) { | 63 void GetBackingMailbox(gpu::Mailbox* mailbox, uint32_t* sync_point) { |
61 *mailbox = mailbox_; | 64 *mailbox = mailbox_; |
62 *sync_point = sync_point_; | 65 *sync_point = sync_point_; |
63 } | 66 } |
64 | 67 |
65 CommandBufferProxyImpl* GetCommandBufferProxy(); | 68 CommandBufferProxyImpl* GetCommandBufferProxy(); |
66 | 69 |
67 GpuChannelHost* channel() { return channel_.get(); } | 70 GpuChannelHost* channel() { return channel_.get(); } |
68 | 71 |
69 protected: | 72 protected: |
70 ~PPB_Graphics3D_Impl() override; | 73 ~PPB_Graphics3D_Impl() override; |
71 // ppapi::PPB_Graphics3D_Shared overrides. | 74 // ppapi::PPB_Graphics3D_Shared overrides. |
72 gpu::CommandBuffer* GetCommandBuffer() override; | 75 gpu::CommandBuffer* GetCommandBuffer() override; |
73 gpu::GpuControl* GetGpuControl() override; | 76 gpu::GpuControl* GetGpuControl() override; |
74 int32 DoSwapBuffers() override; | 77 int32_t DoSwapBuffers() override; |
75 | 78 |
76 private: | 79 private: |
77 explicit PPB_Graphics3D_Impl(PP_Instance instance); | 80 explicit PPB_Graphics3D_Impl(PP_Instance instance); |
78 | 81 |
79 bool Init(PPB_Graphics3D_API* share_context, const int32_t* attrib_list); | 82 bool Init(PPB_Graphics3D_API* share_context, const int32_t* attrib_list); |
80 bool InitRaw(PPB_Graphics3D_API* share_context, | 83 bool InitRaw(PPB_Graphics3D_API* share_context, |
81 const int32_t* attrib_list, | 84 const int32_t* attrib_list, |
82 gpu::Capabilities* capabilities, | 85 gpu::Capabilities* capabilities, |
83 base::SharedMemoryHandle* shared_state_handle, | 86 base::SharedMemoryHandle* shared_state_handle, |
84 uint64_t* command_buffer_id); | 87 uint64_t* command_buffer_id); |
85 | 88 |
86 // Notifications received from the GPU process. | 89 // Notifications received from the GPU process. |
87 void OnSwapBuffers(); | 90 void OnSwapBuffers(); |
88 void OnContextLost(); | 91 void OnContextLost(); |
89 void OnConsoleMessage(const std::string& msg, int id); | 92 void OnConsoleMessage(const std::string& msg, int id); |
90 // Notifications sent to plugin. | 93 // Notifications sent to plugin. |
91 void SendContextLost(); | 94 void SendContextLost(); |
92 | 95 |
93 // True if context is bound to instance. | 96 // True if context is bound to instance. |
94 bool bound_to_instance_; | 97 bool bound_to_instance_; |
95 // True when waiting for compositor to commit our backing texture. | 98 // True when waiting for compositor to commit our backing texture. |
96 bool commit_pending_; | 99 bool commit_pending_; |
97 | 100 |
98 gpu::Mailbox mailbox_; | 101 gpu::Mailbox mailbox_; |
99 uint32 sync_point_; | 102 uint32_t sync_point_; |
100 bool has_alpha_; | 103 bool has_alpha_; |
101 scoped_refptr<GpuChannelHost> channel_; | 104 scoped_refptr<GpuChannelHost> channel_; |
102 scoped_ptr<CommandBufferProxyImpl> command_buffer_; | 105 scoped_ptr<CommandBufferProxyImpl> command_buffer_; |
103 | 106 |
104 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; | 107 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; |
105 | 108 |
106 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); | 109 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); |
107 }; | 110 }; |
108 | 111 |
109 } // namespace content | 112 } // namespace content |
110 | 113 |
111 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ | 114 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ |
OLD | NEW |