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

Unified Diff: content/child/child_thread_impl.cc

Issue 2159123002: Shutdown renderer main message loop before blink::shutdown() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split out blink::Platform::initialize from blink::initialize Created 4 years, 4 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
Index: content/child/child_thread_impl.cc
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc
index 6f7360358daae3d50a0eaaa168e18618227b1be3..7bede89965a056502c58608b854e5f356f6fae3b 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -402,6 +402,7 @@ void ChildThreadImpl::Init(const Options& options) {
g_lazy_tls.Pointer()->Set(this);
on_channel_error_called_ = false;
message_loop_ = base::MessageLoop::current();
+ main_task_runner_ = message_loop_->task_runner();
#ifdef IPC_MESSAGE_LOG_ENABLED
// We must make sure to instantiate the IPC Logger *before* we create the
// channel, otherwise we can get a callback on the IO thread which creates
@@ -464,7 +465,7 @@ void ChildThreadImpl::Init(const Options& options) {
sync_message_filter_ = channel_->CreateSyncMessageFilter();
thread_safe_sender_ = new ThreadSafeSender(
- message_loop_->task_runner(), sync_message_filter_.get());
+ main_task_runner_, sync_message_filter_.get());
resource_dispatcher_.reset(new ResourceDispatcher(
this, message_loop()->task_runner()));
@@ -537,7 +538,7 @@ void ChildThreadImpl::Init(const Options& options) {
connection_timeout = temp;
}
- message_loop_->task_runner()->PostDelayedTask(
+ main_task_runner_->PostDelayedTask(
FROM_HERE, base::Bind(&ChildThreadImpl::EnsureConnected,
channel_connected_factory_->GetWeakPtr()),
base::TimeDelta::FromSeconds(connection_timeout));
@@ -586,6 +587,7 @@ void ChildThreadImpl::Shutdown() {
file_system_dispatcher_.reset();
quota_dispatcher_.reset();
WebFileSystemImpl::DeleteThreadSpecificInstance();
+ message_loop_ = nullptr;
}
void ChildThreadImpl::ShutdownDiscardableSharedMemoryManager() {
@@ -602,7 +604,7 @@ void ChildThreadImpl::OnChannelError() {
}
bool ChildThreadImpl::Send(IPC::Message* msg) {
- DCHECK(message_loop_->task_runner()->BelongsToCurrentThread());
+ DCHECK(main_task_runner_->BelongsToCurrentThread());
if (!channel_) {
delete msg;
return false;
@@ -649,13 +651,13 @@ shell::InterfaceProvider* ChildThreadImpl::GetRemoteInterfaces() {
}
IPC::MessageRouter* ChildThreadImpl::GetRouter() {
- DCHECK(message_loop_->task_runner()->BelongsToCurrentThread());
+ DCHECK(main_task_runner_->BelongsToCurrentThread());
return &router_;
}
std::unique_ptr<base::SharedMemory> ChildThreadImpl::AllocateSharedMemory(
size_t buf_size) {
- DCHECK(message_loop_->task_runner()->BelongsToCurrentThread());
+ DCHECK(main_task_runner_->BelongsToCurrentThread());
return AllocateSharedMemory(buf_size, this, nullptr);
}

Powered by Google App Engine
This is Rietveld 408576698