| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |