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 3 // found in the LICENSE file. 4 5 #ifndef GPU_IPC_COMMAND_BUFFER_PROXY_H_ 6 #define GPU_IPC_COMMAND_BUFFER_PROXY_H_ 7 8 #include <string> 9 10 #include "base/callback.h" 11 #include "gpu/command_buffer/common/command_buffer.h" 12 #include "gpu/command_buffer/common/command_buffer_shared.h" 13 #include "gpu/command_buffer/common/mailbox.h" 14 15 // Client side proxy that forwards messages synchronously to a 16 // CommandBufferStub. 17 class GPU_EXPORT CommandBufferProxy : public gpu::CommandBuffer { 18 public: 19 typedef base::Callback<void( 20 const std::string& msg, int id)> GpuConsoleMessageCallback; 21 22 CommandBufferProxy() { } 23 24 virtual ~CommandBufferProxy() { } 25 26 virtual int GetRouteID() const = 0; 27 28 // Invoke the task when the channel has been flushed. Takes care of deleting 29 // the task whether the echo succeeds or not. 30 virtual bool Echo(const base::Closure& callback) = 0; 31 32 // For offscreen contexts, produces the front buffer into a newly created 33 // mailbox. 34 virtual bool ProduceFrontBuffer(const gpu::Mailbox& mailbox) = 0; 35 36 virtual void SetChannelErrorCallback(const base::Closure& callback) = 0; 37 38 private: 39 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); 40 }; 41 42 #endif // GPU_IPC_COMMAND_BUFFER_PROXY_H_ 43