| 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 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 // IPC::Message::Sender implementation: | 52 // IPC::Message::Sender implementation: |
| 53 virtual bool Send(IPC::Message* msg); | 53 virtual bool Send(IPC::Message* msg); |
| 54 | 54 |
| 55 // Whether this command buffer can currently handle IPC messages. | 55 // Whether this command buffer can currently handle IPC messages. |
| 56 bool IsScheduled(); | 56 bool IsScheduled(); |
| 57 | 57 |
| 58 // Get the GLContext associated with this object. | 58 // Get the GLContext associated with this object. |
| 59 gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } | 59 gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } |
| 60 | 60 |
| 61 // Get the GpuChannel associated with this object. |
| 62 GpuChannel* channel() const { return channel_; } |
| 63 |
| 61 // Identifies the renderer process. | 64 // Identifies the renderer process. |
| 62 int32 renderer_id() const { return renderer_id_; } | 65 int32 renderer_id() const { return renderer_id_; } |
| 63 | 66 |
| 64 // Identifies a particular renderer belonging to the same renderer process. | 67 // Identifies a particular renderer belonging to the same renderer process. |
| 65 int32 render_view_id() const { return render_view_id_; } | 68 int32 render_view_id() const { return render_view_id_; } |
| 66 | 69 |
| 67 // Identifies the various GpuCommandBufferStubs in the GPU process belonging | 70 // Identifies the various GpuCommandBufferStubs in the GPU process belonging |
| 68 // to the same renderer process. | 71 // to the same renderer process. |
| 69 int32 route_id() const { return route_id_; } | 72 int32 route_id() const { return route_id_; } |
| 70 | 73 |
| 71 // Return the current token in the underlying command buffer, or 0 if not yet | 74 // Return the current token in the underlying command buffer, or 0 if not yet |
| 72 // initialized. | 75 // initialized. |
| 73 int32 token() const { | 76 int32 token() const { |
| 74 return command_buffer_.get() ? command_buffer_->GetState().token : 0; | 77 return command_buffer_.get() ? command_buffer_->GetState().token : 0; |
| 75 } | 78 } |
| 76 | 79 |
| 77 #if defined(OS_WIN) | 80 #if defined(OS_WIN) |
| 78 // Called only by the compositor window's window proc | 81 // Called only by the compositor window's window proc |
| 79 void OnCompositorWindowPainted(); | 82 void OnCompositorWindowPainted(); |
| 80 #endif // defined(OS_WIN) | 83 #endif // defined(OS_WIN) |
| 81 | 84 |
| 82 void ViewResized(); | 85 void ViewResized(); |
| 83 | 86 |
| 84 #if defined(TOUCH_UI) | 87 #if defined(OS_MACOSX) |
| 85 void AcceleratedSurfaceIOSurfaceSet(uint64 surface_id); | |
| 86 void AcceleratedSurfaceReleased(uint64 surface_id); | |
| 87 #endif // defined(TOUCH_UI) | |
| 88 | |
| 89 #if defined(OS_MACOSX) || defined(TOUCH_UI) | |
| 90 // Called only by the GpuChannel. | 88 // Called only by the GpuChannel. |
| 91 void AcceleratedSurfaceBuffersSwapped(uint64 swap_buffers_count); | 89 void AcceleratedSurfaceBuffersSwapped(uint64 swap_buffers_count); |
| 92 #endif // defined(OS_MACOSX) || defined(TOUCH_UI) | 90 #endif // defined(OS_MACOSX) |
| 93 | 91 |
| 94 // Register a callback to be Run() whenever the underlying scheduler receives | 92 // Register a callback to be Run() whenever the underlying scheduler receives |
| 95 // a set_token() call. The callback will be Run() with the just-set token as | 93 // a set_token() call. The callback will be Run() with the just-set token as |
| 96 // its only parameter. Multiple callbacks may be registered. | 94 // its only parameter. Multiple callbacks may be registered. |
| 97 void AddSetTokenCallback(const base::Callback<void(int32)>& callback); | 95 void AddSetTokenCallback(const base::Callback<void(int32)>& callback); |
| 98 | 96 |
| 99 private: | 97 private: |
| 98 // Cleans up and sends reply if OnInitialize failed. |
| 99 void OnInitializeFailed(IPC::Message* reply_message); |
| 100 |
| 100 // Message handlers: | 101 // Message handlers: |
| 101 void OnInitialize(base::SharedMemoryHandle ring_buffer, | 102 void OnInitialize(base::SharedMemoryHandle ring_buffer, |
| 102 int32 size, | 103 int32 size, |
| 103 IPC::Message* reply_message); | 104 IPC::Message* reply_message); |
| 104 void OnSetParent(int32 parent_route_id, | 105 void OnSetParent(int32 parent_route_id, |
| 105 uint32 parent_texture_id, | 106 uint32 parent_texture_id, |
| 106 IPC::Message* reply_message); | 107 IPC::Message* reply_message); |
| 107 void OnGetState(IPC::Message* reply_message); | 108 void OnGetState(IPC::Message* reply_message); |
| 108 void OnFlush(int32 put_offset, | 109 void OnFlush(int32 put_offset, |
| 109 int32 last_known_get, | 110 int32 last_known_get, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 124 | 125 |
| 125 void OnCreateVideoDecoder(const std::vector<uint32>& configs); | 126 void OnCreateVideoDecoder(const std::vector<uint32>& configs); |
| 126 void OnDestroyVideoDecoder(); | 127 void OnDestroyVideoDecoder(); |
| 127 | 128 |
| 128 void OnSwapBuffers(); | 129 void OnSwapBuffers(); |
| 129 void OnCommandProcessed(); | 130 void OnCommandProcessed(); |
| 130 void OnParseError(); | 131 void OnParseError(); |
| 131 | 132 |
| 132 #if defined(OS_MACOSX) | 133 #if defined(OS_MACOSX) |
| 133 void OnSetWindowSize(const gfx::Size& size); | 134 void OnSetWindowSize(const gfx::Size& size); |
| 135 void SwapBuffersCallback(); |
| 134 #endif // defined(OS_MACOSX) | 136 #endif // defined(OS_MACOSX) |
| 135 | 137 |
| 136 #if defined(OS_MACOSX) || defined(TOUCH_UI) | |
| 137 void SwapBuffersCallback(); | |
| 138 #endif // defined(TOUCH_UI) | |
| 139 | |
| 140 void ResizeCallback(gfx::Size size); | 138 void ResizeCallback(gfx::Size size); |
| 141 void ReportState(); | 139 void ReportState(); |
| 142 | 140 |
| 143 // Callback registered with GpuScheduler to receive set_token() notifications. | 141 // Callback registered with GpuScheduler to receive set_token() notifications. |
| 144 void OnSetToken(int32 token); | 142 void OnSetToken(int32 token); |
| 145 | 143 |
| 146 // The lifetime of objects of this class is managed by a GpuChannel. The | 144 // The lifetime of objects of this class is managed by a GpuChannel. The |
| 147 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they | 145 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they |
| 148 // are destroyed. So a raw pointer is safe. | 146 // are destroyed. So a raw pointer is safe. |
| 149 GpuChannel* channel_; | 147 GpuChannel* channel_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 176 | 174 |
| 177 // The video decoder associated with this stub, if any. | 175 // The video decoder associated with this stub, if any. |
| 178 scoped_ptr<GpuVideoDecodeAccelerator> video_decoder_; | 176 scoped_ptr<GpuVideoDecodeAccelerator> video_decoder_; |
| 179 | 177 |
| 180 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 178 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
| 181 }; | 179 }; |
| 182 | 180 |
| 183 #endif // defined(ENABLE_GPU) | 181 #endif // defined(ENABLE_GPU) |
| 184 | 182 |
| 185 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 183 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
| OLD | NEW |