| 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 21 matching lines...) Expand all Loading... |
| 69 ~PPB_Graphics3D_Impl() override; | 73 ~PPB_Graphics3D_Impl() override; |
| 70 // ppapi::PPB_Graphics3D_Shared overrides. | 74 // ppapi::PPB_Graphics3D_Shared overrides. |
| 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) override; | 77 int32_t DoSwapBuffers(const gpu::SyncToken& sync_token) override; |
| 74 | 78 |
| 75 private: | 79 private: |
| 76 explicit PPB_Graphics3D_Impl(PP_Instance instance); | 80 explicit PPB_Graphics3D_Impl(PP_Instance instance); |
| 77 | 81 |
| 78 bool InitRaw(PPB_Graphics3D_API* share_context, | 82 bool InitRaw(PPB_Graphics3D_API* share_context, |
| 79 const int32_t* attrib_list, | 83 const gpu::gles2::ContextCreationAttribHelper& attrib_helper, |
| 80 gpu::Capabilities* capabilities, | 84 gpu::Capabilities* capabilities, |
| 81 base::SharedMemoryHandle* shared_state_handle, | 85 base::SharedMemoryHandle* shared_state_handle, |
| 82 gpu::CommandBufferId* command_buffer_id); | 86 gpu::CommandBufferId* command_buffer_id); |
| 83 | 87 |
| 84 // GpuControlClient implementation. | 88 // GpuControlClient implementation. |
| 85 void OnGpuControlLostContext() final; | 89 void OnGpuControlLostContext() final; |
| 86 void OnGpuControlLostContextMaybeReentrant() final; | 90 void OnGpuControlLostContextMaybeReentrant() final; |
| 87 void OnGpuControlErrorMessage(const char* msg, int id) final; | 91 void OnGpuControlErrorMessage(const char* msg, int id) final; |
| 88 | 92 |
| 89 // Other notifications from the GPU process. | 93 // Other notifications from the GPU process. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 114 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; | 118 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; |
| 115 | 119 |
| 116 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; | 120 base::WeakPtrFactory<PPB_Graphics3D_Impl> weak_ptr_factory_; |
| 117 | 121 |
| 118 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); | 122 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl); |
| 119 }; | 123 }; |
| 120 | 124 |
| 121 } // namespace content | 125 } // namespace content |
| 122 | 126 |
| 123 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ | 127 #endif // CONTENT_RENDERER_PEPPER_PPB_GRAPHICS_3D_IMPL_H_ |
| OLD | NEW |