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 CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <queue> | 12 #include <queue> |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "gpu/ipc/command_buffer_proxy.h" | 15 #include "gpu/ipc/command_buffer_proxy.h" |
16 | 16 |
17 #include "base/callback.h" | 17 #include "base/callback.h" |
18 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
19 #include "base/hash_tables.h" | 19 #include "base/hash_tables.h" |
20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
21 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
22 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" | 22 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" |
23 #include "gpu/command_buffer/common/command_buffer.h" | 23 #include "gpu/command_buffer/common/command_buffer.h" |
24 #include "gpu/command_buffer/common/command_buffer_shared.h" | 24 #include "gpu/command_buffer/common/command_buffer_shared.h" |
25 #include "ipc/ipc_channel.h" | 25 #include "ipc/ipc_listener.h" |
26 #include "ipc/ipc_message.h" | |
27 | 26 |
28 class GpuChannelHost; | 27 class GpuChannelHost; |
29 struct GPUCommandBufferConsoleMessage; | 28 struct GPUCommandBufferConsoleMessage; |
30 struct GpuMemoryAllocationForRenderer; | 29 struct GpuMemoryAllocationForRenderer; |
31 | 30 |
32 namespace base { | 31 namespace base { |
33 class SharedMemory; | 32 class SharedMemory; |
34 } | 33 } |
35 | 34 |
36 // Client side proxy that forwards messages synchronously to a | 35 // Client side proxy that forwards messages synchronously to a |
37 // CommandBufferStub. | 36 // CommandBufferStub. |
38 class CommandBufferProxyImpl | 37 class CommandBufferProxyImpl |
39 : public CommandBufferProxy, | 38 : public CommandBufferProxy, |
40 public IPC::Channel::Listener, | 39 public IPC::Listener, |
41 public base::SupportsWeakPtr<CommandBufferProxyImpl> { | 40 public base::SupportsWeakPtr<CommandBufferProxyImpl> { |
42 public: | 41 public: |
43 typedef base::Callback<void( | 42 typedef base::Callback<void( |
44 const std::string& msg, int id)> GpuConsoleMessageCallback; | 43 const std::string& msg, int id)> GpuConsoleMessageCallback; |
45 | 44 |
46 CommandBufferProxyImpl(GpuChannelHost* channel, int route_id); | 45 CommandBufferProxyImpl(GpuChannelHost* channel, int route_id); |
47 virtual ~CommandBufferProxyImpl(); | 46 virtual ~CommandBufferProxyImpl(); |
48 | 47 |
49 // Sends an IPC message to create a GpuVideoDecodeAccelerator. Creates and | 48 // Sends an IPC message to create a GpuVideoDecodeAccelerator. Creates and |
50 // returns a pointer to a GpuVideoDecodeAcceleratorHost. | 49 // returns a pointer to a GpuVideoDecodeAcceleratorHost. |
51 // Returns NULL on failure to create the GpuVideoDecodeAcceleratorHost. | 50 // Returns NULL on failure to create the GpuVideoDecodeAcceleratorHost. |
52 // Note that the GpuVideoDecodeAccelerator may still fail to be created in | 51 // Note that the GpuVideoDecodeAccelerator may still fail to be created in |
53 // the GPU process, even if this returns non-NULL. In this case the client is | 52 // the GPU process, even if this returns non-NULL. In this case the client is |
54 // notified of an error later. | 53 // notified of an error later. |
55 scoped_refptr<GpuVideoDecodeAcceleratorHost> CreateVideoDecoder( | 54 scoped_refptr<GpuVideoDecodeAcceleratorHost> CreateVideoDecoder( |
56 media::VideoCodecProfile profile, | 55 media::VideoCodecProfile profile, |
57 media::VideoDecodeAccelerator::Client* client); | 56 media::VideoDecodeAccelerator::Client* client); |
58 | 57 |
59 // IPC::Channel::Listener implementation: | 58 // IPC::Listener implementation: |
60 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 59 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
61 virtual void OnChannelError() OVERRIDE; | 60 virtual void OnChannelError() OVERRIDE; |
62 | 61 |
63 // CommandBufferProxy implementation: | 62 // CommandBufferProxy implementation: |
64 virtual int GetRouteID() const OVERRIDE; | 63 virtual int GetRouteID() const OVERRIDE; |
65 virtual bool Echo(const base::Closure& callback) OVERRIDE; | 64 virtual bool Echo(const base::Closure& callback) OVERRIDE; |
66 virtual bool SetSurfaceVisible(bool visible) OVERRIDE; | 65 virtual bool SetSurfaceVisible(bool visible) OVERRIDE; |
67 virtual bool DiscardBackbuffer() OVERRIDE; | 66 virtual bool DiscardBackbuffer() OVERRIDE; |
68 virtual bool EnsureBackbuffer() OVERRIDE; | 67 virtual bool EnsureBackbuffer() OVERRIDE; |
69 virtual uint32 InsertSyncPoint() OVERRIDE; | 68 virtual uint32 InsertSyncPoint() OVERRIDE; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // Tasks to be invoked in SignalSyncPoint responses. | 163 // Tasks to be invoked in SignalSyncPoint responses. |
165 uint32 next_signal_id_; | 164 uint32 next_signal_id_; |
166 SignalTaskMap signal_tasks_; | 165 SignalTaskMap signal_tasks_; |
167 | 166 |
168 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 167 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
169 }; | 168 }; |
170 | 169 |
171 #endif // ENABLE_GPU | 170 #endif // ENABLE_GPU |
172 | 171 |
173 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 172 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
OLD | NEW |