| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 // IPC::Channel::Listener implementation: | 48 // IPC::Channel::Listener implementation: |
| 49 virtual bool OnMessageReceived(const IPC::Message& message); | 49 virtual bool OnMessageReceived(const IPC::Message& message); |
| 50 | 50 |
| 51 // IPC::Message::Sender implementation: | 51 // IPC::Message::Sender implementation: |
| 52 virtual bool Send(IPC::Message* msg); | 52 virtual bool Send(IPC::Message* msg); |
| 53 | 53 |
| 54 // Get the GLContext associated with this object. | 54 // Get the GLContext associated with this object. |
| 55 gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } | 55 gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } |
| 56 | 56 |
| 57 // Get the GpuChannel associated with this object. |
| 58 GpuChannel* channel() const { return channel_; } |
| 59 |
| 57 // Identifies the renderer process. | 60 // Identifies the renderer process. |
| 58 int32 renderer_id() const { return renderer_id_; } | 61 int32 renderer_id() const { return renderer_id_; } |
| 59 | 62 |
| 60 // Identifies a particular renderer belonging to the same renderer process. | 63 // Identifies a particular renderer belonging to the same renderer process. |
| 61 int32 render_view_id() const { return render_view_id_; } | 64 int32 render_view_id() const { return render_view_id_; } |
| 62 | 65 |
| 63 // Identifies the various GpuCommandBufferStubs in the GPU process belonging | 66 // Identifies the various GpuCommandBufferStubs in the GPU process belonging |
| 64 // to the same renderer process. | 67 // to the same renderer process. |
| 65 int32 route_id() const { return route_id_; } | 68 int32 route_id() const { return route_id_; } |
| 66 | 69 |
| 67 // Return the current token in the underlying command buffer, or 0 if not yet | 70 // Return the current token in the underlying command buffer, or 0 if not yet |
| 68 // initialized. | 71 // initialized. |
| 69 int32 token() const { | 72 int32 token() const { |
| 70 return command_buffer_.get() ? command_buffer_->GetState().token : 0; | 73 return command_buffer_.get() ? command_buffer_->GetState().token : 0; |
| 71 } | 74 } |
| 72 | 75 |
| 73 #if defined(OS_WIN) | 76 #if defined(OS_WIN) |
| 74 // Called only by the compositor window's window proc | 77 // Called only by the compositor window's window proc |
| 75 void OnCompositorWindowPainted(); | 78 void OnCompositorWindowPainted(); |
| 76 #endif // defined(OS_WIN) | 79 #endif // defined(OS_WIN) |
| 77 | 80 |
| 78 void ViewResized(); | 81 void ViewResized(); |
| 79 | 82 |
| 80 #if defined(TOUCH_UI) | 83 #if defined(OS_MACOSX) |
| 81 void AcceleratedSurfaceIOSurfaceSet(uint64 surface_id); | |
| 82 void AcceleratedSurfaceReleased(uint64 surface_id); | |
| 83 #endif // defined(TOUCH_UI) | |
| 84 | |
| 85 #if defined(OS_MACOSX) || defined(TOUCH_UI) | |
| 86 // Called only by the GpuChannel. | 84 // Called only by the GpuChannel. |
| 87 void AcceleratedSurfaceBuffersSwapped(uint64 swap_buffers_count); | 85 void AcceleratedSurfaceBuffersSwapped(uint64 swap_buffers_count); |
| 88 #endif // defined(OS_MACOSX) || defined(TOUCH_UI) | 86 #endif // defined(OS_MACOSX) |
| 89 | 87 |
| 90 // Called when the command buffer was destroyed, and the stub should now | 88 // Called when the command buffer was destroyed, and the stub should now |
| 91 // unblock itself and handle pending messages. | 89 // unblock itself and handle pending messages. |
| 92 void CommandBufferWasDestroyed(); | 90 void CommandBufferWasDestroyed(); |
| 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 15 matching lines...) Expand all Loading... |
| 125 void OnDestroyVideoDecoder(); | 126 void OnDestroyVideoDecoder(); |
| 126 | 127 |
| 127 void OnSwapBuffers(); | 128 void OnSwapBuffers(); |
| 128 void OnCommandProcessed(); | 129 void OnCommandProcessed(); |
| 129 void HandleDeferredMessages(); | 130 void HandleDeferredMessages(); |
| 130 void OnScheduled(); | 131 void OnScheduled(); |
| 131 void OnParseError(); | 132 void OnParseError(); |
| 132 | 133 |
| 133 #if defined(OS_MACOSX) | 134 #if defined(OS_MACOSX) |
| 134 void OnSetWindowSize(const gfx::Size& size); | 135 void OnSetWindowSize(const gfx::Size& size); |
| 136 void SwapBuffersCallback(); |
| 135 #endif // defined(OS_MACOSX) | 137 #endif // defined(OS_MACOSX) |
| 136 | 138 |
| 137 #if defined(OS_MACOSX) || defined(TOUCH_UI) | |
| 138 void SwapBuffersCallback(); | |
| 139 #endif // defined(TOUCH_UI) | |
| 140 | |
| 141 void ResizeCallback(gfx::Size size); | 139 void ResizeCallback(gfx::Size size); |
| 142 void ReportState(); | 140 void ReportState(); |
| 143 | 141 |
| 144 // Callback registered with GpuScheduler to receive set_token() notifications. | 142 // Callback registered with GpuScheduler to receive set_token() notifications. |
| 145 void OnSetToken(int32 token); | 143 void OnSetToken(int32 token); |
| 146 | 144 |
| 147 // The lifetime of objects of this class is managed by a GpuChannel. The | 145 // The lifetime of objects of this class is managed by a GpuChannel. The |
| 148 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they | 146 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they |
| 149 // are destroyed. So a raw pointer is safe. | 147 // are destroyed. So a raw pointer is safe. |
| 150 GpuChannel* channel_; | 148 GpuChannel* channel_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 177 | 175 |
| 178 // The video decoder associated with this stub, if any. | 176 // The video decoder associated with this stub, if any. |
| 179 scoped_ptr<GpuVideoDecodeAccelerator> video_decoder_; | 177 scoped_ptr<GpuVideoDecodeAccelerator> video_decoder_; |
| 180 | 178 |
| 181 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 179 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
| 182 }; | 180 }; |
| 183 | 181 |
| 184 #endif // defined(ENABLE_GPU) | 182 #endif // defined(ENABLE_GPU) |
| 185 | 183 |
| 186 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 184 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
| OLD | NEW |