summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-03 18:59:43 +0000
committerteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-03 18:59:43 +0000
commit054bd377c94c57d3a38143cbb06b5a9aff6ed637 (patch)
treecf988ef20e33971c477b4e1ff2bdfb06fc9aae59
parent56a58b31c17db18a299a6a2cb21a953891ba7ff3 (diff)
downloadchromium_src-054bd377c94c57d3a38143cbb06b5a9aff6ed637.zip
chromium_src-054bd377c94c57d3a38143cbb06b5a9aff6ed637.tar.gz
chromium_src-054bd377c94c57d3a38143cbb06b5a9aff6ed637.tar.bz2
Remove GpuChannelHostFactory::GetShutDownEvent().
I'd like to add GetShutDownEvent() to RenderThread. However, that would cause RenderThreadImpl to have two base classes specify that method, which is pretty weird. This removes GpuChannelHostFactory::GetShutDownEvent() and provides the shutdown event in the GpuChannelHost constructor instead. BUG= Review URL: https://codereview.chromium.org/181413003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254515 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/gpu/browser_gpu_channel_host_factory.cc7
-rw-r--r--content/browser/gpu/browser_gpu_channel_host_factory.h1
-rw-r--r--content/common/gpu/client/gpu_channel_host.cc16
-rw-r--r--content/common/gpu/client/gpu_channel_host.h8
-rw-r--r--content/renderer/render_thread_impl.cc10
-rw-r--r--content/renderer/render_thread_impl.h2
6 files changed, 18 insertions, 26 deletions
diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc
index 5faf7ba..59e390b 100644
--- a/content/browser/gpu/browser_gpu_channel_host_factory.cc
+++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc
@@ -183,10 +183,6 @@ BrowserGpuChannelHostFactory::GetIOLoopProxy() {
return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
}
-base::WaitableEvent* BrowserGpuChannelHostFactory::GetShutDownEvent() {
- return shutdown_event_.get();
-}
-
scoped_ptr<base::SharedMemory>
BrowserGpuChannelHostFactory::AllocateSharedMemory(size_t size) {
scoped_ptr<base::SharedMemory> shm(new base::SharedMemory());
@@ -360,7 +356,8 @@ void BrowserGpuChannelHostFactory::GpuChannelEstablished() {
GetContentClient()->SetGpuInfo(pending_request_->gpu_info());
gpu_channel_ = GpuChannelHost::Create(this,
pending_request_->gpu_info(),
- pending_request_->channel_handle());
+ pending_request_->channel_handle(),
+ shutdown_event_.get());
gpu_host_id_ = pending_request_->gpu_host_id();
pending_request_ = NULL;
diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.h b/content/browser/gpu/browser_gpu_channel_host_factory.h
index 8b461e4..89ff9ec 100644
--- a/content/browser/gpu/browser_gpu_channel_host_factory.h
+++ b/content/browser/gpu/browser_gpu_channel_host_factory.h
@@ -27,7 +27,6 @@ class CONTENT_EXPORT BrowserGpuChannelHostFactory
virtual bool IsMainThread() OVERRIDE;
virtual base::MessageLoop* GetMainLoop() OVERRIDE;
virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() OVERRIDE;
- virtual base::WaitableEvent* GetShutDownEvent() OVERRIDE;
virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(
size_t size) OVERRIDE;
virtual int32 CreateViewCommandBuffer(
diff --git a/content/common/gpu/client/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc
index 78130b4..05ee4d8 100644
--- a/content/common/gpu/client/gpu_channel_host.cc
+++ b/content/common/gpu/client/gpu_channel_host.cc
@@ -35,11 +35,11 @@ GpuListenerInfo::~GpuListenerInfo() {}
scoped_refptr<GpuChannelHost> GpuChannelHost::Create(
GpuChannelHostFactory* factory,
const gpu::GPUInfo& gpu_info,
- const IPC::ChannelHandle& channel_handle) {
+ const IPC::ChannelHandle& channel_handle,
+ base::WaitableEvent* shutdown_event) {
DCHECK(factory->IsMainThread());
- scoped_refptr<GpuChannelHost> host = new GpuChannelHost(
- factory, gpu_info);
- host->Connect(channel_handle);
+ scoped_refptr<GpuChannelHost> host = new GpuChannelHost(factory, gpu_info);
+ host->Connect(channel_handle, shutdown_event);
return host;
}
@@ -65,7 +65,8 @@ GpuChannelHost::GpuChannelHost(GpuChannelHostFactory* factory,
next_gpu_memory_buffer_id_.GetNext();
}
-void GpuChannelHost::Connect(const IPC::ChannelHandle& channel_handle) {
+void GpuChannelHost::Connect(const IPC::ChannelHandle& channel_handle,
+ base::WaitableEvent* shutdown_event) {
// 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.
scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy();
@@ -74,10 +75,9 @@ void GpuChannelHost::Connect(const IPC::ChannelHandle& channel_handle) {
NULL,
io_loop.get(),
true,
- factory_->GetShutDownEvent()));
+ shutdown_event));
- sync_filter_ = new IPC::SyncMessageFilter(
- factory_->GetShutDownEvent());
+ sync_filter_ = new IPC::SyncMessageFilter(shutdown_event);
channel_->AddFilter(sync_filter_.get());
diff --git a/content/common/gpu/client/gpu_channel_host.h b/content/common/gpu/client/gpu_channel_host.h
index cba8de4..e073db0 100644
--- a/content/common/gpu/client/gpu_channel_host.h
+++ b/content/common/gpu/client/gpu_channel_host.h
@@ -36,6 +36,7 @@ struct GPUCreateCommandBufferConfig;
namespace base {
class MessageLoop;
class MessageLoopProxy;
+class WaitableEvent;
}
namespace IPC {
@@ -63,7 +64,6 @@ class CONTENT_EXPORT GpuChannelHostFactory {
virtual bool IsMainThread() = 0;
virtual base::MessageLoop* GetMainLoop() = 0;
virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0;
- virtual base::WaitableEvent* GetShutDownEvent() = 0;
virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0;
virtual int32 CreateViewCommandBuffer(
int32 surface_id, const GPUCreateCommandBufferConfig& init_params) = 0;
@@ -89,7 +89,8 @@ class GpuChannelHost : public IPC::Sender,
static scoped_refptr<GpuChannelHost> Create(
GpuChannelHostFactory* factory,
const gpu::GPUInfo& gpu_info,
- const IPC::ChannelHandle& channel_handle);
+ const IPC::ChannelHandle& channel_handle,
+ base::WaitableEvent* shutdown_event);
// Returns true if |handle| is a valid GpuMemoryBuffer handle that
// can be shared to the GPU process.
@@ -162,7 +163,8 @@ class GpuChannelHost : public IPC::Sender,
GpuChannelHost(GpuChannelHostFactory* factory,
const gpu::GPUInfo& gpu_info);
virtual ~GpuChannelHost();
- void Connect(const IPC::ChannelHandle& channel_handle);
+ void Connect(const IPC::ChannelHandle& channel_handle,
+ base::WaitableEvent* shutdown_event);
// A filter used internally to route incoming messages from the IO thread
// to the correct message loop. It also maintains some shared state between
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 3ed95cf..4ad19fe 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -338,7 +338,6 @@ void RenderThreadImpl::Init() {
idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs;
idle_notifications_to_skip_ = 0;
layout_test_mode_ = false;
- shutdown_event_ = NULL;
appcache_dispatcher_.reset(
new AppCacheDispatcher(Get(), new AppCacheFrontendImpl()));
@@ -1052,10 +1051,6 @@ scoped_refptr<base::MessageLoopProxy> RenderThreadImpl::GetIOLoopProxy() {
return io_message_loop_proxy_;
}
-base::WaitableEvent* RenderThreadImpl::GetShutDownEvent() {
- return shutdown_event_;
-}
-
scoped_ptr<base::SharedMemory> RenderThreadImpl::AllocateSharedMemory(
size_t size) {
return scoped_ptr<base::SharedMemory>(
@@ -1230,9 +1225,10 @@ GpuChannelHost* RenderThreadImpl::EstablishGpuChannelSync(
// Cache some variables that are needed on the compositor thread for our
// implementation of GpuChannelHostFactory.
io_message_loop_proxy_ = ChildProcess::current()->io_message_loop_proxy();
- shutdown_event_ = ChildProcess::current()->GetShutDownEvent();
- gpu_channel_ = GpuChannelHost::Create(this, gpu_info, channel_handle);
+ gpu_channel_ = GpuChannelHost::Create(
+ this, gpu_info, channel_handle,
+ ChildProcess::current()->GetShutDownEvent());
return gpu_channel_.get();
}
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index a613484..9172f97 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -358,7 +358,6 @@ class CONTENT_EXPORT RenderThreadImpl : public RenderThread,
virtual bool IsMainThread() OVERRIDE;
virtual base::MessageLoop* GetMainLoop() OVERRIDE;
virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() OVERRIDE;
- virtual base::WaitableEvent* GetShutDownEvent() OVERRIDE;
virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(
size_t size) OVERRIDE;
virtual int32 CreateViewCommandBuffer(
@@ -462,7 +461,6 @@ class CONTENT_EXPORT RenderThreadImpl : public RenderThread,
// Cache of variables that are needed on the compositor thread by
// GpuChannelHostFactory methods.
scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
- base::WaitableEvent* shutdown_event_;
// A lazily initiated thread on which file operations are run.
scoped_ptr<base::Thread> file_thread_;