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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 void ChildThreadImpl::OnChannelConnected(int32_t peer_pid) { | 570 void ChildThreadImpl::OnChannelConnected(int32_t peer_pid) { |
571 channel_connected_factory_.InvalidateWeakPtrs(); | 571 channel_connected_factory_.InvalidateWeakPtrs(); |
572 } | 572 } |
573 | 573 |
574 void ChildThreadImpl::OnChannelError() { | 574 void ChildThreadImpl::OnChannelError() { |
575 on_channel_error_called_ = true; | 575 on_channel_error_called_ = true; |
576 base::MessageLoop::current()->QuitWhenIdle(); | 576 base::MessageLoop::current()->QuitWhenIdle(); |
577 } | 577 } |
578 | 578 |
579 bool ChildThreadImpl::Send(IPC::Message* msg) { | 579 bool ChildThreadImpl::Send(IPC::Message* msg) { |
580 DCHECK(message_loop_->task_runner()->BelongsToCurrentThread()); | 580 DCHECK(base::MessageLoop::current() == message_loop()); |
581 if (!channel_) { | 581 if (!channel_) { |
582 delete msg; | 582 delete msg; |
583 return false; | 583 return false; |
584 } | 584 } |
585 | 585 |
586 return channel_->Send(msg); | 586 return channel_->Send(msg); |
587 } | 587 } |
588 | 588 |
589 #if defined(OS_WIN) | 589 #if defined(OS_WIN) |
590 void ChildThreadImpl::PreCacheFont(const LOGFONT& log_font) { | 590 void ChildThreadImpl::PreCacheFont(const LOGFONT& log_font) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 | 628 |
629 shell::InterfaceRegistry* ChildThreadImpl::GetInterfaceRegistryForConnection() { | 629 shell::InterfaceRegistry* ChildThreadImpl::GetInterfaceRegistryForConnection() { |
630 return GetInterfaceRegistry(); | 630 return GetInterfaceRegistry(); |
631 } | 631 } |
632 | 632 |
633 shell::InterfaceProvider* ChildThreadImpl::GetInterfaceProviderForConnection() { | 633 shell::InterfaceProvider* ChildThreadImpl::GetInterfaceProviderForConnection() { |
634 return GetRemoteInterfaces(); | 634 return GetRemoteInterfaces(); |
635 } | 635 } |
636 | 636 |
637 IPC::MessageRouter* ChildThreadImpl::GetRouter() { | 637 IPC::MessageRouter* ChildThreadImpl::GetRouter() { |
638 DCHECK(message_loop_->task_runner()->BelongsToCurrentThread()); | 638 DCHECK(base::MessageLoop::current() == message_loop()); |
639 return &router_; | 639 return &router_; |
640 } | 640 } |
641 | 641 |
642 std::unique_ptr<base::SharedMemory> ChildThreadImpl::AllocateSharedMemory( | 642 std::unique_ptr<base::SharedMemory> ChildThreadImpl::AllocateSharedMemory( |
643 size_t buf_size) { | 643 size_t buf_size) { |
644 DCHECK(message_loop_->task_runner()->BelongsToCurrentThread()); | 644 DCHECK(base::MessageLoop::current() == message_loop()); |
645 return AllocateSharedMemory(buf_size, this, nullptr); | 645 return AllocateSharedMemory(buf_size, this, nullptr); |
646 } | 646 } |
647 | 647 |
648 // static | 648 // static |
649 std::unique_ptr<base::SharedMemory> ChildThreadImpl::AllocateSharedMemory( | 649 std::unique_ptr<base::SharedMemory> ChildThreadImpl::AllocateSharedMemory( |
650 size_t buf_size, | 650 size_t buf_size, |
651 IPC::Sender* sender, | 651 IPC::Sender* sender, |
652 bool* out_of_memory) { | 652 bool* out_of_memory) { |
653 std::unique_ptr<base::SharedMemory> shared_buf; | 653 std::unique_ptr<base::SharedMemory> shared_buf; |
654 // Ask the browser to create the shared memory, since this is blocked by the | 654 // Ask the browser to create the shared memory, since this is blocked by the |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 void ChildThreadImpl::EnsureConnected() { | 784 void ChildThreadImpl::EnsureConnected() { |
785 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; | 785 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; |
786 base::Process::Current().Terminate(0, false); | 786 base::Process::Current().Terminate(0, false); |
787 } | 787 } |
788 | 788 |
789 bool ChildThreadImpl::IsInBrowserProcess() const { | 789 bool ChildThreadImpl::IsInBrowserProcess() const { |
790 return static_cast<bool>(browser_process_io_runner_); | 790 return static_cast<bool>(browser_process_io_runner_); |
791 } | 791 } |
792 | 792 |
793 } // namespace content | 793 } // namespace content |
OLD | NEW |