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

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

Issue 1914143002: Experimental 'purging and suspending' backgrounded tabs behind the flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address on haraken's review Created 4 years, 7 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/common/child_process_messages.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 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 OnSetIPCLoggingEnabled) 630 OnSetIPCLoggingEnabled)
631 #endif 631 #endif
632 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus, 632 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus,
633 OnSetProfilerStatus) 633 OnSetProfilerStatus)
634 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData, 634 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData,
635 OnGetChildProfilerData) 635 OnGetChildProfilerData)
636 IPC_MESSAGE_HANDLER(ChildProcessMsg_ProfilingPhaseCompleted, 636 IPC_MESSAGE_HANDLER(ChildProcessMsg_ProfilingPhaseCompleted,
637 OnProfilingPhaseCompleted) 637 OnProfilingPhaseCompleted)
638 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded, 638 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded,
639 OnProcessBackgrounded) 639 OnProcessBackgrounded)
640 IPC_MESSAGE_HANDLER(ChildProcessMsg_PurgeAndSuspend,
641 OnProcessPurgeAndSuspend)
640 IPC_MESSAGE_UNHANDLED(handled = false) 642 IPC_MESSAGE_UNHANDLED(handled = false)
641 IPC_END_MESSAGE_MAP() 643 IPC_END_MESSAGE_MAP()
642 644
643 if (handled) 645 if (handled)
644 return true; 646 return true;
645 647
646 if (msg.routing_id() == MSG_ROUTING_CONTROL) 648 if (msg.routing_id() == MSG_ROUTING_CONTROL)
647 return OnControlMessageReceived(msg); 649 return OnControlMessageReceived(msg);
648 650
649 return router_.OnMessageReceived(msg); 651 return router_.OnMessageReceived(msg);
650 } 652 }
651 653
652 bool ChildThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { 654 bool ChildThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
653 return false; 655 return false;
654 } 656 }
655 657
656 void ChildThreadImpl::OnProcessBackgrounded(bool backgrounded) { 658 void ChildThreadImpl::OnProcessBackgrounded(bool backgrounded) {
657 // Set timer slack to maximum on main thread when in background. 659 // Set timer slack to maximum on main thread when in background.
658 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; 660 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE;
659 if (backgrounded) 661 if (backgrounded)
660 timer_slack = base::TIMER_SLACK_MAXIMUM; 662 timer_slack = base::TIMER_SLACK_MAXIMUM;
661 base::MessageLoop::current()->SetTimerSlack(timer_slack); 663 base::MessageLoop::current()->SetTimerSlack(timer_slack);
662 } 664 }
663 665
666 void ChildThreadImpl::OnProcessPurgeAndSuspend() {
667 }
668
664 void ChildThreadImpl::OnShutdown() { 669 void ChildThreadImpl::OnShutdown() {
665 base::MessageLoop::current()->QuitWhenIdle(); 670 base::MessageLoop::current()->QuitWhenIdle();
666 } 671 }
667 672
668 #if defined(IPC_MESSAGE_LOG_ENABLED) 673 #if defined(IPC_MESSAGE_LOG_ENABLED)
669 void ChildThreadImpl::OnSetIPCLoggingEnabled(bool enable) { 674 void ChildThreadImpl::OnSetIPCLoggingEnabled(bool enable) {
670 if (enable) 675 if (enable)
671 IPC::Logging::GetInstance()->Enable(); 676 IPC::Logging::GetInstance()->Enable();
672 else 677 else
673 IPC::Logging::GetInstance()->Disable(); 678 IPC::Logging::GetInstance()->Disable();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 void ChildThreadImpl::EnsureConnected() { 726 void ChildThreadImpl::EnsureConnected() {
722 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; 727 VLOG(0) << "ChildThreadImpl::EnsureConnected()";
723 base::Process::Current().Terminate(0, false); 728 base::Process::Current().Terminate(0, false);
724 } 729 }
725 730
726 bool ChildThreadImpl::IsInBrowserProcess() const { 731 bool ChildThreadImpl::IsInBrowserProcess() const {
727 return static_cast<bool>(browser_process_io_runner_); 732 return static_cast<bool>(browser_process_io_runner_);
728 } 733 }
729 734
730 } // namespace content 735 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/common/child_process_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698