summaryrefslogtreecommitdiffstats
path: root/content/common/gpu/client
diff options
context:
space:
mode:
authorpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-12 19:51:22 +0000
committerpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-12 19:51:22 +0000
commit9193034b79e3dea131a859e136302cf5ec3e44ff (patch)
treecc0250a101b32c945172ae4108e1ad1b26474a37 /content/common/gpu/client
parent6dfa3014196eb06386074ea2a15906921ce12e4f (diff)
downloadchromium_src-9193034b79e3dea131a859e136302cf5ec3e44ff.zip
chromium_src-9193034b79e3dea131a859e136302cf5ec3e44ff.tar.gz
chromium_src-9193034b79e3dea131a859e136302cf5ec3e44ff.tar.bz2
Fix --single-process mode issues with GpuChannelHostFactory
GpuChannelHostFactory itself is no longer a singleton, we pass it explicitly to WebGraphicsContext3DCommandBufferImpl. That prevents RenderThreadImpl and BrowserGpuChannelHostFactory from stomping on each other in --single-process mode BUG=117594 TEST=see bug Review URL: http://codereview.chromium.org/9667012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126194 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/gpu/client')
-rw-r--r--content/common/gpu/client/gpu_channel_host.cc6
-rw-r--r--content/common/gpu/client/gpu_channel_host.h11
-rw-r--r--content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc10
-rw-r--r--content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h5
4 files changed, 11 insertions, 21 deletions
diff --git a/content/common/gpu/client/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc
index 1a83423..bb9ccd6 100644
--- a/content/common/gpu/client/gpu_channel_host.cc
+++ b/content/common/gpu/client/gpu_channel_host.cc
@@ -12,12 +12,6 @@
#include "googleurl/src/gurl.h"
#include "ipc/ipc_sync_message_filter.h"
-GpuChannelHostFactory* GpuChannelHostFactory::instance_ = NULL;
-
-GpuChannelHostFactory::~GpuChannelHostFactory() {
- DCHECK(!instance_);
-}
-
using base::AutoLock;
using base::MessageLoopProxy;
diff --git a/content/common/gpu/client/gpu_channel_host.h b/content/common/gpu/client/gpu_channel_host.h
index ef8e438..0a4e178 100644
--- a/content/common/gpu/client/gpu_channel_host.h
+++ b/content/common/gpu/client/gpu_channel_host.h
@@ -51,8 +51,7 @@ struct GpuListenerInfo {
class CONTENT_EXPORT GpuChannelHostFactory {
public:
- virtual ~GpuChannelHostFactory();
- static GpuChannelHostFactory* instance() { return instance_; }
+ virtual ~GpuChannelHostFactory() {}
virtual bool IsMainThread() = 0;
virtual bool IsIOThread() = 0;
@@ -64,14 +63,6 @@ class CONTENT_EXPORT GpuChannelHostFactory {
int32 surface_id, const GPUCreateCommandBufferConfig& init_params) = 0;
virtual GpuChannelHost* EstablishGpuChannelSync(
content::CauseForGpuLaunch) = 0;
-
- protected:
- static void set_instance(GpuChannelHostFactory* instance) {
- instance_ = instance;
- }
-
- private:
- static GpuChannelHostFactory* instance_;
};
// Encapsulates an IPC channel between the client and one GPU process.
diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
index c2f6d60..6ce0afa 100644
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
@@ -48,8 +48,10 @@ void ClearSharedContexts() {
WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl(
int surface_id,
const GURL& active_url,
+ GpuChannelHostFactory* factory,
const base::WeakPtr<WebGraphicsContext3DSwapBuffersClient>& swap_client)
: initialize_failed_(false),
+ factory_(factory),
context_(NULL),
gl_(NULL),
host_(NULL),
@@ -88,8 +90,7 @@ bool WebGraphicsContext3DCommandBufferImpl::Initialize(
const WebGraphicsContext3D::Attributes& attributes) {
DCHECK(!context_);
TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::initialize");
- GpuChannelHostFactory* factory = GpuChannelHostFactory::instance();
- if (!factory)
+ if (!factory_)
return false;
if (attributes.preferDiscreteGPU)
@@ -99,7 +100,7 @@ bool WebGraphicsContext3DCommandBufferImpl::Initialize(
// Note similar code in Pepper PlatformContext3DImpl::Init.
do {
- host_ = factory->EstablishGpuChannelSync(
+ host_ = factory_->EstablishGpuChannelSync(
content::
CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE);
if (!host_)
@@ -1113,8 +1114,7 @@ void WebGraphicsContext3DCommandBufferImpl::deleteTexture(WebGLId texture) {
}
bool WebGraphicsContext3DCommandBufferImpl::ShouldUseSwapClient() {
- GpuChannelHostFactory* factory = GpuChannelHostFactory::instance();
- return factory && factory->IsMainThread() && swap_client_.get();
+ return factory_ && factory_->IsMainThread() && swap_client_.get();
}
void WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete() {
diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h
index 31a5c81..7b0755b 100644
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h
@@ -24,6 +24,7 @@
#endif
class GpuChannelHost;
+class GpuChannelHostFactory;
namespace gpu {
namespace gles2 {
@@ -61,6 +62,7 @@ class WebGraphicsContext3DCommandBufferImpl
WebGraphicsContext3DCommandBufferImpl(
int surface_id,
const GURL& active_url,
+ GpuChannelHostFactory* factory,
const base::WeakPtr<WebGraphicsContext3DSwapBuffersClient>& swap_client);
virtual ~WebGraphicsContext3DCommandBufferImpl();
@@ -509,6 +511,9 @@ class WebGraphicsContext3DCommandBufferImpl
bool initialize_failed_;
+ // The channel factory to talk to the GPU process
+ GpuChannelHostFactory* factory_;
+
// The context we use for OpenGL rendering.
ContentGLContext* context_;
// The GLES2Implementation we use for OpenGL rendering.