summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/browser/renderer_host/image_transport_factory.cc2
-rw-r--r--content/common/gpu/client/command_buffer_proxy_impl.h15
-rw-r--r--content/common/gpu/client/gpu_channel_host.cc5
-rw-r--r--content/common/gpu/client/gpu_channel_host.h3
-rw-r--r--content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc2
-rw-r--r--content/content_common.gypi1
-rw-r--r--content/renderer/media/renderer_gpu_video_decoder_factories.cc2
-rw-r--r--content/renderer/pepper/pepper_platform_context_3d_impl.cc2
-rw-r--r--gpu/gpu_ipc.gypi2
-rw-r--r--gpu/ipc/command_buffer_proxy.cc5
-rw-r--r--gpu/ipc/command_buffer_proxy.h (renamed from content/common/gpu/client/command_buffer_proxy.h)25
-rw-r--r--ppapi/proxy/ppapi_command_buffer_proxy.cc60
-rw-r--r--ppapi/proxy/ppapi_command_buffer_proxy.h20
13 files changed, 104 insertions, 40 deletions
diff --git a/content/browser/renderer_host/image_transport_factory.cc b/content/browser/renderer_host/image_transport_factory.cc
index b7e8184..494d3cd 100644
--- a/content/browser/renderer_host/image_transport_factory.cc
+++ b/content/browser/renderer_host/image_transport_factory.cc
@@ -14,11 +14,11 @@
#include "content/browser/gpu/gpu_surface_tracker.h"
#include "content/browser/gpu/browser_gpu_channel_host_factory.h"
#include "content/browser/renderer_host/image_transport_client.h"
-#include "content/common/gpu/client/command_buffer_proxy.h"
#include "content/common/gpu/client/gpu_channel_host.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
#include "content/public/common/content_switches.h"
+#include "gpu/ipc/command_buffer_proxy.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h"
#include "ui/gfx/compositor/compositor.h"
#include "ui/gfx/compositor/compositor_setup.h"
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.h b/content/common/gpu/client/command_buffer_proxy_impl.h
index c5e64fe..71beae3 100644
--- a/content/common/gpu/client/command_buffer_proxy_impl.h
+++ b/content/common/gpu/client/command_buffer_proxy_impl.h
@@ -12,7 +12,7 @@
#include <queue>
#include <string>
-#include "content/common/gpu/client/command_buffer_proxy.h"
+#include "gpu/ipc/command_buffer_proxy.h"
#include "base/callback.h"
#include "base/memory/linked_ptr.h"
@@ -45,6 +45,16 @@ class CommandBufferProxyImpl :
CommandBufferProxyImpl(GpuChannelHost* channel, int route_id);
virtual ~CommandBufferProxyImpl();
+ // Sends an IPC message to create a GpuVideoDecodeAccelerator. Creates and
+ // returns a pointer to a GpuVideoDecodeAcceleratorHost.
+ // Returns NULL on failure to create the GpuVideoDecodeAcceleratorHost.
+ // Note that the GpuVideoDecodeAccelerator may still fail to be created in
+ // the GPU process, even if this returns non-NULL. In this case the client is
+ // notified of an error later.
+ scoped_refptr<GpuVideoDecodeAcceleratorHost> CreateVideoDecoder(
+ media::VideoCodecProfile profile,
+ media::VideoDecodeAccelerator::Client* client);
+
// IPC::Channel::Listener implementation:
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void OnChannelError() OVERRIDE;
@@ -62,9 +72,6 @@ class CommandBufferProxyImpl :
uint32 parent_texture_id) OVERRIDE;
virtual void SetChannelErrorCallback(const base::Closure& callback) OVERRIDE;
virtual void SetNotifyRepaintTask(const base::Closure& callback) OVERRIDE;
- virtual scoped_refptr<GpuVideoDecodeAcceleratorHost> CreateVideoDecoder(
- media::VideoCodecProfile profile,
- media::VideoDecodeAccelerator::Client* client) OVERRIDE;
virtual void SetOnConsoleMessageCallback(
const GpuConsoleMessageCallback& callback) OVERRIDE;
diff --git a/content/common/gpu/client/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc
index 2aac8c7..988feae 100644
--- a/content/common/gpu/client/gpu_channel_host.cc
+++ b/content/common/gpu/client/gpu_channel_host.cc
@@ -223,7 +223,7 @@ GpuVideoDecodeAcceleratorHost* GpuChannelHost::CreateVideoDecoder(
AutoLock lock(context_lock_);
ProxyMap::iterator it = proxies_.find(command_buffer_route_id);
DCHECK(it != proxies_.end());
- CommandBufferProxy* proxy = it->second;
+ CommandBufferProxyImpl* proxy = it->second;
return proxy->CreateVideoDecoder(profile, client);
}
@@ -267,7 +267,8 @@ CommandBufferProxy* GpuChannelHost::CreateOffscreenCommandBuffer(
#endif
}
-void GpuChannelHost::DestroyCommandBuffer(CommandBufferProxy* command_buffer) {
+void GpuChannelHost::DestroyCommandBuffer(
+ CommandBufferProxy* command_buffer) {
#if defined(ENABLE_GPU)
AutoLock lock(context_lock_);
int route_id = command_buffer->GetRouteID();
diff --git a/content/common/gpu/client/gpu_channel_host.h b/content/common/gpu/client/gpu_channel_host.h
index d6536f5..0a88845 100644
--- a/content/common/gpu/client/gpu_channel_host.h
+++ b/content/common/gpu/client/gpu_channel_host.h
@@ -28,6 +28,7 @@
#include "ui/gfx/size.h"
class CommandBufferProxy;
+class CommandBufferProxyImpl;
struct GPUCreateCommandBufferConfig;
class GURL;
class TransportTextureService;
@@ -190,7 +191,7 @@ class GpuChannelHost : public IPC::Message::Sender,
scoped_refptr<MessageFilter> channel_filter_;
// Used to look up a proxy from its routing id.
- typedef base::hash_map<int, CommandBufferProxy*> ProxyMap;
+ typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap;
ProxyMap proxies_;
// A lock to guard against concurrent access to members like the proxies map
diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
index 95ffaae..a8b4a3a 100644
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
@@ -23,7 +23,6 @@
#include "base/metrics/histogram.h"
#include "base/synchronization/lock.h"
#include "content/common/gpu/gpu_memory_allocation.h"
-#include "content/common/gpu/client/command_buffer_proxy.h"
#include "content/common/gpu/client/gpu_channel_host.h"
#include "content/public/common/content_switches.h"
#include "gpu/command_buffer/client/gles2_cmd_helper.h"
@@ -31,6 +30,7 @@
#include "gpu/command_buffer/client/gles2_lib.h"
#include "gpu/command_buffer/client/transfer_buffer.h"
#include "gpu/command_buffer/common/constants.h"
+#include "gpu/ipc/command_buffer_proxy.h"
#include "webkit/glue/gl_bindings_skia_cmd_buffer.h"
static base::LazyInstance<base::Lock>::Leaky
diff --git a/content/content_common.gypi b/content/content_common.gypi
index f35e72e..25f42b7 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -162,7 +162,6 @@
'common/geolocation_messages.h',
'common/geoposition.cc',
'common/geoposition.h',
- 'common/gpu/client/command_buffer_proxy.h',
'common/gpu/client/command_buffer_proxy_impl.cc',
'common/gpu/client/command_buffer_proxy_impl.h',
'common/gpu/client/gl_helper.cc',
diff --git a/content/renderer/media/renderer_gpu_video_decoder_factories.cc b/content/renderer/media/renderer_gpu_video_decoder_factories.cc
index 8867850..82d145b 100644
--- a/content/renderer/media/renderer_gpu_video_decoder_factories.cc
+++ b/content/renderer/media/renderer_gpu_video_decoder_factories.cc
@@ -7,10 +7,10 @@
#include "base/bind.h"
#include "base/synchronization/waitable_event.h"
#include "content/common/child_thread.h"
-#include "content/common/gpu/client/command_buffer_proxy.h"
#include "content/common/gpu/client/gpu_channel_host.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
+#include "gpu/ipc/command_buffer_proxy.h"
RendererGpuVideoDecoderFactories::~RendererGpuVideoDecoderFactories() {}
RendererGpuVideoDecoderFactories::RendererGpuVideoDecoderFactories(
diff --git a/content/renderer/pepper/pepper_platform_context_3d_impl.cc b/content/renderer/pepper/pepper_platform_context_3d_impl.cc
index 0c7e356..2abd9b1 100644
--- a/content/renderer/pepper/pepper_platform_context_3d_impl.cc
+++ b/content/renderer/pepper/pepper_platform_context_3d_impl.cc
@@ -6,13 +6,13 @@
#include "base/bind.h"
#include "content/common/gpu/client/gpu_channel_host.h"
-#include "content/common/gpu/client/command_buffer_proxy.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "content/renderer/pepper/pepper_parent_context_provider.h"
#include "content/renderer/render_thread_impl.h"
#include "googleurl/src/gurl.h"
#include "gpu/command_buffer/client/gles2_cmd_helper.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
+#include "gpu/ipc/command_buffer_proxy.h"
#include "ppapi/c/pp_graphics_3d.h"
#include "ui/gfx/gl/gpu_preference.h"
diff --git a/gpu/gpu_ipc.gypi b/gpu/gpu_ipc.gypi
index 9e583d0..33845f23 100644
--- a/gpu/gpu_ipc.gypi
+++ b/gpu/gpu_ipc.gypi
@@ -11,6 +11,8 @@
'<(DEPTH)/third_party/khronos',
],
'sources': [
+ 'ipc/command_buffer_proxy.h',
+ 'ipc/command_buffer_proxy.cc',
'ipc/gpu_command_buffer_traits.cc',
'ipc/gpu_command_buffer_traits.h',
],
diff --git a/gpu/ipc/command_buffer_proxy.cc b/gpu/ipc/command_buffer_proxy.cc
new file mode 100644
index 0000000..7ed6b0b
--- /dev/null
+++ b/gpu/ipc/command_buffer_proxy.cc
@@ -0,0 +1,5 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "gpu/ipc/command_buffer_proxy.h"
diff --git a/content/common/gpu/client/command_buffer_proxy.h b/gpu/ipc/command_buffer_proxy.h
index 661a75f..4f53fb0 100644
--- a/content/common/gpu/client/command_buffer_proxy.h
+++ b/gpu/ipc/command_buffer_proxy.h
@@ -2,18 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_
-#define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_
+#ifndef GPU_IPC_COMMAND_BUFFER_PROXY_H_
+#define GPU_IPC_COMMAND_BUFFER_PROXY_H_
#pragma once
-#if defined(ENABLE_GPU)
-
#include <string>
#include "base/callback.h"
-#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
-#include "content/common/gpu/client/gpu_video_decode_accelerator_host.h"
#include "gpu/command_buffer/common/command_buffer.h"
#include "gpu/command_buffer/common/command_buffer_shared.h"
@@ -21,7 +16,7 @@ struct GpuMemoryAllocationForRenderer;
// Client side proxy that forwards messages synchronously to a
// CommandBufferStub.
-class CommandBufferProxy : public gpu::CommandBuffer {
+class GPU_EXPORT CommandBufferProxy : public gpu::CommandBuffer {
public:
typedef base::Callback<void(
const std::string& msg, int id)> GpuConsoleMessageCallback;
@@ -60,16 +55,6 @@ class CommandBufferProxy : public gpu::CommandBuffer {
// and needs to be repainted. Takes ownership of task.
virtual void SetNotifyRepaintTask(const base::Closure& callback) = 0;
- // Sends an IPC message to create a GpuVideoDecodeAccelerator. Creates and
- // returns a pointer to a GpuVideoDecodeAcceleratorHost.
- // Returns NULL on failure to create the GpuVideoDecodeAcceleratorHost.
- // Note that the GpuVideoDecodeAccelerator may still fail to be created in
- // the GPU process, even if this returns non-NULL. In this case the client is
- // notified of an error later.
- virtual scoped_refptr<GpuVideoDecodeAcceleratorHost> CreateVideoDecoder(
- media::VideoCodecProfile profile,
- media::VideoDecodeAccelerator::Client* client) = 0;
-
virtual void SetOnConsoleMessageCallback(
const GpuConsoleMessageCallback& callback) = 0;
@@ -77,6 +62,4 @@ class CommandBufferProxy : public gpu::CommandBuffer {
DISALLOW_COPY_AND_ASSIGN(CommandBufferProxy);
};
-#endif // ENABLE_GPU
-
-#endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_
+#endif // GPU_IPC_COMMAND_BUFFER_PROXY_H_
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.cc b/ppapi/proxy/ppapi_command_buffer_proxy.cc
index 07f7aae..24ce88a 100644
--- a/ppapi/proxy/ppapi_command_buffer_proxy.cc
+++ b/ppapi/proxy/ppapi_command_buffer_proxy.cc
@@ -29,11 +29,6 @@ PpapiCommandBufferProxy::~PpapiCommandBufferProxy() {
}
}
-void PpapiCommandBufferProxy::SetChannelErrorCallback(
- const base::Closure& callback) {
- channel_error_callback_ = callback;
-}
-
void PpapiCommandBufferProxy::ReportChannelError() {
if (!channel_error_callback_.is_null()) {
channel_error_callback_.Run();
@@ -41,6 +36,61 @@ void PpapiCommandBufferProxy::ReportChannelError() {
}
}
+int PpapiCommandBufferProxy::GetRouteID() const {
+ NOTIMPLEMENTED();
+ return 0;
+}
+
+bool PpapiCommandBufferProxy::Echo(const base::Closure& callback) {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+bool PpapiCommandBufferProxy::SetSurfaceVisible(bool visible) {
+ NOTIMPLEMENTED();
+ return true;
+}
+
+bool PpapiCommandBufferProxy::DiscardBackbuffer() {
+ NOTIMPLEMENTED();
+ return true;
+}
+
+bool PpapiCommandBufferProxy::EnsureBackbuffer() {
+ NOTIMPLEMENTED();
+ return true;
+}
+
+void PpapiCommandBufferProxy::SetMemoryAllocationChangedCallback(
+ const base::Callback<void(const GpuMemoryAllocationForRenderer&)>&
+ callback) {
+ NOTIMPLEMENTED();
+}
+
+bool PpapiCommandBufferProxy::SetParent(
+ CommandBufferProxy* parent_command_buffer,
+ uint32 parent_texture_id) {
+ // TODO(fsamuel): Need a proper implementation of this to support offscreen
+ // contexts in the guest renderer (WebGL, canvas, etc).
+ NOTIMPLEMENTED();
+ return false;
+}
+
+void PpapiCommandBufferProxy::SetChannelErrorCallback(
+ const base::Closure& callback) {
+ channel_error_callback_ = callback;
+}
+
+void PpapiCommandBufferProxy::SetNotifyRepaintTask(
+ const base::Closure& callback) {
+ NOTIMPLEMENTED();
+}
+
+void PpapiCommandBufferProxy::SetOnConsoleMessageCallback(
+ const GpuConsoleMessageCallback& callback) {
+ NOTIMPLEMENTED();
+}
+
bool PpapiCommandBufferProxy::Initialize() {
return Send(new PpapiHostMsg_PPBGraphics3D_InitCommandBuffer(
ppapi::API_ID_PPB_GRAPHICS_3D, resource_));
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.h b/ppapi/proxy/ppapi_command_buffer_proxy.h
index 41b7ba9..389ca35 100644
--- a/ppapi/proxy/ppapi_command_buffer_proxy.h
+++ b/ppapi/proxy/ppapi_command_buffer_proxy.h
@@ -11,6 +11,7 @@
#include "gpu/command_buffer/common/command_buffer.h"
#include "ppapi/proxy/ppapi_proxy_export.h"
#include "ppapi/shared_impl/host_resource.h"
+#include "gpu/ipc/command_buffer_proxy.h"
namespace IPC {
class Message;
@@ -21,15 +22,30 @@ namespace proxy {
class ProxyChannel;
-class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer {
+class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public CommandBufferProxy {
public:
PpapiCommandBufferProxy(const HostResource& resource,
ProxyChannel* channel);
virtual ~PpapiCommandBufferProxy();
- void SetChannelErrorCallback(const base::Closure& callback);
void ReportChannelError();
+ // CommandBufferProxy implementation:
+ virtual int GetRouteID() const OVERRIDE;
+ virtual bool Echo(const base::Closure& callback) OVERRIDE;
+ virtual bool SetSurfaceVisible(bool visible) OVERRIDE;
+ virtual bool DiscardBackbuffer() OVERRIDE;
+ virtual bool EnsureBackbuffer() OVERRIDE;
+ virtual void SetMemoryAllocationChangedCallback(
+ const base::Callback<void(const GpuMemoryAllocationForRenderer&)>&
+ callback) OVERRIDE;
+ virtual bool SetParent(CommandBufferProxy* parent_command_buffer,
+ uint32 parent_texture_id) OVERRIDE;
+ virtual void SetChannelErrorCallback(const base::Closure& callback) OVERRIDE;
+ virtual void SetNotifyRepaintTask(const base::Closure& callback) OVERRIDE;
+ virtual void SetOnConsoleMessageCallback(
+ const GpuConsoleMessageCallback& callback) OVERRIDE;
+
// gpu::CommandBuffer implementation:
virtual bool Initialize();
virtual State GetState();