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 <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "gpu/command_buffer/client/gpu_control_client.h" | 15 #include "gpu/command_buffer/client/gpu_control_client.h" |
16 #include "gpu/command_buffer/common/command_buffer_id.h" | 16 #include "gpu/command_buffer/common/command_buffer_id.h" |
17 #include "gpu/command_buffer/common/mailbox.h" | 17 #include "gpu/command_buffer/common/mailbox.h" |
18 #include "gpu/command_buffer/common/sync_token.h" | 18 #include "gpu/command_buffer/common/sync_token.h" |
19 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" | 19 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" |
20 #include "ppapi/shared_impl/resource.h" | 20 #include "ppapi/shared_impl/resource.h" |
21 | 21 |
22 namespace gpu { | 22 namespace gpu { |
| 23 namespace gles2 { |
| 24 struct ContextCreationAttribHelper; |
| 25 } |
23 struct Capabilities; | 26 struct Capabilities; |
24 class CommandBufferProxyImpl; | 27 class CommandBufferProxyImpl; |
25 } | 28 } |
26 | 29 |
27 namespace content { | 30 namespace content { |
28 | 31 |
29 class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared, | 32 class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared, |
30 public gpu::GpuControlClient { | 33 public gpu::GpuControlClient { |
31 public: | 34 public: |
32 static PP_Resource CreateRaw(PP_Instance instance, | 35 static PP_Resource CreateRaw( |
33 PP_Resource share_context, | 36 PP_Instance instance, |
34 const int32_t* attrib_list, | 37 PP_Resource share_context, |
35 gpu::Capabilities* capabilities, | 38 const gpu::gles2::ContextCreationAttribHelper& attrib_helper, |
36 base::SharedMemoryHandle* shared_state_handle, | 39 gpu::Capabilities* capabilities, |
37 gpu::CommandBufferId* command_buffer_id); | 40 base::SharedMemoryHandle* shared_state_handle, |
| 41 gpu::CommandBufferId* command_buffer_id); |
38 | 42 |
39 // PPB_Graphics3D_API trusted implementation. | 43 // PPB_Graphics3D_API trusted implementation. |
40 PP_Bool SetGetBuffer(int32_t transfer_buffer_id) override; | 44 PP_Bool SetGetBuffer(int32_t transfer_buffer_id) override; |
41 scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size, | 45 scoped_refptr<gpu::Buffer> CreateTransferBuffer(uint32_t size, |
42 int32_t* id) override; | 46 int32_t* id) override; |
43 PP_Bool DestroyTransferBuffer(int32_t id) override; | 47 PP_Bool DestroyTransferBuffer(int32_t id) override; |
44 PP_Bool Flush(int32_t put_offset) override; | 48 PP_Bool Flush(int32_t put_offset) override; |
45 gpu::CommandBuffer::State WaitForTokenInRange(int32_t start, | 49 gpu::CommandBuffer::State WaitForTokenInRange(int32_t start, |
46 int32_t end) override; | 50 int32_t end) override; |
47 gpu::CommandBuffer::State WaitForGetOffsetInRange(int32_t start, | 51 gpu::CommandBuffer::State WaitForGetOffsetInRange(int32_t start, |
(...skipping 23 matching lines...) Expand all Loading... |
71 gpu::CommandBuffer* GetCommandBuffer() override; | 75 gpu::CommandBuffer* GetCommandBuffer() override; |
72 gpu::GpuControl* GetGpuControl() override; | 76 gpu::GpuControl* GetGpuControl() override; |
73 int32_t DoSwapBuffers(const gpu::SyncToken& sync_token, | 77 int32_t DoSwapBuffers(const gpu::SyncToken& sync_token, |
74 int32_t width, | 78 int32_t width, |
75 int32_t height) override; | 79 int32_t height) override; |
76 | 80 |
77 private: | 81 private: |
78 explicit PPB_Graphics3D_Impl(PP_Instance instance); | 82 explicit PPB_Graphics3D_Impl(PP_Instance instance); |
79 | 83 |
80 bool InitRaw(PPB_Graphics3D_API* share_context, | 84 bool InitRaw(PPB_Graphics3D_API* share_context, |
81 const int32_t* attrib_list, | 85 const gpu::gles2::ContextCreationAttribHelper& requested_attribs, |
82 gpu::Capabilities* capabilities, | 86 gpu::Capabilities* capabilities, |
83 base::SharedMemoryHandle* shared_state_handle, | 87 base::SharedMemoryHandle* shared_state_handle, |
84 gpu::CommandBufferId* command_buffer_id); | 88 gpu::CommandBufferId* command_buffer_id); |
85 | 89 |
86 // GpuControlClient implementation. | 90 // GpuControlClient implementation. |
87 void OnGpuControlLostContext() final; | 91 void OnGpuControlLostContext() final; |
88 void OnGpuControlLostContextMaybeReentrant() final; | 92 void OnGpuControlLostContextMaybeReentrant() final; |
89 void OnGpuControlErrorMessage(const char* msg, int id) final; | 93 void OnGpuControlErrorMessage(const char* msg, int id) final; |
90 | 94 |
91 // Other notifications from the GPU process. | 95 // Other notifications from the GPU process. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; | 127 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; |
124 | 128 |
125 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; | 129 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; |
126 | 130 |
127 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); | 131 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); |
128 }; | 132 }; |
129 | 133 |
130 } // namespace content | 134 } // namespace content |
131 | 135 |
132 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ | 136 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ |
OLD | NEW |