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/command_buffer_id.h" | 13 #include "gpu/command_buffer/common/command_buffer_id.h" |
14 #include "gpu/command_buffer/common/mailbox.h" | 14 #include "gpu/command_buffer/common/mailbox.h" |
15 #include "gpu/command_buffer/common/sync_token.h" | 15 #include "gpu/command_buffer/common/sync_token.h" |
16 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" | 16 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" |
17 #include "ppapi/shared_impl/resource.h" | 17 #include "ppapi/shared_impl/resource.h" |
18 | 18 |
19 namespace gpu { | 19 namespace gpu { |
20 struct Capabilities; | 20 struct Capabilities; |
| 21 class CommandBufferProxyImpl; |
| 22 class GpuChannelHost; |
21 } | 23 } |
22 | 24 |
23 namespace content { | 25 namespace content { |
24 class CommandBufferProxyImpl; | |
25 class GpuChannelHost; | |
26 | 26 |
27 class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared { | 27 class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared { |
28 public: | 28 public: |
29 static PP_Resource CreateRaw(PP_Instance instance, | 29 static PP_Resource CreateRaw(PP_Instance instance, |
30 PP_Resource share_context, | 30 PP_Resource share_context, |
31 const int32_t* attrib_list, | 31 const int32_t* attrib_list, |
32 gpu::Capabilities* capabilities, | 32 gpu::Capabilities* capabilities, |
33 base::SharedMemoryHandle* shared_state_handle, | 33 base::SharedMemoryHandle* shared_state_handle, |
34 gpu::CommandBufferId* command_buffer_id); | 34 gpu::CommandBufferId* command_buffer_id); |
35 | 35 |
(...skipping 18 matching lines...) Expand all Loading... |
54 | 54 |
55 // Notifications about the view's progress painting. See PluginInstance. | 55 // Notifications about the view's progress painting. See PluginInstance. |
56 // These messages are used to send Flush callbacks to the plugin. | 56 // These messages are used to send Flush callbacks to the plugin. |
57 void ViewInitiatedPaint(); | 57 void ViewInitiatedPaint(); |
58 | 58 |
59 void GetBackingMailbox(gpu::Mailbox* mailbox, gpu::SyncToken* sync_token) { | 59 void GetBackingMailbox(gpu::Mailbox* mailbox, gpu::SyncToken* sync_token) { |
60 *mailbox = mailbox_; | 60 *mailbox = mailbox_; |
61 *sync_token = sync_token_; | 61 *sync_token = sync_token_; |
62 } | 62 } |
63 | 63 |
64 CommandBufferProxyImpl* GetCommandBufferProxy(); | 64 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); |
65 | 65 |
66 GpuChannelHost* channel() { return channel_.get(); } | 66 gpu::GpuChannelHost* channel() { return channel_.get(); } |
67 | 67 |
68 protected: | 68 protected: |
69 ~PPB_Graphics3D_Impl() override; | 69 ~PPB_Graphics3D_Impl() override; |
70 // ppapi::PPB_Graphics3D_Shared overrides. | 70 // ppapi::PPB_Graphics3D_Shared overrides. |
71 gpu::CommandBuffer* GetCommandBuffer() override; | 71 gpu::CommandBuffer* GetCommandBuffer() override; |
72 gpu::GpuControl* GetGpuControl() override; | 72 gpu::GpuControl* GetGpuControl() override; |
73 int32_t DoSwapBuffers(const gpu::SyncToken& sync_token) override; | 73 int32_t DoSwapBuffers(const gpu::SyncToken& sync_token) override; |
74 | 74 |
75 private: | 75 private: |
76 explicit PPB_Graphics3D_Impl(PP_Instance instance); | 76 explicit PPB_Graphics3D_Impl(PP_Instance instance); |
(...skipping 12 matching lines...) Expand all Loading... |
89 void SendContextLost(); | 89 void SendContextLost(); |
90 | 90 |
91 // True if context is bound to instance. | 91 // True if context is bound to instance. |
92 bool bound_to_instance_; | 92 bool bound_to_instance_; |
93 // True when waiting for compositor to commit our backing texture. | 93 // True when waiting for compositor to commit our backing texture. |
94 bool commit_pending_; | 94 bool commit_pending_; |
95 | 95 |
96 gpu::Mailbox mailbox_; | 96 gpu::Mailbox mailbox_; |
97 gpu::SyncToken sync_token_; | 97 gpu::SyncToken sync_token_; |
98 bool has_alpha_; | 98 bool has_alpha_; |
99 scoped_refptr<GpuChannelHost> channel_; | 99 scoped_refptr<gpu::GpuChannelHost> channel_; |
100 scoped_ptr<CommandBufferProxyImpl> command_buffer_; | 100 scoped_ptr<gpu::CommandBufferProxyImpl> command_buffer_; |
101 | 101 |
102 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; | 102 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; |
103 | 103 |
104 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); | 104 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); |
105 }; | 105 }; |
106 | 106 |
107 } // namespace content | 107 } // namespace content |
108 | 108 |
109 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ | 109 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ |
OLD | NEW |