diff options
28 files changed, 208 insertions, 223 deletions
diff --git a/content/renderer/gpu/command_buffer_proxy.cc b/content/common/gpu/client/command_buffer_proxy.cc index 82c0676..0fd233c 100644 --- a/content/renderer/gpu/command_buffer_proxy.cc +++ b/content/common/gpu/client/command_buffer_proxy.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/renderer/gpu/command_buffer_proxy.h" +#include "content/common/gpu/client/command_buffer_proxy.h" #include "base/callback.h" #include "base/debug/trace_event.h" @@ -12,11 +12,10 @@ #include "base/stl_util.h" #include "content/common/child_process_messages.h" #include "content/common/child_thread.h" +#include "content/common/gpu/client/gpu_channel_host.h" #include "content/common/gpu/gpu_messages.h" #include "content/common/plugin_messages.h" #include "content/common/view_messages.h" -#include "content/renderer/gpu/gpu_channel_host.h" -#include "content/renderer/plugin_channel_host.h" #include "gpu/command_buffer/common/cmd_buffer_common.h" #include "ui/gfx/size.h" diff --git a/content/renderer/gpu/command_buffer_proxy.h b/content/common/gpu/client/command_buffer_proxy.h index 16c857c..315e84e 100644 --- a/content/renderer/gpu/command_buffer_proxy.h +++ b/content/common/gpu/client/command_buffer_proxy.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ -#define CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ +#ifndef CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_ +#define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_ #pragma once #if defined(ENABLE_GPU) @@ -15,7 +15,7 @@ #include "base/memory/linked_ptr.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "content/renderer/gpu/gpu_video_decode_accelerator_host.h" +#include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" #include "gpu/command_buffer/common/command_buffer.h" #include "ipc/ipc_channel.h" #include "ipc/ipc_message.h" @@ -92,7 +92,7 @@ class CommandBufferProxy : public gpu::CommandBuffer, media::VideoDecodeAccelerator::Client* client); // TODO(apatrick): this is a temporary optimization while skia is calling - // RendererGLContext::MakeCurrent prior to every GL call. It saves returning 6 + // ContentGLContext::MakeCurrent prior to every GL call. It saves returning 6 // ints redundantly when only the error is needed for the CommandBufferProxy // implementation. virtual gpu::error::Error GetLastError() OVERRIDE; @@ -140,4 +140,4 @@ class CommandBufferProxy : public gpu::CommandBuffer, #endif // ENABLE_GPU -#endif // CONTENT_RENDERER_GPU_COMMAND_BUFFER_PROXY_H_ +#endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_PROXY_H_ diff --git a/content/renderer/gpu/renderer_gl_context.cc b/content/common/gpu/client/content_gl_context.cc index 6440271..52468f3 100644 --- a/content/renderer/gpu/renderer_gl_context.cc +++ b/content/common/gpu/client/content_gl_context.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/renderer/gpu/renderer_gl_context.h" +#include "content/common/gpu/client/content_gl_context.h" #include "base/bind.h" #include "base/debug/trace_event.h" @@ -12,10 +12,8 @@ #include "base/memory/singleton.h" #include "base/memory/weak_ptr.h" #include "base/shared_memory.h" -#include "content/common/view_messages.h" -#include "content/renderer/gpu/command_buffer_proxy.h" -#include "content/renderer/gpu/gpu_channel_host.h" -#include "content/renderer/render_widget.h" +#include "content/common/gpu/client/command_buffer_proxy.h" +#include "content/common/gpu/client/gpu_channel_host.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_channel_handle.h" @@ -59,37 +57,37 @@ base::LazyInstance<GLES2Initializer> g_gles2_initializer = //////////////////////////////////////////////////////////////////////////////// #if defined(ENABLE_GPU) -RendererGLContext::ContextLostReason ConvertReason( +ContentGLContext::ContextLostReason ConvertReason( gpu::error::ContextLostReason reason) { switch (reason) { case gpu::error::kGuilty: - return RendererGLContext::kGuilty; + return ContentGLContext::kGuilty; case gpu::error::kInnocent: - return RendererGLContext::kInnocent; + return ContentGLContext::kInnocent; case gpu::error::kUnknown: - return RendererGLContext::kUnknown; + return ContentGLContext::kUnknown; } NOTREACHED(); - return RendererGLContext::kUnknown; + return ContentGLContext::kUnknown; } #endif } // namespace -RendererGLContext::~RendererGLContext() { +ContentGLContext::~ContentGLContext() { Destroy(); } -RendererGLContext* RendererGLContext::CreateViewContext( +ContentGLContext* ContentGLContext::CreateViewContext( GpuChannelHost* channel, int32 surface_id, - RendererGLContext* share_group, + ContentGLContext* share_group, const char* allowed_extensions, const int32* attrib_list, const GURL& active_url, gfx::GpuPreference gpu_preference) { #if defined(ENABLE_GPU) - scoped_ptr<RendererGLContext> context(new RendererGLContext(channel)); + scoped_ptr<ContentGLContext> context(new ContentGLContext(channel)); if (!context->Initialize( true, surface_id, @@ -107,16 +105,16 @@ RendererGLContext* RendererGLContext::CreateViewContext( #endif } -RendererGLContext* RendererGLContext::CreateOffscreenContext( +ContentGLContext* ContentGLContext::CreateOffscreenContext( GpuChannelHost* channel, const gfx::Size& size, - RendererGLContext* share_group, + ContentGLContext* share_group, const char* allowed_extensions, const int32* attrib_list, const GURL& active_url, gfx::GpuPreference gpu_preference) { #if defined(ENABLE_GPU) - scoped_ptr<RendererGLContext> context(new RendererGLContext(channel)); + scoped_ptr<ContentGLContext> context(new ContentGLContext(channel)); if (!context->Initialize( false, 0, @@ -134,7 +132,7 @@ RendererGLContext* RendererGLContext::CreateOffscreenContext( #endif } -bool RendererGLContext::SetParent(RendererGLContext* new_parent) { +bool ContentGLContext::SetParent(ContentGLContext* new_parent) { if (parent_.get() == new_parent) return true; @@ -142,7 +140,7 @@ bool RendererGLContext::SetParent(RendererGLContext* new_parent) { uint32 new_parent_texture_id = 0; if (command_buffer_) { if (new_parent) { - TRACE_EVENT0("gpu", "RendererGLContext::SetParent::flushParent"); + TRACE_EVENT0("gpu", "ContentGLContext::SetParent::flushParent"); // Flush any remaining commands in the parent context to make sure the // texture id accounting stays consistent. int32 token = new_parent->gles2_helper_->InsertToken(); @@ -182,27 +180,27 @@ bool RendererGLContext::SetParent(RendererGLContext* new_parent) { return true; } -uint32 RendererGLContext::GetParentTextureId() { +uint32 ContentGLContext::GetParentTextureId() { return parent_texture_id_; } -uint32 RendererGLContext::CreateParentTexture(const gfx::Size& size) { +uint32 ContentGLContext::CreateParentTexture(const gfx::Size& size) { uint32 texture_id = 0; gles2_implementation_->GenTextures(1, &texture_id); gles2_implementation_->Flush(); return texture_id; } -void RendererGLContext::DeleteParentTexture(uint32 texture) { +void ContentGLContext::DeleteParentTexture(uint32 texture) { gles2_implementation_->DeleteTextures(1, &texture); } -void RendererGLContext::SetContextLostCallback( +void ContentGLContext::SetContextLostCallback( const base::Callback<void (ContextLostReason)>& callback) { context_lost_callback_ = callback; } -bool RendererGLContext::MakeCurrent(RendererGLContext* context) { +bool ContentGLContext::MakeCurrent(ContentGLContext* context) { if (context) { DCHECK(context->CalledOnValidThread()); gles2::SetGLContext(context->gles2_implementation_); @@ -221,8 +219,8 @@ bool RendererGLContext::MakeCurrent(RendererGLContext* context) { return true; } -bool RendererGLContext::SwapBuffers() { - TRACE_EVENT1("gpu", "RendererGLContext::SwapBuffers", "frame", frame_number_); +bool ContentGLContext::SwapBuffers() { + TRACE_EVENT1("gpu", "ContentGLContext::SwapBuffers", "frame", frame_number_); frame_number_++; // Don't request latest error status from service. Just use the locally cached @@ -235,11 +233,11 @@ bool RendererGLContext::SwapBuffers() { return true; } -bool RendererGLContext::Echo(const base::Closure& task) { +bool ContentGLContext::Echo(const base::Closure& task) { return command_buffer_->Echo(task); } -RendererGLContext::Error RendererGLContext::GetError() { +ContentGLContext::Error ContentGLContext::GetError() { gpu::CommandBuffer::State state = command_buffer_->GetState(); if (state.error == gpu::error::kNoError) { Error old_error = last_error_; @@ -252,7 +250,7 @@ RendererGLContext::Error RendererGLContext::GetError() { } } -bool RendererGLContext::IsCommandBufferContextLost() { +bool ContentGLContext::IsCommandBufferContextLost() { // If the channel shut down unexpectedly, let that supersede the // command buffer's state. if (channel_->state() == GpuChannelHost::kLost) @@ -261,26 +259,26 @@ bool RendererGLContext::IsCommandBufferContextLost() { return state.error == gpu::error::kLostContext; } -CommandBufferProxy* RendererGLContext::GetCommandBufferProxy() { +CommandBufferProxy* ContentGLContext::GetCommandBufferProxy() { return command_buffer_; } -bool RendererGLContext::SetSurfaceVisible(bool visible) { +bool ContentGLContext::SetSurfaceVisible(bool visible) { return GetCommandBufferProxy()->SetSurfaceVisible(visible); } // TODO(gman): Remove This -void RendererGLContext::DisableShaderTranslation() { +void ContentGLContext::DisableShaderTranslation() { NOTREACHED(); } -gpu::gles2::GLES2Implementation* RendererGLContext::GetImplementation() { +gpu::gles2::GLES2Implementation* ContentGLContext::GetImplementation() { return gles2_implementation_; } -RendererGLContext::RendererGLContext(GpuChannelHost* channel) +ContentGLContext::ContentGLContext(GpuChannelHost* channel) : channel_(channel), - parent_(base::WeakPtr<RendererGLContext>()), + parent_(base::WeakPtr<ContentGLContext>()), parent_texture_id_(0), command_buffer_(NULL), gles2_helper_(NULL), @@ -291,17 +289,17 @@ RendererGLContext::RendererGLContext(GpuChannelHost* channel) DCHECK(channel); } -bool RendererGLContext::Initialize(bool onscreen, - int32 surface_id, - const gfx::Size& size, - RendererGLContext* share_group, - const char* allowed_extensions, - const int32* attrib_list, - const GURL& active_url, - gfx::GpuPreference gpu_preference) { +bool ContentGLContext::Initialize(bool onscreen, + int32 surface_id, + const gfx::Size& size, + ContentGLContext* share_group, + const char* allowed_extensions, + const int32* attrib_list, + const GURL& active_url, + gfx::GpuPreference gpu_preference) { DCHECK(CalledOnValidThread()); DCHECK(size.width() >= 0 && size.height() >= 0); - TRACE_EVENT2("gpu", "RendererGLContext::Initialize", + TRACE_EVENT2("gpu", "ContentGLContext::Initialize", "on_screen", onscreen, "num_pixels", size.GetArea()); if (channel_->state() != GpuChannelHost::kConnected) @@ -349,7 +347,7 @@ bool RendererGLContext::Initialize(bool onscreen, // Create a proxy to a command buffer in the GPU process. if (onscreen) { TRACE_EVENT0("gpu", - "RendererGLContext::Initialize::CreateViewCommandBuffer"); + "ContentGLContext::Initialize::CreateViewCommandBuffer"); command_buffer_ = channel_->CreateViewCommandBuffer( surface_id, share_group ? share_group->command_buffer_ : NULL, @@ -373,7 +371,7 @@ bool RendererGLContext::Initialize(bool onscreen, { TRACE_EVENT0("gpu", - "RendererGLContext::Initialize::InitializeCommandBuffer"); + "ContentGLContext::Initialize::InitializeCommandBuffer"); // Initiaize the command buffer. if (!command_buffer_->Initialize()) { Destroy(); @@ -382,7 +380,7 @@ bool RendererGLContext::Initialize(bool onscreen, } command_buffer_->SetChannelErrorCallback( - base::Bind(&RendererGLContext::OnContextLost, base::Unretained(this))); + base::Bind(&ContentGLContext::OnContextLost, base::Unretained(this))); // Create the GLES2 helper, which writes the command buffer protocol. gles2_helper_ = new gpu::gles2::GLES2CmdHelper(command_buffer_); @@ -392,7 +390,7 @@ bool RendererGLContext::Initialize(bool onscreen, } { - TRACE_EVENT0("gpu", "RendererGLContext::Initialize::CreateTransferBuffer"); + TRACE_EVENT0("gpu", "ContentGLContext::Initialize::CreateTransferBuffer"); // Create a transfer buffer used to copy resources between the renderer // process and the GPU process. transfer_buffer_ = new gpu::TransferBuffer(gles2_helper_); @@ -416,8 +414,8 @@ bool RendererGLContext::Initialize(bool onscreen, return true; } -void RendererGLContext::Destroy() { - TRACE_EVENT0("gpu", "RendererGLContext::Destroy"); +void ContentGLContext::Destroy() { + TRACE_EVENT0("gpu", "ContentGLContext::Destroy"); DCHECK(CalledOnValidThread()); SetParent(NULL); @@ -449,9 +447,9 @@ void RendererGLContext::Destroy() { channel_ = NULL; } -void RendererGLContext::OnContextLost() { +void ContentGLContext::OnContextLost() { if (!context_lost_callback_.is_null()) { - RendererGLContext::ContextLostReason reason = kUnknown; + ContentGLContext::ContextLostReason reason = kUnknown; if (command_buffer_) { reason = ConvertReason( command_buffer_->GetLastState().context_lost_reason); diff --git a/content/renderer/gpu/renderer_gl_context.h b/content/common/gpu/client/content_gl_context.h index e491e2c..e704aa1 100644 --- a/content/renderer/gpu/renderer_gl_context.h +++ b/content/common/gpu/client/content_gl_context.h @@ -3,11 +3,11 @@ // found in the LICENSE file. // This API is consistent with other OpenGL setup APIs like window's WGL -// and pepper's PGL. This API is used to manage OpenGL RendererGLContexts in the +// and pepper's PGL. This API is used to manage OpenGL ContentGLContexts in the // Chrome renderer process in a way that is consistent with other platforms. -#ifndef CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ -#define CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ +#ifndef CONTENT_COMMON_GPU_CLIENT_RENDERER_GL_CONTEXT_H_ +#define CONTENT_COMMON_GPU_CLIENT_RENDERER_GL_CONTEXT_H_ #pragma once #include "base/callback.h" @@ -32,19 +32,17 @@ class GLES2Implementation; } } -class RendererGLContext : public base::SupportsWeakPtr<RendererGLContext>, - public base::NonThreadSafe { +class ContentGLContext : public base::SupportsWeakPtr<ContentGLContext>, + public base::NonThreadSafe { public: // These are the same error codes as used by EGL. enum Error { SUCCESS = 0x3000, - NOT_INITIALIZED = 0x3001, BAD_ATTRIBUTE = 0x3004, - BAD_RendererGLContext = 0x3006, CONTEXT_LOST = 0x300E }; - // RendererGLContext configuration attributes. Those in the 16-bit range are + // ContentGLContext configuration attributes. Those in the 16-bit range are // the same as used by EGL. Those outside the 16-bit range are unique to // Chromium. Attributes are matched using a closest fit algorithm. enum Attribute { @@ -83,11 +81,11 @@ class RendererGLContext : public base::SupportsWeakPtr<RendererGLContext>, // have completed. static bool Terminate(); - ~RendererGLContext(); + ~ContentGLContext(); - // Create a RendererGLContext that renders directly to a view. The view and + // Create a ContentGLContext that renders directly to a view. The view and // the associated window must not be destroyed until the returned - // RendererGLContext has been destroyed, otherwise the GPU process might + // ContentGLContext has been destroyed, otherwise the GPU process might // attempt to render to an invalid window handle. // // NOTE: on Mac OS X, this entry point is only used to set up the @@ -102,27 +100,27 @@ class RendererGLContext : public base::SupportsWeakPtr<RendererGLContext>, // The render_view_id is currently also only used on Mac OS X. // TODO(kbr): clean up the arguments to this function and make them // more cross-platform. - static RendererGLContext* CreateViewContext( + static ContentGLContext* CreateViewContext( GpuChannelHost* channel, int32 surface_id, - RendererGLContext* share_group, + ContentGLContext* share_group, const char* allowed_extensions, const int32* attrib_list, const GURL& active_url, gfx::GpuPreference gpu_preference); - // Create a RendererGLContext that renders to an offscreen frame buffer. If - // parent is not NULL, that RendererGLContext can access a copy of the created - // RendererGLContext's frame buffer that is updated every time SwapBuffers is - // called. It is not as general as shared RendererGLContexts in other + // Create a ContentGLContext that renders to an offscreen frame buffer. If + // parent is not NULL, that ContentGLContext can access a copy of the created + // ContentGLContext's frame buffer that is updated every time SwapBuffers is + // called. It is not as general as shared ContentGLContexts in other // implementations of OpenGL. If parent is not NULL, it must be used on the - // same thread as the parent. A child RendererGLContext may not outlive its + // same thread as the parent. A child ContentGLContext may not outlive its // parent. attrib_list must be NULL or a NONE-terminated list of // attribute/value pairs. - static RendererGLContext* CreateOffscreenContext( + static ContentGLContext* CreateOffscreenContext( GpuChannelHost* channel, const gfx::Size& size, - RendererGLContext* share_group, + ContentGLContext* share_group, const char* allowed_extensions, const int32* attrib_list, const GURL& active_url, @@ -130,30 +128,30 @@ class RendererGLContext : public base::SupportsWeakPtr<RendererGLContext>, // Sets the parent context. If any parent textures have been created for // another parent, it is important to delete them before changing the parent. - bool SetParent(RendererGLContext* parent); + bool SetParent(ContentGLContext* parent); - // For an offscreen frame buffer RendererGLContext, return the texture ID with - // respect to the parent RendererGLContext. Returns zero if RendererGLContext + // For an offscreen frame buffer ContentGLContext, return the texture ID with + // respect to the parent ContentGLContext. Returns zero if ContentGLContext // does not have a parent. uint32 GetParentTextureId(); - // Create a new texture in the parent's RendererGLContext. Returns zero if - // RendererGLContext does not have a parent. + // Create a new texture in the parent's ContentGLContext. Returns zero if + // ContentGLContext does not have a parent. uint32 CreateParentTexture(const gfx::Size& size); - // Deletes a texture in the parent's RendererGLContext. + // Deletes a texture in the parent's ContentGLContext. void DeleteParentTexture(uint32 texture); void SetContextLostCallback( const base::Callback<void(ContextLostReason)>& callback); - // Set the current RendererGLContext for the calling thread. - static bool MakeCurrent(RendererGLContext* context); + // Set the current ContentGLContext for the calling thread. + static bool MakeCurrent(ContentGLContext* context); - // For a view RendererGLContext, display everything that has been rendered - // since the last call. For an offscreen RendererGLContext, resolve everything + // For a view ContentGLContext, display everything that has been rendered + // since the last call. For an offscreen ContentGLContext, resolve everything // that has been rendered since the last call to a copy that can be accessed - // by the parent RendererGLContext. + // by the parent ContentGLContext. bool SwapBuffers(); // Run the task once the channel has been flushed. Takes care of deleting the @@ -166,26 +164,26 @@ class RendererGLContext : public base::SupportsWeakPtr<RendererGLContext>, // TODO(gman): Remove this void DisableShaderTranslation(); - // Allows direct access to the GLES2 implementation so a RendererGLContext + // Allows direct access to the GLES2 implementation so a ContentGLContext // can be used without making it current. gpu::gles2::GLES2Implementation* GetImplementation(); // Return the current error. Error GetError(); - // Return true if GPU process reported RendererGLContext lost or there was a + // Return true if GPU process reported ContentGLContext lost or there was a // problem communicating with the GPU process. bool IsCommandBufferContextLost(); CommandBufferProxy* GetCommandBufferProxy(); private: - explicit RendererGLContext(GpuChannelHost* channel); + explicit ContentGLContext(GpuChannelHost* channel); bool Initialize(bool onscreen, int32 surface_id, const gfx::Size& size, - RendererGLContext* share_group, + ContentGLContext* share_group, const char* allowed_extensions, const int32* attrib_list, const GURL& active_url, @@ -195,7 +193,7 @@ class RendererGLContext : public base::SupportsWeakPtr<RendererGLContext>, void OnContextLost(); scoped_refptr<GpuChannelHost> channel_; - base::WeakPtr<RendererGLContext> parent_; + base::WeakPtr<ContentGLContext> parent_; base::Callback<void(ContextLostReason)> context_lost_callback_; uint32 parent_texture_id_; CommandBufferProxy* command_buffer_; @@ -205,7 +203,7 @@ class RendererGLContext : public base::SupportsWeakPtr<RendererGLContext>, Error last_error_; int frame_number_; - DISALLOW_COPY_AND_ASSIGN(RendererGLContext); + DISALLOW_COPY_AND_ASSIGN(ContentGLContext); }; -#endif // CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ +#endif // CONTENT_COMMON_GPU_CLIENT_RENDERER_GL_CONTEXT_H_ diff --git a/content/renderer/gpu/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc index 05d73d5..7b26415 100644 --- a/content/renderer/gpu/gpu_channel_host.cc +++ b/content/common/gpu/client/gpu_channel_host.cc @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/renderer/gpu/gpu_channel_host.h" +#include "content/common/gpu/client/gpu_channel_host.h" #include "base/bind.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" #include "content/common/child_thread.h" +#include "content/common/gpu/client/command_buffer_proxy.h" #include "content/common/gpu/gpu_messages.h" -#include "content/renderer/gpu/command_buffer_proxy.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_sync_message_filter.h" @@ -109,7 +109,7 @@ GpuChannelHost::~GpuChannelHost() { void GpuChannelHost::Connect( const IPC::ChannelHandle& channel_handle, - base::ProcessHandle renderer_process_for_gpu) { + base::ProcessHandle client_process_for_gpu) { DCHECK(factory_->IsMainThread()); // Open a channel to the GPU process. We pass NULL as the main listener here // since we need to filter everything to route it to the right thread. @@ -135,8 +135,8 @@ void GpuChannelHost::Connect( state_ = kConnected; // Notify the GPU process of our process handle. This gives it the ability - // to map renderer handles into the GPU process. - Send(new GpuChannelMsg_Initialize(renderer_process_for_gpu)); + // to map client handles into the GPU process. + Send(new GpuChannelMsg_Initialize(client_process_for_gpu)); } void GpuChannelHost::set_gpu_info(const content::GPUInfo& gpu_info) { diff --git a/content/renderer/gpu/gpu_channel_host.h b/content/common/gpu/client/gpu_channel_host.h index d81fdd8..1e6df16 100644 --- a/content/renderer/gpu/gpu_channel_host.h +++ b/content/common/gpu/client/gpu_channel_host.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_RENDERER_GPU_GPU_CHANNEL_HOST_H_ -#define CONTENT_RENDERER_GPU_GPU_CHANNEL_HOST_H_ +#ifndef CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ +#define CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ #pragma once #include <string> @@ -19,7 +19,7 @@ #include "content/common/gpu/gpu_process_launch_causes.h" #include "content/common/message_router.h" #include "content/public/common/gpu_info.h" -#include "content/renderer/gpu/gpu_video_decode_accelerator_host.h" +#include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_channel_proxy.h" #include "ipc/ipc_sync_channel.h" @@ -74,8 +74,8 @@ class CONTENT_EXPORT GpuChannelHostFactory { static GpuChannelHostFactory* instance_; }; -// Encapsulates an IPC channel between the renderer and one plugin process. -// On the plugin side there's a corresponding GpuChannel. +// Encapsulates an IPC channel between the client and one GPU process. +// On the GPU process side there's a corresponding GpuChannel. class GpuChannelHost : public IPC::Message::Sender, public base::RefCountedThreadSafe<GpuChannelHost> { public: @@ -95,7 +95,7 @@ class GpuChannelHost : public IPC::Message::Sender, // Connect to GPU process channel. void Connect(const IPC::ChannelHandle& channel_handle, - base::ProcessHandle renderer_process_for_gpu); + base::ProcessHandle client_process_for_gpu); State state() const { return state_; } @@ -206,4 +206,4 @@ class GpuChannelHost : public IPC::Message::Sender, DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); }; -#endif // CONTENT_RENDERER_GPU_GPU_CHANNEL_HOST_H_ +#endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ diff --git a/content/renderer/gpu/gpu_video_decode_accelerator_host.cc b/content/common/gpu/client/gpu_video_decode_accelerator_host.cc index de9e1d6..3abbf25 100644 --- a/content/renderer/gpu/gpu_video_decode_accelerator_host.cc +++ b/content/common/gpu/client/gpu_video_decode_accelerator_host.cc @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/renderer/gpu/gpu_video_decode_accelerator_host.h" +#include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" #include "base/bind.h" #include "base/logging.h" #include "base/message_loop.h" +#include "content/common/gpu/client/gpu_channel_host.h" #include "content/common/gpu/gpu_messages.h" #include "content/common/view_messages.h" -#include "content/renderer/gpu/gpu_channel_host.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_utils.h" diff --git a/content/renderer/gpu/gpu_video_decode_accelerator_host.h b/content/common/gpu/client/gpu_video_decode_accelerator_host.h index b926e8e..396c6eb 100644 --- a/content/renderer/gpu/gpu_video_decode_accelerator_host.h +++ b/content/common/gpu/client/gpu_video_decode_accelerator_host.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_RENDERER_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ -#define CONTENT_RENDERER_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ +#ifndef CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ +#define CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ #include <vector> @@ -58,7 +58,7 @@ class GpuVideoDecodeAcceleratorHost GpuChannelHost* channel_; // Route ID for the associated decoder in the GPU process. - // TODO(fischman): storing route_id's for GPU process entities in the renderer + // TODO(fischman): storing route_id's for GPU process entities in the client // process is vulnerable to GPU process crashing & being respawned, and // attempting to use an outdated or reused route id. int32 decoder_route_id_; @@ -69,4 +69,4 @@ class GpuVideoDecodeAcceleratorHost DISALLOW_COPY_AND_ASSIGN(GpuVideoDecodeAcceleratorHost); }; -#endif // CONTENT_RENDERER_GPU_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ +#endif // CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ diff --git a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc index 99f839d..e9bf967 100644 --- a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc +++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" +#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" #include "third_party/khronos/GLES2/gl2.h" #ifndef GL_GLEXT_PROTOTYPES @@ -22,10 +22,9 @@ #include "base/message_loop.h" #include "base/metrics/histogram.h" #include "base/synchronization/lock.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 "content/renderer/gpu/command_buffer_proxy.h" -#include "content/renderer/gpu/gpu_channel_host.h" -#include "content/renderer/render_view_impl.h" #include "gpu/command_buffer/client/gles2_implementation.h" #include "gpu/command_buffer/common/constants.h" #include "webkit/glue/gl_bindings_skia_cmd_buffer.h" @@ -109,7 +108,7 @@ bool WebGraphicsContext3DCommandBufferImpl::Initialize( if (!retry) { // If the creation of this context requires all contexts for this - // renderer to be destroyed on the GPU process side, then drop the + // client to be destroyed on the GPU process side, then drop the // channel and recreate it. if (host_->WillGpuSwitchOccur(true, gpu_preference_)) { host_->ForciblyCloseChannel(); @@ -150,7 +149,7 @@ bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() { if (!factory || !factory->IsMainThread()) DCHECK(!swap_client_.get()); - // Convert WebGL context creation attributes into RendererGLContext / EGL size + // Convert WebGL context creation attributes into ContentGLContext / EGL size // requests. const int alpha_size = attributes_.alpha ? 8 : 0; const int depth_size = attributes_.depth ? 24 : 0; @@ -158,31 +157,31 @@ bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() { const int samples = attributes_.antialias ? 4 : 0; const int sample_buffers = attributes_.antialias ? 1 : 0; const int32 attribs[] = { - RendererGLContext::ALPHA_SIZE, alpha_size, - RendererGLContext::DEPTH_SIZE, depth_size, - RendererGLContext::STENCIL_SIZE, stencil_size, - RendererGLContext::SAMPLES, samples, - RendererGLContext::SAMPLE_BUFFERS, sample_buffers, - RendererGLContext::SHARE_RESOURCES, attributes_.shareResources ? 1 : 0, - RendererGLContext::BIND_GENERATES_RESOURCES, 0, - RendererGLContext::NONE, + ContentGLContext::ALPHA_SIZE, alpha_size, + ContentGLContext::DEPTH_SIZE, depth_size, + ContentGLContext::STENCIL_SIZE, stencil_size, + ContentGLContext::SAMPLES, samples, + ContentGLContext::SAMPLE_BUFFERS, sample_buffers, + ContentGLContext::SHARE_RESOURCES, attributes_.shareResources ? 1 : 0, + ContentGLContext::BIND_GENERATES_RESOURCES, 0, + ContentGLContext::NONE, }; const char* preferred_extensions = "*"; - // We need to lock g_all_shared_contexts until after RendererGLContext::Create + // We need to lock g_all_shared_contexts until after ContentGLContext::Create // to ensure that the context we picked for our share group isn't deleted. // (There's also a lock in our destructor.) { base::AutoLock lock(g_all_shared_contexts_lock.Get()); - RendererGLContext* share_group = NULL; + ContentGLContext* share_group = NULL; if (attributes_.shareResources) { share_group = g_all_shared_contexts.Pointer()->empty() ? NULL : (*g_all_shared_contexts.Pointer()->begin())->context_; } if (surface_id_) { - context_ = RendererGLContext::CreateViewContext( + context_ = ContentGLContext::CreateViewContext( host_, surface_id_, share_group, @@ -191,7 +190,7 @@ bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() { active_url_, gpu_preference_); } else { - context_ = RendererGLContext::CreateOffscreenContext( + context_ = ContentGLContext::CreateOffscreenContext( host_, gfx::Size(1, 1), share_group, @@ -249,7 +248,7 @@ bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() { bool WebGraphicsContext3DCommandBufferImpl::makeContextCurrent() { if (!MaybeInitializeGL()) return false; - return RendererGLContext::MakeCurrent(context_); + return ContentGLContext::MakeCurrent(context_); } int WebGraphicsContext3DCommandBufferImpl::width() { @@ -1154,13 +1153,13 @@ GrGLInterface* WebGraphicsContext3DCommandBufferImpl::onCreateGrGLInterface() { namespace { -WGC3Denum convertReason(RendererGLContext::ContextLostReason reason) { +WGC3Denum convertReason(ContentGLContext::ContextLostReason reason) { switch (reason) { - case RendererGLContext::kGuilty: + case ContentGLContext::kGuilty: return GL_GUILTY_CONTEXT_RESET_ARB; - case RendererGLContext::kInnocent: + case ContentGLContext::kInnocent: return GL_INNOCENT_CONTEXT_RESET_ARB; - case RendererGLContext::kUnknown: + case ContentGLContext::kUnknown: return GL_UNKNOWN_CONTEXT_RESET_ARB; } @@ -1171,7 +1170,7 @@ WGC3Denum convertReason(RendererGLContext::ContextLostReason reason) { } // anonymous namespace void WebGraphicsContext3DCommandBufferImpl::OnContextLost( - RendererGLContext::ContextLostReason reason) { + ContentGLContext::ContextLostReason reason) { context_lost_reason_ = convertReason(reason); if (context_lost_callback_) { context_lost_callback_->onContextLost(); diff --git a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h index 778c2ce..1e8d883 100644 --- a/content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h +++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_RENDERER_GPU_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ -#define CONTENT_RENDERER_GPU_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ +#ifndef CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ +#define CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ #pragma once #include <string> @@ -11,7 +11,7 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "content/renderer/gpu/renderer_gl_context.h" +#include "content/common/gpu/client/content_gl_context.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" @@ -457,7 +457,7 @@ class WebGraphicsContext3DCommandBufferImpl virtual WebKit::WebString getTranslatedShaderSourceANGLE(WebGLId shader); - RendererGLContext* context() { return context_; } + ContentGLContext* context() { return context_; } virtual void setContextLostCallback( WebGraphicsContext3D::WebGraphicsContextLostCallback* callback); @@ -489,12 +489,12 @@ class WebGraphicsContext3DCommandBufferImpl // SwapBuffers callback. void OnSwapBuffersComplete(); - virtual void OnContextLost(RendererGLContext::ContextLostReason reason); + virtual void OnContextLost(ContentGLContext::ContextLostReason reason); bool initialize_failed_; // The context we use for OpenGL rendering. - RendererGLContext* context_; + ContentGLContext* context_; // The GLES2Implementation we use for OpenGL rendering. gpu::gles2::GLES2Implementation* gl_; @@ -530,4 +530,4 @@ class WebGraphicsContext3DCommandBufferImpl #endif }; -#endif // CONTENT_RENDERER_GPU_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ +#endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ diff --git a/content/content_common.gypi b/content/content_common.gypi index ce09c7a..5452982 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -6,6 +6,7 @@ 'dependencies': [ '../base/base.gyp:base', '../build/temp_gyp/googleurl.gyp:googleurl', + '../gpu/gpu.gyp:gles2_implementation', '../gpu/gpu.gyp:gpu_ipc', '../ipc/ipc.gyp:ipc', '../media/media.gyp:media', @@ -144,6 +145,16 @@ 'common/geolocation_messages.h', 'common/geoposition.cc', 'common/geoposition.h', + 'common/gpu/client/command_buffer_proxy.cc', + 'common/gpu/client/command_buffer_proxy.h', + 'common/gpu/client/content_gl_context.cc', + 'common/gpu/client/content_gl_context.h', + 'common/gpu/client/gpu_channel_host.cc', + 'common/gpu/client/gpu_channel_host.h', + 'common/gpu/client/gpu_video_decode_accelerator_host.cc', + 'common/gpu/client/gpu_video_decode_accelerator_host.h', + 'common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc', + 'common/gpu/client/webgraphicscontext3d_command_buffer_impl.h', 'common/gpu/gpu_channel.cc', 'common/gpu/gpu_channel.h', 'common/gpu/gpu_channel_manager.cc', diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi index 95e4977..bae62ff 100644 --- a/content/content_renderer.gypi +++ b/content/content_renderer.gypi @@ -60,16 +60,8 @@ 'renderer/geolocation_dispatcher.h', 'renderer/gpu/compositor_thread.cc', 'renderer/gpu/compositor_thread.h', - 'renderer/gpu/gpu_channel_host.cc', - 'renderer/gpu/gpu_channel_host.h', - 'renderer/gpu/gpu_video_decode_accelerator_host.cc', - 'renderer/gpu/gpu_video_decode_accelerator_host.h', 'renderer/gpu/input_event_filter.cc', 'renderer/gpu/input_event_filter.h', - 'renderer/gpu/renderer_gl_context.cc', - 'renderer/gpu/renderer_gl_context.h', - 'renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc', - 'renderer/gpu/webgraphicscontext3d_command_buffer_impl.h', 'renderer/idle_user_detector.cc', 'renderer/idle_user_detector.h', 'renderer/indexed_db/indexed_db_dispatcher.cc', @@ -218,15 +210,6 @@ 'renderer/p2p/socket_dispatcher.h', ], }], - ['enable_gpu==1', { - 'dependencies': [ - '../gpu/gpu.gyp:gles2_c_lib', - ], - 'sources': [ - 'renderer/gpu/command_buffer_proxy.cc', - 'renderer/gpu/command_buffer_proxy.h', - ], - }], ['toolkit_uses_gtk == 1', { 'conditions': [ [ 'linux_use_tcmalloc==1', { diff --git a/content/renderer/media/pepper_platform_video_decoder_impl.cc b/content/renderer/media/pepper_platform_video_decoder_impl.cc index 8f95666..65ed487 100644 --- a/content/renderer/media/pepper_platform_video_decoder_impl.cc +++ b/content/renderer/media/pepper_platform_video_decoder_impl.cc @@ -9,7 +9,7 @@ #include "base/bind.h" #include "base/logging.h" #include "content/common/child_process.h" -#include "content/renderer/gpu/gpu_channel_host.h" +#include "content/common/gpu/client/gpu_channel_host.h" #include "content/renderer/render_thread_impl.h" using media::BitstreamBuffer; diff --git a/content/renderer/media/renderer_gpu_video_decoder_factories.cc b/content/renderer/media/renderer_gpu_video_decoder_factories.cc index 20a32cf..4d27d59 100644 --- a/content/renderer/media/renderer_gpu_video_decoder_factories.cc +++ b/content/renderer/media/renderer_gpu_video_decoder_factories.cc @@ -7,14 +7,14 @@ #include "base/bind.h" #include "base/synchronization/waitable_event.h" #include "content/common/child_thread.h" -#include "content/renderer/gpu/command_buffer_proxy.h" -#include "content/renderer/gpu/gpu_channel_host.h" -#include "content/renderer/gpu/renderer_gl_context.h" +#include "content/common/gpu/client/command_buffer_proxy.h" +#include "content/common/gpu/client/gpu_channel_host.h" +#include "content/common/gpu/client/content_gl_context.h" #include "gpu/command_buffer/client/gles2_implementation.h" RendererGpuVideoDecoderFactories::~RendererGpuVideoDecoderFactories() {} RendererGpuVideoDecoderFactories::RendererGpuVideoDecoderFactories( - GpuChannelHost* gpu_channel_host, base::WeakPtr<RendererGLContext> context) + GpuChannelHost* gpu_channel_host, base::WeakPtr<ContentGLContext> context) : message_loop_(MessageLoop::current()), gpu_channel_host_(gpu_channel_host), context_(context) { diff --git a/content/renderer/media/renderer_gpu_video_decoder_factories.h b/content/renderer/media/renderer_gpu_video_decoder_factories.h index 5e5715c..0506207 100644 --- a/content/renderer/media/renderer_gpu_video_decoder_factories.h +++ b/content/renderer/media/renderer_gpu_video_decoder_factories.h @@ -14,7 +14,7 @@ #include "ui/gfx/size.h" class GpuChannelHost; -class RendererGLContext; +class ContentGLContext; namespace base { class WaitableEvent; } @@ -33,7 +33,7 @@ class CONTENT_EXPORT RendererGpuVideoDecoderFactories // Takes a ref on |gpu_channel_host| and tests |context| for NULL before each // use. RendererGpuVideoDecoderFactories(GpuChannelHost* gpu_channel_host, - base::WeakPtr<RendererGLContext> context); + base::WeakPtr<ContentGLContext> context); virtual media::VideoDecodeAccelerator* CreateVideoDecodeAccelerator( media::VideoDecodeAccelerator::Profile profile, @@ -69,7 +69,7 @@ class CONTENT_EXPORT RendererGpuVideoDecoderFactories MessageLoop* message_loop_; scoped_refptr<GpuChannelHost> gpu_channel_host_; - base::WeakPtr<RendererGLContext> context_; + base::WeakPtr<ContentGLContext> context_; DISALLOW_IMPLICIT_CONSTRUCTORS(RendererGpuVideoDecoderFactories); }; diff --git a/content/renderer/pepper_parent_context_provider.h b/content/renderer/pepper_parent_context_provider.h index 7a9c6fe..c0a5c75 100644 --- a/content/renderer/pepper_parent_context_provider.h +++ b/content/renderer/pepper_parent_context_provider.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -8,14 +8,14 @@ #include "base/basictypes.h" -class RendererGLContext; +class ContentGLContext; // Defines the mechanism by which a Pepper 3D context fetches its // parent context for display to the screen. class PepperParentContextProvider { public: virtual ~PepperParentContextProvider(); - virtual RendererGLContext* GetParentContextForPlatformContext3D() = 0; + virtual ContentGLContext* GetParentContextForPlatformContext3D() = 0; protected: PepperParentContextProvider(); diff --git a/content/renderer/pepper_platform_context_3d_impl.cc b/content/renderer/pepper_platform_context_3d_impl.cc index cba3c7b..fe5b9d6 100644 --- a/content/renderer/pepper_platform_context_3d_impl.cc +++ b/content/renderer/pepper_platform_context_3d_impl.cc @@ -1,15 +1,15 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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 "content/renderer/pepper_platform_context_3d_impl.h" #include "base/bind.h" +#include "content/common/gpu/client/content_gl_context.h" +#include "content/common/gpu/client/gpu_channel_host.h" +#include "content/common/gpu/client/command_buffer_proxy.h" #include "content/renderer/pepper_parent_context_provider.h" #include "content/renderer/render_thread_impl.h" -#include "content/renderer/gpu/renderer_gl_context.h" -#include "content/renderer/gpu/gpu_channel_host.h" -#include "content/renderer/gpu/command_buffer_proxy.h" #include "googleurl/src/gurl.h" #include "gpu/command_buffer/client/gles2_cmd_helper.h" #include "gpu/command_buffer/client/gles2_implementation.h" @@ -89,13 +89,13 @@ bool PlatformContext3DImpl::Init(const int32* attrib_list) { // we do not need to filter for width and height here. if (attrib_list) { for (const int32_t* attr = attrib_list; - attr[0] != RendererGLContext::NONE; + attr[0] != ContentGLContext::NONE; attr += 2) { switch (attr[0]) { - case RendererGLContext::WIDTH: + case ContentGLContext::WIDTH: surface_size.set_width(attr[1]); break; - case RendererGLContext::HEIGHT: + case ContentGLContext::HEIGHT: surface_size.set_height(attr[1]); break; default: @@ -104,7 +104,7 @@ bool PlatformContext3DImpl::Init(const int32* attrib_list) { break; } } - attribs.push_back(RendererGLContext::NONE); + attribs.push_back(ContentGLContext::NONE); } command_buffer_ = channel_->CreateOffscreenCommandBuffer( @@ -124,7 +124,7 @@ bool PlatformContext3DImpl::Init(const int32* attrib_list) { // Fetch the parent context now, after any potential shutdown of the // channel due to GPU switching, and creation of the Pepper 3D // context with the discrete GPU preference. - RendererGLContext* parent_context = + ContentGLContext* parent_context = parent_context_provider_->GetParentContextForPlatformContext3D(); if (!parent_context) return false; diff --git a/content/renderer/pepper_platform_context_3d_impl.h b/content/renderer/pepper_platform_context_3d_impl.h index cac5c3c..c75d7d8 100644 --- a/content/renderer/pepper_platform_context_3d_impl.h +++ b/content/renderer/pepper_platform_context_3d_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. #ifndef CONTENT_RENDERER_PEPPER_PLATFORM_CONTEXT_3D_IMPL_H_ @@ -20,7 +20,7 @@ class CommandBuffer; class CommandBufferProxy; class GpuChannelHost; class PepperParentContextProvider; -class RendererGLContext; +class ContentGLContext; class PlatformContext3DImpl : public webkit::ppapi::PluginDelegate::PlatformContext3D { @@ -42,7 +42,7 @@ class PlatformContext3DImpl // Implicitly weak pointer; must outlive this instance. PepperParentContextProvider* parent_context_provider_; - base::WeakPtr<RendererGLContext> parent_context_; + base::WeakPtr<ContentGLContext> parent_context_; scoped_refptr<GpuChannelHost> channel_; unsigned int parent_texture_id_; CommandBufferProxy* command_buffer_; diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc index 9946b6a..1f7ffc0 100644 --- a/content/renderer/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper_plugin_delegate_impl.cc @@ -23,6 +23,8 @@ #include "content/common/child_thread.h" #include "content/common/file_system/file_system_dispatcher.h" #include "content/common/file_system_messages.h" +#include "content/common/gpu/client/content_gl_context.h" +#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" #include "content/common/media/audio_messages.h" #include "content/common/pepper_file_messages.h" #include "content/common/pepper_plugin_registry.h" @@ -32,10 +34,6 @@ #include "content/public/common/content_switches.h" #include "content/public/renderer/content_renderer_client.h" #include "content/renderer/gamepad_shared_memory_reader.h" -#include "content/renderer/gpu/command_buffer_proxy.h" -#include "content/renderer/gpu/gpu_channel_host.h" -#include "content/renderer/gpu/renderer_gl_context.h" -#include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" #include "content/renderer/media/audio_input_message_filter.h" #include "content/renderer/media/audio_message_filter.h" #include "content/renderer/media/pepper_platform_video_decoder_impl.h" @@ -2069,7 +2067,7 @@ int PepperPluginDelegateImpl::GetRoutingId() const { return render_view_->routing_id(); } -RendererGLContext* +ContentGLContext* PepperPluginDelegateImpl::GetParentContextForPlatformContext3D() { WebGraphicsContext3DCommandBufferImpl* context = static_cast<WebGraphicsContext3DCommandBufferImpl*>( @@ -2079,7 +2077,7 @@ PepperPluginDelegateImpl::GetParentContextForPlatformContext3D() { if (!context->makeContextCurrent() || context->isContextLost()) return NULL; - RendererGLContext* parent_context = context->context(); + ContentGLContext* parent_context = context->context(); if (!parent_context) return NULL; return parent_context; diff --git a/content/renderer/pepper_plugin_delegate_impl.h b/content/renderer/pepper_plugin_delegate_impl.h index 1cba5eb..d7ff488 100644 --- a/content/renderer/pepper_plugin_delegate_impl.h +++ b/content/renderer/pepper_plugin_delegate_impl.h @@ -431,7 +431,7 @@ class PepperPluginDelegateImpl webkit::ppapi::PluginModule* plugin_module); // Implementation of PepperParentContextProvider. - virtual RendererGLContext* GetParentContextForPlatformContext3D() OVERRIDE; + virtual ContentGLContext* GetParentContextForPlatformContext3D() OVERRIDE; // Helper function to check that TCP/UDP private APIs are allowed for current // page. This check actually allows socket usage for NativeClient code only. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 064f080..0bac61a 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -26,6 +26,7 @@ #include "content/common/database_messages.h" #include "content/common/db_message_filter.h" #include "content/common/dom_storage_messages.h" +#include "content/common/gpu/client/gpu_channel_host.h" #include "content/common/gpu/gpu_messages.h" #include "content/common/npobject_util.h" #include "content/common/plugin_messages.h" @@ -40,7 +41,6 @@ #include "content/public/renderer/render_view_visitor.h" #include "content/renderer/devtools_agent_filter.h" #include "content/renderer/gpu/compositor_thread.h" -#include "content/renderer/gpu/gpu_channel_host.h" #include "content/renderer/indexed_db/indexed_db_dispatcher.h" #include "content/renderer/indexed_db/indexed_db_message_filter.h" #include "content/renderer/indexed_db/renderer_webidbfactory_impl.h" diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index b69bea3..b3cc602 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h @@ -18,9 +18,9 @@ #include "content/common/child_thread.h" #include "content/common/content_export.h" #include "content/common/css_colors.h" +#include "content/common/gpu/client/gpu_channel_host.h" #include "content/common/gpu/gpu_process_launch_causes.h" #include "content/public/renderer/render_thread.h" -#include "content/renderer/gpu/gpu_channel_host.h" #include "ipc/ipc_channel_proxy.h" #include "ui/gfx/native_widget_types.h" diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 71cbefe..1434e76 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -31,6 +31,7 @@ #include "content/common/drag_messages.h" #include "content/common/file_system/file_system_dispatcher.h" #include "content/common/file_system/webfilesystem_callback_dispatcher.h" +#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" #include "content/common/intents_messages.h" #include "content/common/java_bridge_messages.h" #include "content/common/pepper_messages.h" @@ -53,7 +54,6 @@ #include "content/renderer/dom_automation_controller.h" #include "content/renderer/external_popup_menu.h" #include "content/renderer/geolocation_dispatcher.h" -#include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" #include "content/renderer/idle_user_detector.h" #include "content/renderer/web_intents_host.h" #include "content/renderer/java/java_bridge_dispatcher.h" diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index 66e7dde..bb88d79 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -25,13 +25,13 @@ #include "content/renderer/renderer_webcookiejar_impl.h" #include "content/common/content_export.h" #include "content/common/edit_command.h" +#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" #include "content/common/navigation_gesture.h" #include "content/public/common/page_zoom.h" #include "content/public/common/referrer.h" #include "content/public/common/renderer_preferences.h" #include "content/public/common/stop_find_action.h" #include "content/public/renderer/render_view.h" -#include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" #include "content/renderer/pepper_plugin_delegate_impl.h" #include "content/renderer/render_widget.h" #include "ipc/ipc_platform_file.h" diff --git a/content/renderer/render_widget_fullscreen_pepper.cc b/content/renderer/render_widget_fullscreen_pepper.cc index 35c9437e..aa1ffc7 100644 --- a/content/renderer/render_widget_fullscreen_pepper.cc +++ b/content/renderer/render_widget_fullscreen_pepper.cc @@ -6,8 +6,8 @@ #include "base/bind.h" #include "base/message_loop.h" +#include "content/common/gpu/client/gpu_channel_host.h" #include "content/common/view_messages.h" -#include "content/renderer/gpu/gpu_channel_host.h" #include "content/renderer/pepper_platform_context_3d_impl.h" #include "content/renderer/render_thread_impl.h" #include "gpu/command_buffer/client/gles2_implementation.h" @@ -86,7 +86,7 @@ class PepperWidget : public WebWidget { if (!widget_->plugin()) return; - RendererGLContext* context = widget_->context(); + ContentGLContext* context = widget_->context(); DCHECK(context); gpu::gles2::GLES2Implementation* gl = context->GetImplementation(); unsigned int texture = widget_->plugin()->GetBackingTextureId(); @@ -201,7 +201,7 @@ class PepperWidget : public WebWidget { DISALLOW_COPY_AND_ASSIGN(PepperWidget); }; -void DestroyContext(RendererGLContext* context, GLuint program, GLuint buffer) { +void DestroyContext(ContentGLContext* context, GLuint program, GLuint buffer) { DCHECK(context); gpu::gles2::GLES2Implementation* gl = context->GetImplementation(); if (program) @@ -344,16 +344,16 @@ void RenderWidgetFullscreenPepper::CreateContext() { if (!host) return; const int32 attribs[] = { - RendererGLContext::ALPHA_SIZE, 8, - RendererGLContext::DEPTH_SIZE, 0, - RendererGLContext::STENCIL_SIZE, 0, - RendererGLContext::SAMPLES, 0, - RendererGLContext::SAMPLE_BUFFERS, 0, - RendererGLContext::SHARE_RESOURCES, 0, - RendererGLContext::BIND_GENERATES_RESOURCES, 1, - RendererGLContext::NONE, + ContentGLContext::ALPHA_SIZE, 8, + ContentGLContext::DEPTH_SIZE, 0, + ContentGLContext::STENCIL_SIZE, 0, + ContentGLContext::SAMPLES, 0, + ContentGLContext::SAMPLE_BUFFERS, 0, + ContentGLContext::SHARE_RESOURCES, 0, + ContentGLContext::BIND_GENERATES_RESOURCES, 1, + ContentGLContext::NONE, }; - context_ = RendererGLContext::CreateViewContext( + context_ = ContentGLContext::CreateViewContext( host, surface_id(), NULL, @@ -487,7 +487,7 @@ void RenderWidgetFullscreenPepper::SwapBuffers() { OnSwapBuffersPosted(); context_->SwapBuffers(); context_->Echo(base::Bind( - &RenderWidgetFullscreenPepper::OnSwapBuffersCompleteByRendererGLContext, + &RenderWidgetFullscreenPepper::OnSwapBuffersCompleteByContentGLContext, weak_ptr_factory_.GetWeakPtr())); // The compositor isn't actually active in this path, but pretend it is for @@ -496,7 +496,7 @@ void RenderWidgetFullscreenPepper::SwapBuffers() { } void RenderWidgetFullscreenPepper::OnLostContext( - RendererGLContext::ContextLostReason) { + ContentGLContext::ContextLostReason) { if (!context_) return; // Destroy the context later, in case we got called from InitContext for @@ -512,11 +512,11 @@ void RenderWidgetFullscreenPepper::OnLostContext( CheckCompositing(); } -void RenderWidgetFullscreenPepper::OnSwapBuffersCompleteByRendererGLContext() { +void RenderWidgetFullscreenPepper::OnSwapBuffersCompleteByContentGLContext() { OnSwapBuffersComplete(); } -RendererGLContext* +ContentGLContext* RenderWidgetFullscreenPepper::GetParentContextForPlatformContext3D() { if (!context_) { CreateContext(); diff --git a/content/renderer/render_widget_fullscreen_pepper.h b/content/renderer/render_widget_fullscreen_pepper.h index 9179668..ede1819 100644 --- a/content/renderer/render_widget_fullscreen_pepper.h +++ b/content/renderer/render_widget_fullscreen_pepper.h @@ -6,9 +6,9 @@ #define CONTENT_RENDERER_RENDER_WIDGET_FULLSCREEN_PEPPER_H_ #include "base/memory/weak_ptr.h" +#include "content/common/gpu/client/content_gl_context.h" #include "content/renderer/pepper_parent_context_provider.h" #include "content/renderer/render_widget_fullscreen.h" -#include "content/renderer/gpu/renderer_gl_context.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" #include "webkit/plugins/ppapi/fullscreen_container.h" @@ -41,7 +41,7 @@ class RenderWidgetFullscreenPepper : public RenderWidgetFullscreen, virtual webkit::ppapi::PluginDelegate::PlatformContext3D* CreateContext3D() OVERRIDE; - RendererGLContext* context() const { return context_; } + ContentGLContext* context() const { return context_; } void SwapBuffers(); // Could be NULL when this widget is closing. @@ -83,14 +83,14 @@ class RenderWidgetFullscreenPepper : public RenderWidgetFullscreen, bool CheckCompositing(); // Called when the compositing context gets lost. - void OnLostContext(RendererGLContext::ContextLostReason); + void OnLostContext(ContentGLContext::ContextLostReason); - // Binding of RendererGLContext swapbuffers callback to + // Binding of ContentGLContext swapbuffers callback to // RenderWidget::OnSwapBuffersCompleted. - void OnSwapBuffersCompleteByRendererGLContext(); + void OnSwapBuffersCompleteByContentGLContext(); // Implementation of PepperParentContextProvider. - virtual RendererGLContext* GetParentContextForPlatformContext3D() OVERRIDE; + virtual ContentGLContext* GetParentContextForPlatformContext3D() OVERRIDE; // URL that is responsible for this widget, passed to ggl::CreateViewContext. GURL active_url_; @@ -99,7 +99,7 @@ class RenderWidgetFullscreenPepper : public RenderWidgetFullscreen, webkit::ppapi::PluginInstance* plugin_; // GL context for compositing. - RendererGLContext* context_; + ContentGLContext* context_; unsigned int buffer_; unsigned int program_; diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc index 1c57670..ce8e3d7 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.cc +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc @@ -13,6 +13,7 @@ #include "content/common/database_util.h" #include "content/common/file_system/webfilesystem_impl.h" #include "content/common/file_utilities_messages.h" +#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" #include "content/common/mime_registry_messages.h" #include "content/common/npobject_util.h" #include "content/common/view_messages.h" @@ -21,7 +22,6 @@ #include "content/public/common/content_switches.h" #include "content/public/renderer/content_renderer_client.h" #include "content/renderer/gamepad_shared_memory_reader.h" -#include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" #include "content/renderer/indexed_db/renderer_webidbfactory_impl.h" #include "content/renderer/media/audio_device.h" #include "content/renderer/media/audio_hardware.h" diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc index 5553439..890003c 100644 --- a/content/renderer/webplugin_delegate_proxy.cc +++ b/content/renderer/webplugin_delegate_proxy.cc @@ -29,7 +29,6 @@ #include "content/common/plugin_messages.h" #include "content/common/view_messages.h" #include "content/public/renderer/content_renderer_client.h" -#include "content/renderer/gpu/command_buffer_proxy.h" #include "content/renderer/plugin_channel_host.h" #include "content/renderer/render_thread_impl.h" #include "content/renderer/render_view_impl.h" |