OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 5 #ifndef CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
6 #define CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 6 #define CHROME_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 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 virtual bool Send(IPC::Message* msg); | 47 virtual bool Send(IPC::Message* msg); |
48 | 48 |
49 // Get the GLContext associated with this object. | 49 // Get the GLContext associated with this object. |
50 gpu::GPUProcessor* processor() const { return processor_.get(); } | 50 gpu::GPUProcessor* processor() const { return processor_.get(); } |
51 | 51 |
52 int32 route_id() const { return route_id_; } | 52 int32 route_id() const { return route_id_; } |
53 | 53 |
54 #if defined(OS_WIN) | 54 #if defined(OS_WIN) |
55 // Called only by the compositor window's window proc | 55 // Called only by the compositor window's window proc |
56 void OnCompositorWindowPainted(); | 56 void OnCompositorWindowPainted(); |
57 #endif | 57 #endif // defined(OS_WIN) |
58 | 58 |
59 #if defined(OS_MACOSX) | 59 #if defined(OS_MACOSX) |
60 // Called only by the GpuChannel. | 60 // Called only by the GpuChannel. |
61 void AcceleratedSurfaceBuffersSwapped(uint64 swap_buffers_count); | 61 void AcceleratedSurfaceBuffersSwapped(uint64 swap_buffers_count); |
62 #endif | 62 #endif // defined(OS_MACOSX) |
63 | 63 |
64 private: | 64 private: |
65 // Message handlers: | 65 // Message handlers: |
66 void OnInitialize(int32 size, base::SharedMemoryHandle* ring_buffer); | 66 void OnInitialize(int32 size, base::SharedMemoryHandle* ring_buffer); |
67 void OnGetState(gpu::CommandBuffer::State* state); | 67 void OnGetState(gpu::CommandBuffer::State* state); |
68 void OnAsyncGetState(); | 68 void OnAsyncGetState(); |
69 void OnFlush(int32 put_offset, gpu::CommandBuffer::State* state); | 69 void OnFlush(int32 put_offset, gpu::CommandBuffer::State* state); |
70 void OnAsyncFlush(int32 put_offset); | 70 void OnAsyncFlush(int32 put_offset); |
71 void OnCreateTransferBuffer(int32 size, int32* id); | 71 void OnCreateTransferBuffer(int32 size, int32* id); |
72 void OnDestroyTransferBuffer(int32 id); | 72 void OnDestroyTransferBuffer(int32 id); |
73 void OnGetTransferBuffer(int32 id, | 73 void OnGetTransferBuffer(int32 id, |
74 base::SharedMemoryHandle* transfer_buffer, | 74 base::SharedMemoryHandle* transfer_buffer, |
75 uint32* size); | 75 uint32* size); |
76 void OnResizeOffscreenFrameBuffer(const gfx::Size& size); | 76 void OnResizeOffscreenFrameBuffer(const gfx::Size& size); |
77 | 77 |
78 void OnSwapBuffers(); | 78 void OnSwapBuffers(); |
79 | 79 |
80 #if defined(OS_MACOSX) | 80 #if defined(OS_MACOSX) |
81 void OnSetWindowSize(const gfx::Size& size); | 81 void OnSetWindowSize(const gfx::Size& size); |
82 void SwapBuffersCallback(); | 82 void SwapBuffersCallback(); |
83 #elif defined(OS_WIN) | 83 #endif // defined(OS_MACOSX) |
| 84 |
| 85 #if defined(OS_WIN) |
84 bool CreateCompositorWindow(); | 86 bool CreateCompositorWindow(); |
85 HWND compositor_window_; | 87 #endif // defined(OS_WIN) |
86 #endif | |
87 | 88 |
88 void ResizeCallback(gfx::Size size); | 89 void ResizeCallback(gfx::Size size); |
89 | 90 |
90 // The lifetime of objects of this class is managed by a GpuChannel. The | 91 // The lifetime of objects of this class is managed by a GpuChannel. The |
91 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they | 92 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they |
92 // are destroyed. So a raw pointer is safe. | 93 // are destroyed. So a raw pointer is safe. |
93 GpuChannel* channel_; | 94 GpuChannel* channel_; |
94 | 95 |
95 gfx::PluginWindowHandle handle_; | 96 gfx::PluginWindowHandle handle_; |
96 base::WeakPtr<GpuCommandBufferStub> parent_; | 97 base::WeakPtr<GpuCommandBufferStub> parent_; |
97 gfx::Size initial_size_; | 98 gfx::Size initial_size_; |
98 std::string allowed_extensions_; | 99 std::string allowed_extensions_; |
99 std::vector<int32> requested_attribs_; | 100 std::vector<int32> requested_attribs_; |
100 uint32 parent_texture_id_; | 101 uint32 parent_texture_id_; |
101 int32 route_id_; | 102 int32 route_id_; |
102 | 103 |
| 104 #if defined(OS_WIN) |
| 105 HWND compositor_window_; |
| 106 #endif // defined(OS_WIN) |
| 107 |
103 // The following two fields are used on Mac OS X to identify the window | 108 // The following two fields are used on Mac OS X to identify the window |
104 // for the rendering results on the browser side. | 109 // for the rendering results on the browser side. |
105 int32 renderer_id_; | 110 int32 renderer_id_; |
106 int32 render_view_id_; | 111 int32 render_view_id_; |
107 | 112 |
108 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 113 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
109 scoped_ptr<gpu::GPUProcessor> processor_; | 114 scoped_ptr<gpu::GPUProcessor> processor_; |
110 | 115 |
111 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 116 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
112 }; | 117 }; |
113 | 118 |
114 #endif // ENABLE_GPU | 119 #endif // defined(ENABLE_GPU) |
115 | 120 |
116 #endif // CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 121 #endif // CHROME_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
OLD | NEW |