diff options
Diffstat (limited to 'content/browser/gpu')
-rw-r--r-- | content/browser/gpu/browser_gpu_channel_host_factory.cc | 13 | ||||
-rw-r--r-- | content/browser/gpu/browser_gpu_channel_host_factory.h | 6 |
2 files changed, 8 insertions, 11 deletions
diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc index 687ef0c..5f20475 100644 --- a/content/browser/gpu/browser_gpu_channel_host_factory.cc +++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc @@ -15,6 +15,8 @@ namespace content { +BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::instance_ = NULL; + BrowserGpuChannelHostFactory::CreateRequest::CreateRequest() : event(false, false), route_id(MSG_ROUTING_NONE) { @@ -32,27 +34,22 @@ BrowserGpuChannelHostFactory::EstablishRequest::~EstablishRequest() { } void BrowserGpuChannelHostFactory::Initialize() { - new BrowserGpuChannelHostFactory(); + instance_ = new BrowserGpuChannelHostFactory(); } void BrowserGpuChannelHostFactory::Terminate() { - delete instance(); -} - -BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::Get() { - return static_cast<BrowserGpuChannelHostFactory*>(instance()); + delete instance_; + instance_ = NULL; } BrowserGpuChannelHostFactory::BrowserGpuChannelHostFactory() : gpu_client_id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), shutdown_event_(new base::WaitableEvent(true, false)), gpu_host_id_(0) { - set_instance(this); } BrowserGpuChannelHostFactory::~BrowserGpuChannelHostFactory() { shutdown_event_->Signal(); - set_instance(NULL); } bool BrowserGpuChannelHostFactory::IsMainThread() { diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.h b/content/browser/gpu/browser_gpu_channel_host_factory.h index f9a7bd6..cfb4e6a 100644 --- a/content/browser/gpu/browser_gpu_channel_host_factory.h +++ b/content/browser/gpu/browser_gpu_channel_host_factory.h @@ -19,7 +19,7 @@ class BrowserGpuChannelHostFactory : public GpuChannelHostFactory { public: static void Initialize(); static void Terminate(); - static BrowserGpuChannelHostFactory* Get(); + static BrowserGpuChannelHostFactory* instance() { return instance_; } // GpuChannelHostFactory implementation. virtual bool IsMainThread() OVERRIDE; @@ -35,8 +35,6 @@ class BrowserGpuChannelHostFactory : public GpuChannelHostFactory { virtual GpuChannelHost* EstablishGpuChannelSync( CauseForGpuLaunch cause_for_gpu_launch) OVERRIDE; - int gpu_client_id() { return gpu_client_id_; } - private: struct CreateRequest { CreateRequest(); @@ -75,6 +73,8 @@ class BrowserGpuChannelHostFactory : public GpuChannelHostFactory { scoped_refptr<GpuChannelHost> gpu_channel_; int gpu_host_id_; + static BrowserGpuChannelHostFactory* instance_; + DISALLOW_COPY_AND_ASSIGN(BrowserGpuChannelHostFactory); }; |