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 } | 21 } |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 class CommandBufferProxyImpl; | 24 class CommandBufferProxyImpl; |
25 class GpuChannelHost; | 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 Create(PP_Instance instance, | |
30 PP_Resource share_context, | |
31 const int32_t* attrib_list); | |
32 static PP_Resource CreateRaw(PP_Instance instance, | 29 static PP_Resource CreateRaw(PP_Instance instance, |
33 PP_Resource share_context, | 30 PP_Resource share_context, |
34 const int32_t* attrib_list, | 31 const int32_t* attrib_list, |
35 gpu::Capabilities* capabilities, | 32 gpu::Capabilities* capabilities, |
36 base::SharedMemoryHandle* shared_state_handle, | 33 base::SharedMemoryHandle* shared_state_handle, |
37 gpu::CommandBufferId* command_buffer_id); | 34 gpu::CommandBufferId* command_buffer_id); |
38 | 35 |
39 // PPB_Graphics3D_API trusted implementation. | 36 // PPB_Graphics3D_API trusted implementation. |
40 PP_Bool SetGetBuffer(int32_t transfer_buffer_id) override; | 37 PP_Bool SetGetBuffer(int32_t transfer_buffer_id) override; |
41 scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size, | 38 scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size, |
(...skipping 29 matching lines...) Expand all Loading... |
71 protected: | 68 protected: |
72 ~PPB_Graphics3D_Impl() override; | 69 ~PPB_Graphics3D_Impl() override; |
73 // ppapi::PPB_Graphics3D_Shared overrides. | 70 // ppapi::PPB_Graphics3D_Shared overrides. |
74 gpu::CommandBuffer* GetCommandBuffer() override; | 71 gpu::CommandBuffer* GetCommandBuffer() override; |
75 gpu::GpuControl* GetGpuControl() override; | 72 gpu::GpuControl* GetGpuControl() override; |
76 int32_t DoSwapBuffers(const gpu::SyncToken& sync_token) override; | 73 int32_t DoSwapBuffers(const gpu::SyncToken& sync_token) override; |
77 | 74 |
78 private: | 75 private: |
79 explicit PPB_Graphics3D_Impl(PP_Instance instance); | 76 explicit PPB_Graphics3D_Impl(PP_Instance instance); |
80 | 77 |
81 bool Init(PPB_Graphics3D_API* share_context, const int32_t* attrib_list); | |
82 bool InitRaw(PPB_Graphics3D_API* share_context, | 78 bool InitRaw(PPB_Graphics3D_API* share_context, |
83 const int32_t* attrib_list, | 79 const int32_t* attrib_list, |
84 gpu::Capabilities* capabilities, | 80 gpu::Capabilities* capabilities, |
85 base::SharedMemoryHandle* shared_state_handle, | 81 base::SharedMemoryHandle* shared_state_handle, |
86 gpu::CommandBufferId* command_buffer_id); | 82 gpu::CommandBufferId* command_buffer_id); |
87 | 83 |
88 // Notifications received from the GPU process. | 84 // Notifications received from the GPU process. |
89 void OnSwapBuffers(); | 85 void OnSwapBuffers(); |
90 void OnContextLost(); | 86 void OnContextLost(); |
91 void OnConsoleMessage(const std::string& msg, int id); | 87 void OnConsoleMessage(const std::string& msg, int id); |
(...skipping 12 matching lines...) Expand all Loading... |
104 scoped_ptr<CommandBufferProxyImpl> command_buffer_; | 100 scoped_ptr<CommandBufferProxyImpl> command_buffer_; |
105 | 101 |
106 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; | 102 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; |
107 | 103 |
108 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); | 104 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); |
109 }; | 105 }; |
110 | 106 |
111 } // namespace content | 107 } // namespace content |
112 | 108 |
113 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ | 109 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ |
OLD | NEW |