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

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

Issue 1133143003: [Android] Suspend shared timers for hidden renderers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@input_remove_suspend
Patch Set: Use ContentRendererClient Created 5 years, 3 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 | « content/child/child_thread_impl.h ('k') | content/public/renderer/content_renderer_client.h » ('j') | 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 8
9 #include <string> 9 #include <string>
10 10
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 if (msg.routing_id() == MSG_ROUTING_CONTROL) 653 if (msg.routing_id() == MSG_ROUTING_CONTROL)
654 return OnControlMessageReceived(msg); 654 return OnControlMessageReceived(msg);
655 655
656 return router_.OnMessageReceived(msg); 656 return router_.OnMessageReceived(msg);
657 } 657 }
658 658
659 bool ChildThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { 659 bool ChildThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
660 return false; 660 return false;
661 } 661 }
662 662
663 void ChildThreadImpl::OnProcessBackgrounded(bool backgrounded) {
664 // Set timer slack to maximum on main thread when in background.
665 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE;
666 if (backgrounded)
667 timer_slack = base::TIMER_SLACK_MAXIMUM;
668 base::MessageLoop::current()->SetTimerSlack(timer_slack);
669 }
670
663 void ChildThreadImpl::OnShutdown() { 671 void ChildThreadImpl::OnShutdown() {
664 base::MessageLoop::current()->Quit(); 672 base::MessageLoop::current()->Quit();
665 } 673 }
666 674
667 #if defined(IPC_MESSAGE_LOG_ENABLED) 675 #if defined(IPC_MESSAGE_LOG_ENABLED)
668 void ChildThreadImpl::OnSetIPCLoggingEnabled(bool enable) { 676 void ChildThreadImpl::OnSetIPCLoggingEnabled(bool enable) {
669 if (enable) 677 if (enable)
670 IPC::Logging::GetInstance()->Enable(); 678 IPC::Logging::GetInstance()->Enable();
671 else 679 else
672 IPC::Logging::GetInstance()->Disable(); 680 IPC::Logging::GetInstance()->Disable();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 739
732 void ChildThreadImpl::EnsureConnected() { 740 void ChildThreadImpl::EnsureConnected() {
733 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; 741 VLOG(0) << "ChildThreadImpl::EnsureConnected()";
734 base::Process::Current().Terminate(0, false); 742 base::Process::Current().Terminate(0, false);
735 } 743 }
736 744
737 bool ChildThreadImpl::IsInBrowserProcess() const { 745 bool ChildThreadImpl::IsInBrowserProcess() const {
738 return browser_process_io_runner_; 746 return browser_process_io_runner_;
739 } 747 }
740 748
741 void ChildThreadImpl::OnProcessBackgrounded(bool background) {
742 // Set timer slack to maximum on main thread when in background.
743 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE;
744 if (background)
745 timer_slack = base::TIMER_SLACK_MAXIMUM;
746 base::MessageLoop::current()->SetTimerSlack(timer_slack);
747 }
748
749 } // namespace content 749 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/public/renderer/content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698