| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
| 6 #define CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 6 #define CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
| 10 | 10 |
| 11 #include <vector> | 11 #include <vector> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/process.h" | 15 #include "base/process.h" |
| 16 #include "base/task.h" |
| 16 #include "gpu/command_buffer/service/command_buffer_service.h" | 17 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 17 #include "gpu/command_buffer/service/gpu_scheduler.h" | 18 #include "gpu/command_buffer/service/gpu_scheduler.h" |
| 18 #include "ipc/ipc_channel.h" | 19 #include "ipc/ipc_channel.h" |
| 19 #include "ipc/ipc_message.h" | 20 #include "ipc/ipc_message.h" |
| 20 #include "ui/gfx/native_widget_types.h" | 21 #include "ui/gfx/native_widget_types.h" |
| 21 #include "ui/gfx/size.h" | 22 #include "ui/gfx/size.h" |
| 22 | 23 |
| 23 class GpuChannel; | 24 class GpuChannel; |
| 24 class GpuWatchdog; | 25 class GpuWatchdog; |
| 25 | 26 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // Called only by the GpuChannel. | 75 // Called only by the GpuChannel. |
| 75 void AcceleratedSurfaceBuffersSwapped(uint64 swap_buffers_count); | 76 void AcceleratedSurfaceBuffersSwapped(uint64 swap_buffers_count); |
| 76 #endif // defined(OS_MACOSX) | 77 #endif // defined(OS_MACOSX) |
| 77 | 78 |
| 78 private: | 79 private: |
| 79 // Message handlers: | 80 // Message handlers: |
| 80 void OnInitialize(base::SharedMemoryHandle ring_buffer, | 81 void OnInitialize(base::SharedMemoryHandle ring_buffer, |
| 81 int32 size, | 82 int32 size, |
| 82 bool* result); | 83 bool* result); |
| 83 void OnGetState(gpu::CommandBuffer::State* state); | 84 void OnGetState(gpu::CommandBuffer::State* state); |
| 84 void OnAsyncGetState(); | 85 void OnFlush(int32 put_offset, |
| 85 void OnFlush(int32 put_offset, gpu::CommandBuffer::State* state); | 86 int32 last_known_get, |
| 87 gpu::CommandBuffer::State* state); |
| 86 void OnAsyncFlush(int32 put_offset); | 88 void OnAsyncFlush(int32 put_offset); |
| 87 void OnCreateTransferBuffer(int32 size, int32 id_request, int32* id); | 89 void OnCreateTransferBuffer(int32 size, int32 id_request, int32* id); |
| 88 void OnRegisterTransferBuffer(base::SharedMemoryHandle transfer_buffer, | 90 void OnRegisterTransferBuffer(base::SharedMemoryHandle transfer_buffer, |
| 89 size_t size, | 91 size_t size, |
| 90 int32 id_request, | 92 int32 id_request, |
| 91 int32* id); | 93 int32* id); |
| 92 void OnDestroyTransferBuffer(int32 id); | 94 void OnDestroyTransferBuffer(int32 id); |
| 93 void OnGetTransferBuffer(int32 id, | 95 void OnGetTransferBuffer(int32 id, |
| 94 base::SharedMemoryHandle* transfer_buffer, | 96 base::SharedMemoryHandle* transfer_buffer, |
| 95 uint32* size); | 97 uint32* size); |
| 96 void OnResizeOffscreenFrameBuffer(const gfx::Size& size); | 98 void OnResizeOffscreenFrameBuffer(const gfx::Size& size); |
| 97 | 99 |
| 98 void OnSwapBuffers(); | 100 void OnSwapBuffers(); |
| 99 void OnCommandProcessed(); | 101 void OnCommandProcessed(); |
| 100 | 102 |
| 101 #if defined(OS_MACOSX) | 103 #if defined(OS_MACOSX) |
| 102 void OnSetWindowSize(const gfx::Size& size); | 104 void OnSetWindowSize(const gfx::Size& size); |
| 103 void SwapBuffersCallback(); | 105 void SwapBuffersCallback(); |
| 104 #endif // defined(OS_MACOSX) | 106 #endif // defined(OS_MACOSX) |
| 105 | 107 |
| 106 void ResizeCallback(gfx::Size size); | 108 void ResizeCallback(gfx::Size size); |
| 109 void ReportState(); |
| 107 | 110 |
| 108 // The lifetime of objects of this class is managed by a GpuChannel. The | 111 // The lifetime of objects of this class is managed by a GpuChannel. The |
| 109 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they | 112 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they |
| 110 // are destroyed. So a raw pointer is safe. | 113 // are destroyed. So a raw pointer is safe. |
| 111 GpuChannel* channel_; | 114 GpuChannel* channel_; |
| 112 | 115 |
| 113 gfx::PluginWindowHandle handle_; | 116 gfx::PluginWindowHandle handle_; |
| 114 base::WeakPtr<GpuCommandBufferStub> parent_; | 117 base::WeakPtr<GpuCommandBufferStub> parent_; |
| 115 gfx::Size initial_size_; | 118 gfx::Size initial_size_; |
| 116 gpu::gles2::DisallowedExtensions disallowed_extensions_; | 119 gpu::gles2::DisallowedExtensions disallowed_extensions_; |
| 117 std::string allowed_extensions_; | 120 std::string allowed_extensions_; |
| 118 std::vector<int32> requested_attribs_; | 121 std::vector<int32> requested_attribs_; |
| 119 uint32 parent_texture_id_; | 122 uint32 parent_texture_id_; |
| 120 int32 route_id_; | 123 int32 route_id_; |
| 121 | 124 |
| 122 // The following two fields are used on Mac OS X to identify the window | 125 // The following two fields are used on Mac OS X to identify the window |
| 123 // for the rendering results on the browser side. | 126 // for the rendering results on the browser side. |
| 124 int32 renderer_id_; | 127 int32 renderer_id_; |
| 125 int32 render_view_id_; | 128 int32 render_view_id_; |
| 126 | 129 |
| 127 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 130 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
| 128 scoped_ptr<gpu::GpuScheduler> scheduler_; | 131 scoped_ptr<gpu::GpuScheduler> scheduler_; |
| 129 GpuWatchdog* watchdog_; | 132 GpuWatchdog* watchdog_; |
| 133 ScopedRunnableMethodFactory<GpuCommandBufferStub> task_factory_; |
| 130 | 134 |
| 131 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 135 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
| 132 }; | 136 }; |
| 133 | 137 |
| 134 #endif // defined(ENABLE_GPU) | 138 #endif // defined(ENABLE_GPU) |
| 135 | 139 |
| 136 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 140 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
| OLD | NEW |