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