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

Side by Side Diff: content/child/child_thread_impl.cc

Issue 2973723003: Avoid race at shutdown between browser process' IO thread and GPU thread (Closed)
Patch Set: Only let Thread::Stop stop child threads inside the browser process Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/child_thread_impl.h" 5 #include "content/child/child_thread_impl.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 bool ChildThreadImpl::ShouldBeDestroyed() { 612 bool ChildThreadImpl::ShouldBeDestroyed() {
613 return true; 613 return true;
614 } 614 }
615 615
616 void ChildThreadImpl::OnChannelConnected(int32_t peer_pid) { 616 void ChildThreadImpl::OnChannelConnected(int32_t peer_pid) {
617 channel_connected_factory_.reset(); 617 channel_connected_factory_.reset();
618 } 618 }
619 619
620 void ChildThreadImpl::OnChannelError() { 620 void ChildThreadImpl::OnChannelError() {
621 on_channel_error_called_ = true; 621 on_channel_error_called_ = true;
622 base::MessageLoop::current()->QuitWhenIdle(); 622 // If this thread runs in the browser process, only Thread::Stop should
623 // stop its message loop. Otherwise, QuitWhenIdle could race Thread::Stop.
624 if (!IsInBrowserProcess())
625 base::MessageLoop::current()->QuitWhenIdle();
623 } 626 }
624 627
625 bool ChildThreadImpl::Send(IPC::Message* msg) { 628 bool ChildThreadImpl::Send(IPC::Message* msg) {
626 DCHECK(message_loop_->task_runner()->BelongsToCurrentThread()); 629 DCHECK(message_loop_->task_runner()->BelongsToCurrentThread());
627 if (!channel_) { 630 if (!channel_) {
628 delete msg; 631 delete msg;
629 return false; 632 return false;
630 } 633 }
631 634
632 return channel_->Send(msg); 635 return channel_->Send(msg);
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 Listener* route = router_.GetRoute(routing_id); 859 Listener* route = router_.GetRoute(routing_id);
857 if (route) 860 if (route)
858 route->OnAssociatedInterfaceRequest(name, request.PassHandle()); 861 route->OnAssociatedInterfaceRequest(name, request.PassHandle());
859 } 862 }
860 863
861 bool ChildThreadImpl::IsInBrowserProcess() const { 864 bool ChildThreadImpl::IsInBrowserProcess() const {
862 return static_cast<bool>(browser_process_io_runner_); 865 return static_cast<bool>(browser_process_io_runner_);
863 } 866 }
864 867
865 } // namespace content 868 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698