summaryrefslogtreecommitdiffstats
path: root/content/renderer
diff options
context:
space:
mode:
authorsievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-08 22:14:58 +0000
committersievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-08 22:14:58 +0000
commit73db0ea0cac05b2d591d21750a9b41a89e33c07b (patch)
tree7a3a531b4eb3bdb87bddb579c19a91188cb11fbd /content/renderer
parente533811574240de86fef308ad0ce0bd6d2d6a2ac (diff)
downloadchromium_src-73db0ea0cac05b2d591d21750a9b41a89e33c07b.zip
chromium_src-73db0ea0cac05b2d591d21750a9b41a89e33c07b.tar.gz
chromium_src-73db0ea0cac05b2d591d21750a9b41a89e33c07b.tar.bz2
Fix logic in GpuChannelHost::Send() during shutdown.
RenderThread::current() returns NULL after the ~AtExitManager() has processed its callbacks. However, contexts still referencing GpuChannelHost might get destroyed on the main thread only until later. In that case we want to avoid using the sync filter. Also fix unreached code/leak while the channel is gone. BUG=95734 Review URL: http://codereview.chromium.org/7841053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100274 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r--content/renderer/gpu/gpu_channel_host.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/content/renderer/gpu/gpu_channel_host.cc b/content/renderer/gpu/gpu_channel_host.cc
index d822316..00995ac 100644
--- a/content/renderer/gpu/gpu_channel_host.cc
+++ b/content/renderer/gpu/gpu_channel_host.cc
@@ -179,12 +179,18 @@ bool GpuChannelHost::Send(IPC::Message* message) {
// preserve order.
message->set_unblock(false);
- // Unfortunately a sync filter cannot be used on the main (listener) thread.
- // TODO: Is that true even when we don't install a listener?
+ // Currently we need to choose between two different mechanisms for sending.
+ // On the main thread we use the regular channel Send() method, on another
+ // thread we use SyncMessageFilter. We also have to be careful interpreting
+ // RenderThread::current() since it might return NULL during shutdown, while
+ // we are actually calling from the main thread (discard message then).
+ //
+ // TODO: Can we just always use sync_filter_ since we setup the channel
+ // without a main listener?
if (RenderThread::current()) {
if (channel_.get())
return channel_->Send(message);
- } else {
+ } else if (MessageLoop::current()) {
return sync_filter_->Send(message);
}