Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4891)

Unified Diff: content/renderer/render_thread_impl.cc

Issue 17741010: Make ChildThread::current() and ChildProcess::current() only work on the main thread of the child... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync and also fix gpu single process case Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« content/child/child_thread.cc ('K') | « content/renderer/render_thread_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_thread_impl.cc
===================================================================
--- content/renderer/render_thread_impl.cc (revision 208740)
+++ content/renderer/render_thread_impl.cc (working copy)
@@ -34,6 +34,7 @@
#include "content/child/plugin_messages.h"
#include "content/child/resource_dispatcher.h"
#include "content/child/runtime_features.h"
+#include "content/child/thread_safe_sender.h"
#include "content/child/web_database_observer_impl.h"
#include "content/common/child_process_messages.h"
#include "content/common/database_messages.h"
@@ -344,6 +345,7 @@
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 appcache::AppCacheFrontendImpl()));
@@ -1004,17 +1006,6 @@
#endif // OS_WIN
-bool RenderThreadImpl::IsWebFrameValid(WebKit::WebFrame* web_frame) {
- if (!web_frame)
- return false; // We must be shutting down.
-
- RenderViewImpl* render_view = RenderViewImpl::FromWebView(web_frame->view());
- if (!render_view)
- return false; // We must be shutting down.
-
- return true;
-}
-
bool RenderThreadImpl::IsMainThread() {
return !!current();
}
@@ -1024,11 +1015,11 @@
}
scoped_refptr<base::MessageLoopProxy> RenderThreadImpl::GetIOLoopProxy() {
- return ChildProcess::current()->io_message_loop_proxy();
+ return io_message_loop_proxy_;
}
base::WaitableEvent* RenderThreadImpl::GetShutDownEvent() {
- return ChildProcess::current()->GetShutDownEvent();
+ return shutdown_event_;
}
scoped_ptr<base::SharedMemory> RenderThreadImpl::AllocateSharedMemory(
@@ -1051,10 +1042,7 @@
&route_id);
// Allow calling this from the compositor thread.
- if (base::MessageLoop::current() == message_loop())
- ChildThread::Send(message);
- else
- sync_message_filter()->Send(message);
+ thread_safe_sender()->Send(message);
return route_id;
}
@@ -1168,6 +1156,12 @@
}
GetContentClient()->SetGpuInfo(gpu_info);
+
+ // 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, 0, client_id, gpu_info, channel_handle);
return gpu_channel_.get();
« content/child/child_thread.cc ('K') | « content/renderer/render_thread_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698