| OLD | NEW |
| (Empty) |
| 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 CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_ | |
| 6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #if defined(ENABLE_GPU) | |
| 10 | |
| 11 #include <string> | |
| 12 | |
| 13 #include "base/callback.h" | |
| 14 #include "base/memory/linked_ptr.h" | |
| 15 #include "base/memory/scoped_ptr.h" | |
| 16 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" | |
| 17 #include "gpu/command_buffer/common/command_buffer.h" | |
| 18 #include "gpu/command_buffer/common/command_buffer_shared.h" | |
| 19 | |
| 20 struct GpuMemoryAllocationForRenderer; | |
| 21 | |
| 22 // Client side proxy that forwards messages synchronously to a | |
| 23 // CommandBufferStub. | |
| 24 class CommandBufferProxy : public gpu::CommandBuffer { | |
| 25 public: | |
| 26 typedef base::Callback<void( | |
| 27 const std::string& msg, int id)> GpuConsoleMessageCallback; | |
| 28 | |
| 29 CommandBufferProxy() { } | |
| 30 | |
| 31 virtual ~CommandBufferProxy() { } | |
| 32 | |
| 33 virtual int GetRouteID() const = 0; | |
| 34 | |
| 35 // Invoke the task when the channel has been flushed. Takes care of deleting | |
| 36 // the task whether the echo succeeds or not. | |
| 37 virtual bool Echo(const base::Closure& callback) = 0; | |
| 38 | |
| 39 // Sends an IPC message with the new state of surface visibility. | |
| 40 virtual bool SetSurfaceVisible(bool visible) = 0; | |
| 41 | |
| 42 virtual bool DiscardBackbuffer() = 0; | |
| 43 virtual bool EnsureBackbuffer() = 0; | |
| 44 | |
| 45 // Register a callback to invoke whenever we recieve a new memory allocation. | |
| 46 virtual void SetMemoryAllocationChangedCallback( | |
| 47 const base::Callback<void(const GpuMemoryAllocationForRenderer&)>& | |
| 48 callback) = 0; | |
| 49 | |
| 50 // Reparent a command buffer. TODO(apatrick): going forward, the notion of | |
| 51 // the parent / child relationship between command buffers is going away in | |
| 52 // favor of the notion of surfaces that can be drawn to in one command buffer | |
| 53 // and bound as a texture in any other. | |
| 54 virtual bool SetParent(CommandBufferProxy* parent_command_buffer, | |
| 55 uint32 parent_texture_id) = 0; | |
| 56 | |
| 57 virtual void SetChannelErrorCallback(const base::Closure& callback) = 0; | |
| 58 | |
| 59 // Set a task that will be invoked the next time the window becomes invalid | |
| 60 // and needs to be repainted. Takes ownership of task. | |
| 61 virtual void SetNotifyRepaintTask(const base::Closure& callback) = 0; | |
| 62 | |
| 63 // Sends an IPC message to create a GpuVideoDecodeAccelerator. Creates and | |
| 64 // returns a pointer to a GpuVideoDecodeAcceleratorHost. | |
| 65 // Returns NULL on failure to create the GpuVideoDecodeAcceleratorHost. | |
| 66 // Note that the GpuVideoDecodeAccelerator may still fail to be created in | |
| 67 // the GPU process, even if this returns non-NULL. In this case the client is | |
| 68 // notified of an error later. | |
| 69 virtual scoped_refptr<GpuVideoDecodeAcceleratorHost> CreateVideoDecoder( | |
| 70 media::VideoCodecProfile profile, | |
| 71 media::VideoDecodeAccelerator::Client* client) = 0; | |
| 72 | |
| 73 virtual void SetOnConsoleMessageCallback( | |
| 74 const GpuConsoleMessageCallback& callback) = 0; | |
| 75 | |
| 76 private: | |
| 77 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy); | |
| 78 }; | |
| 79 | |
| 80 #endif // ENABLE_GPU | |
| 81 | |
| 82 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_ | |
| OLD | NEW |