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 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
620 if (msg.routing_id() == MSG_ROUTING_CONTROL) | 620 if (msg.routing_id() == MSG_ROUTING_CONTROL) |
621 return OnControlMessageReceived(msg); | 621 return OnControlMessageReceived(msg); |
622 | 622 |
623 return router_.OnMessageReceived(msg); | 623 return router_.OnMessageReceived(msg); |
624 } | 624 } |
625 | 625 |
626 bool ChildThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { | 626 bool ChildThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { |
627 return false; | 627 return false; |
628 } | 628 } |
629 | 629 |
630 void ChildThreadImpl::OnProcessBackgrounded(bool backgrounded) { | |
Sami
2015/08/28 14:15:01
Nothing changed here -- you just moved this around
jdduke (slow)
2015/08/31 18:36:08
Yep, moved it to preserve ordering as I moved the
| |
631 // Set timer slack to maximum on main thread when in background. | |
632 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; | |
633 if (backgrounded) | |
634 timer_slack = base::TIMER_SLACK_MAXIMUM; | |
635 base::MessageLoop::current()->SetTimerSlack(timer_slack); | |
636 } | |
637 | |
630 void ChildThreadImpl::OnShutdown() { | 638 void ChildThreadImpl::OnShutdown() { |
631 base::MessageLoop::current()->Quit(); | 639 base::MessageLoop::current()->Quit(); |
632 } | 640 } |
633 | 641 |
634 #if defined(IPC_MESSAGE_LOG_ENABLED) | 642 #if defined(IPC_MESSAGE_LOG_ENABLED) |
635 void ChildThreadImpl::OnSetIPCLoggingEnabled(bool enable) { | 643 void ChildThreadImpl::OnSetIPCLoggingEnabled(bool enable) { |
636 if (enable) | 644 if (enable) |
637 IPC::Logging::GetInstance()->Enable(); | 645 IPC::Logging::GetInstance()->Enable(); |
638 else | 646 else |
639 IPC::Logging::GetInstance()->Disable(); | 647 IPC::Logging::GetInstance()->Disable(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
698 | 706 |
699 void ChildThreadImpl::EnsureConnected() { | 707 void ChildThreadImpl::EnsureConnected() { |
700 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; | 708 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; |
701 base::Process::Current().Terminate(0, false); | 709 base::Process::Current().Terminate(0, false); |
702 } | 710 } |
703 | 711 |
704 bool ChildThreadImpl::IsInBrowserProcess() const { | 712 bool ChildThreadImpl::IsInBrowserProcess() const { |
705 return browser_process_io_runner_; | 713 return browser_process_io_runner_; |
706 } | 714 } |
707 | 715 |
708 void ChildThreadImpl::OnProcessBackgrounded(bool background) { | |
709 // Set timer slack to maximum on main thread when in background. | |
710 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; | |
711 if (background) | |
712 timer_slack = base::TIMER_SLACK_MAXIMUM; | |
713 base::MessageLoop::current()->SetTimerSlack(timer_slack); | |
714 } | |
715 | |
716 } // namespace content | 716 } // namespace content |
OLD | NEW |