| 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 "content/common/gpu/client/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/memory/linked_ptr.h" | 18 #include "base/memory/linked_ptr.h" |
| 19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 20 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 21 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" | 21 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" |
| 22 #include "gpu/command_buffer/common/command_buffer.h" | 22 #include "gpu/command_buffer/common/command_buffer.h" |
| 23 #include "gpu/command_buffer/common/command_buffer_shared.h" | 23 #include "gpu/command_buffer/common/command_buffer_shared.h" |
| 24 #include "ipc/ipc_channel.h" | 24 #include "ipc/ipc_channel.h" |
| 25 #include "ipc/ipc_message.h" | 25 #include "ipc/ipc_message.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 38 public CommandBufferProxy, | 38 public CommandBufferProxy, |
| 39 public IPC::Channel::Listener, | 39 public IPC::Channel::Listener, |
| 40 public base::SupportsWeakPtr<CommandBufferProxyImpl> { | 40 public base::SupportsWeakPtr<CommandBufferProxyImpl> { |
| 41 public: | 41 public: |
| 42 typedef base::Callback<void( | 42 typedef base::Callback<void( |
| 43 const std::string& msg, int id)> GpuConsoleMessageCallback; | 43 const std::string& msg, int id)> GpuConsoleMessageCallback; |
| 44 | 44 |
| 45 CommandBufferProxyImpl(GpuChannelHost* channel, int route_id); | 45 CommandBufferProxyImpl(GpuChannelHost* channel, int route_id); |
| 46 virtual ~CommandBufferProxyImpl(); | 46 virtual ~CommandBufferProxyImpl(); |
| 47 | 47 |
| 48 // Sends an IPC message to create a GpuVideoDecodeAccelerator. Creates and |
| 49 // returns a pointer to a GpuVideoDecodeAcceleratorHost. |
| 50 // Returns NULL on failure to create the GpuVideoDecodeAcceleratorHost. |
| 51 // Note that the GpuVideoDecodeAccelerator may still fail to be created in |
| 52 // the GPU process, even if this returns non-NULL. In this case the client is |
| 53 // notified of an error later. |
| 54 scoped_refptr<GpuVideoDecodeAcceleratorHost> CreateVideoDecoder( |
| 55 media::VideoCodecProfile profile, |
| 56 media::VideoDecodeAccelerator::Client* client); |
| 57 |
| 48 // IPC::Channel::Listener implementation: | 58 // IPC::Channel::Listener implementation: |
| 49 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 59 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 50 virtual void OnChannelError() OVERRIDE; | 60 virtual void OnChannelError() OVERRIDE; |
| 51 | 61 |
| 52 // CommandBufferProxy implementation: | 62 // CommandBufferProxy implementation: |
| 53 virtual int GetRouteID() const OVERRIDE; | 63 virtual int GetRouteID() const OVERRIDE; |
| 54 virtual bool Echo(const base::Closure& callback) OVERRIDE; | 64 virtual bool Echo(const base::Closure& callback) OVERRIDE; |
| 55 virtual bool SetSurfaceVisible(bool visible) OVERRIDE; | 65 virtual bool SetSurfaceVisible(bool visible) OVERRIDE; |
| 56 virtual bool DiscardBackbuffer() OVERRIDE; | 66 virtual bool DiscardBackbuffer() OVERRIDE; |
| 57 virtual bool EnsureBackbuffer() OVERRIDE; | 67 virtual bool EnsureBackbuffer() OVERRIDE; |
| 58 virtual void SetMemoryAllocationChangedCallback( | 68 virtual void SetMemoryAllocationChangedCallback( |
| 59 const base::Callback<void(const GpuMemoryAllocationForRenderer&)>& | 69 const base::Callback<void(const GpuMemoryAllocationForRenderer&)>& |
| 60 callback) OVERRIDE; | 70 callback) OVERRIDE; |
| 61 virtual bool SetParent(CommandBufferProxy* parent_command_buffer, | 71 virtual bool SetParent(CommandBufferProxy* parent_command_buffer, |
| 62 uint32 parent_texture_id) OVERRIDE; | 72 uint32 parent_texture_id) OVERRIDE; |
| 63 virtual void SetChannelErrorCallback(const base::Closure& callback) OVERRIDE; | 73 virtual void SetChannelErrorCallback(const base::Closure& callback) OVERRIDE; |
| 64 virtual void SetNotifyRepaintTask(const base::Closure& callback) OVERRIDE; | 74 virtual void SetNotifyRepaintTask(const base::Closure& callback) OVERRIDE; |
| 65 virtual scoped_refptr<GpuVideoDecodeAcceleratorHost> CreateVideoDecoder( | |
| 66 media::VideoCodecProfile profile, | |
| 67 media::VideoDecodeAccelerator::Client* client) OVERRIDE; | |
| 68 virtual void SetOnConsoleMessageCallback( | 75 virtual void SetOnConsoleMessageCallback( |
| 69 const GpuConsoleMessageCallback& callback) OVERRIDE; | 76 const GpuConsoleMessageCallback& callback) OVERRIDE; |
| 70 | 77 |
| 71 // CommandBuffer implementation: | 78 // CommandBuffer implementation: |
| 72 virtual bool Initialize() OVERRIDE; | 79 virtual bool Initialize() OVERRIDE; |
| 73 virtual State GetState() OVERRIDE; | 80 virtual State GetState() OVERRIDE; |
| 74 virtual State GetLastState() OVERRIDE; | 81 virtual State GetLastState() OVERRIDE; |
| 75 virtual void Flush(int32 put_offset) OVERRIDE; | 82 virtual void Flush(int32 put_offset) OVERRIDE; |
| 76 virtual State FlushSync(int32 put_offset, int32 last_known_get) OVERRIDE; | 83 virtual State FlushSync(int32 put_offset, int32 last_known_get) OVERRIDE; |
| 77 virtual void SetGetBuffer(int32 shm_id) OVERRIDE; | 84 virtual void SetGetBuffer(int32 shm_id) OVERRIDE; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 memory_allocation_changed_callback_; | 152 memory_allocation_changed_callback_; |
| 146 | 153 |
| 147 GpuConsoleMessageCallback console_message_callback_; | 154 GpuConsoleMessageCallback console_message_callback_; |
| 148 | 155 |
| 149 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); | 156 DISALLOW_COPY_AND_ASSIGN(CommandBufferProxyImpl); |
| 150 }; | 157 }; |
| 151 | 158 |
| 152 #endif // ENABLE_GPU | 159 #endif // ENABLE_GPU |
| 153 | 160 |
| 154 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ | 161 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_IMPL_H_ |
| OLD | NEW |