| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 GPU_IPC_COMMAND_BUFFER_PROXY_H_ | 5 #ifndef GPU_IPC_COMMAND_BUFFER_PROXY_H_ |
| 6 #define GPU_IPC_COMMAND_BUFFER_PROXY_H_ | 6 #define GPU_IPC_COMMAND_BUFFER_PROXY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "gpu/command_buffer/common/command_buffer.h" | 11 #include "gpu/command_buffer/common/command_buffer.h" |
| 12 #include "gpu/command_buffer/common/command_buffer_shared.h" | 12 #include "gpu/command_buffer/common/command_buffer_shared.h" |
| 13 | 13 |
| 14 // TODO(fsamuel): this is a layering violation. http://crbug.com/157175 | |
| 15 namespace content { | |
| 16 struct GpuMemoryAllocationForRenderer; | |
| 17 } | |
| 18 | |
| 19 // Client side proxy that forwards messages synchronously to a | 14 // Client side proxy that forwards messages synchronously to a |
| 20 // CommandBufferStub. | 15 // CommandBufferStub. |
| 21 class GPU_EXPORT CommandBufferProxy : public gpu::CommandBuffer { | 16 class GPU_EXPORT CommandBufferProxy : public gpu::CommandBuffer { |
| 22 public: | 17 public: |
| 23 typedef base::Callback<void( | 18 typedef base::Callback<void( |
| 24 const std::string& msg, int id)> GpuConsoleMessageCallback; | 19 const std::string& msg, int id)> GpuConsoleMessageCallback; |
| 25 | 20 |
| 26 CommandBufferProxy() { } | 21 CommandBufferProxy() { } |
| 27 | 22 |
| 28 virtual ~CommandBufferProxy() { } | 23 virtual ~CommandBufferProxy() { } |
| 29 | 24 |
| 30 virtual int GetRouteID() const = 0; | 25 virtual int GetRouteID() const = 0; |
| 31 | 26 |
| 32 // Invoke the task when the channel has been flushed. Takes care of deleting | 27 // Invoke the task when the channel has been flushed. Takes care of deleting |
| 33 // the task whether the echo succeeds or not. | 28 // the task whether the echo succeeds or not. |
| 34 virtual bool Echo(const base::Closure& callback) = 0; | 29 virtual bool Echo(const base::Closure& callback) = 0; |
| 35 | 30 |
| 36 // Sends an IPC message with the new state of surface visibility. | |
| 37 virtual bool SetSurfaceVisible(bool visible) = 0; | |
| 38 | |
| 39 virtual bool DiscardBackbuffer() = 0; | |
| 40 virtual bool EnsureBackbuffer() = 0; | |
| 41 | |
| 42 // Inserts a sync point, returning its ID. This is handled on the IO thread of | |
| 43 // the GPU process, and so should be relatively fast, but its effect is | |
| 44 // ordered wrt other messages (in particular, Flush). Sync point IDs are | |
| 45 // global and can be used for cross-channel synchronization. | |
| 46 virtual uint32 InsertSyncPoint() = 0; | |
| 47 | |
| 48 // Makes this command buffer wait on a sync point. This command buffer will be | |
| 49 // unscheduled until the command buffer that inserted that sync point reaches | |
| 50 // it, or gets destroyed. | |
| 51 virtual void WaitSyncPoint(uint32) = 0; | |
| 52 | |
| 53 // Makes this command buffer invoke a task when a sync point is reached, or | |
| 54 // the command buffer that inserted that sync point is destroyed. | |
| 55 virtual bool SignalSyncPoint(uint32 sync_point, | |
| 56 const base::Closure& callback) = 0; | |
| 57 | |
| 58 // Register a callback to invoke whenever we recieve a new memory allocation. | |
| 59 virtual void SetMemoryAllocationChangedCallback( | |
| 60 const base::Callback<void( | |
| 61 const content::GpuMemoryAllocationForRenderer&)>& callback) = 0; | |
| 62 | |
| 63 // Reparent a command buffer. TODO(apatrick): going forward, the notion of | 31 // Reparent a command buffer. TODO(apatrick): going forward, the notion of |
| 64 // the parent / child relationship between command buffers is going away in | 32 // the parent / child relationship between command buffers is going away in |
| 65 // favor of the notion of surfaces that can be drawn to in one command buffer | 33 // favor of the notion of surfaces that can be drawn to in one command buffer |
| 66 // and bound as a texture in any other. | 34 // and bound as a texture in any other. |
| 67 virtual bool SetParent(CommandBufferProxy* parent_command_buffer, | 35 virtual bool SetParent(CommandBufferProxy* parent_command_buffer, |
| 68 uint32 parent_texture_id) = 0; | 36 uint32 parent_texture_id) = 0; |
| 69 | 37 |
| 70 virtual void SetChannelErrorCallback(const base::Closure& callback) = 0; | 38 virtual void SetChannelErrorCallback(const base::Closure& callback) = 0; |
| 71 | 39 |
| 72 // Set a task that will be invoked the next time the window becomes invalid | |
| 73 // and needs to be repainted. Takes ownership of task. | |
| 74 virtual void SetNotifyRepaintTask(const base::Closure& callback) = 0; | |
| 75 | |
| 76 virtual void SetOnConsoleMessageCallback( | |
| 77 const GpuConsoleMessageCallback& callback) = 0; | |
| 78 | |
| 79 private: | 40 private: |
| 80 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); | 41 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); |
| 81 }; | 42 }; |
| 82 | 43 |
| 83 #endif // GPU_IPC_COMMAND_BUFFER_PROXY_H_ | 44 #endif // GPU_IPC_COMMAND_BUFFER_PROXY_H_ |
| OLD | NEW |