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

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

Issue 2383473002: [scheduler] Teach scheduler about audio state (Closed)
Patch Set: Created 4 years, 2 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
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 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 OnSetIPCLoggingEnabled) 773 OnSetIPCLoggingEnabled)
774 #endif 774 #endif
775 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus, 775 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus,
776 OnSetProfilerStatus) 776 OnSetProfilerStatus)
777 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData, 777 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData,
778 OnGetChildProfilerData) 778 OnGetChildProfilerData)
779 IPC_MESSAGE_HANDLER(ChildProcessMsg_ProfilingPhaseCompleted, 779 IPC_MESSAGE_HANDLER(ChildProcessMsg_ProfilingPhaseCompleted,
780 OnProfilingPhaseCompleted) 780 OnProfilingPhaseCompleted)
781 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded, 781 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded,
782 OnProcessBackgrounded) 782 OnProcessBackgrounded)
783 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetAudioPlaying, OnAudioStateChanged)
783 IPC_MESSAGE_HANDLER(ChildProcessMsg_PurgeAndSuspend, 784 IPC_MESSAGE_HANDLER(ChildProcessMsg_PurgeAndSuspend,
784 OnProcessPurgeAndSuspend) 785 OnProcessPurgeAndSuspend)
785 IPC_MESSAGE_UNHANDLED(handled = false) 786 IPC_MESSAGE_UNHANDLED(handled = false)
786 IPC_END_MESSAGE_MAP() 787 IPC_END_MESSAGE_MAP()
787 788
788 if (handled) 789 if (handled)
789 return true; 790 return true;
790 791
791 if (msg.routing_id() == MSG_ROUTING_CONTROL) 792 if (msg.routing_id() == MSG_ROUTING_CONTROL)
792 return OnControlMessageReceived(msg); 793 return OnControlMessageReceived(msg);
(...skipping 11 matching lines...) Expand all
804 } 805 }
805 806
806 void ChildThreadImpl::OnProcessBackgrounded(bool backgrounded) { 807 void ChildThreadImpl::OnProcessBackgrounded(bool backgrounded) {
807 // Set timer slack to maximum on main thread when in background. 808 // Set timer slack to maximum on main thread when in background.
808 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; 809 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE;
809 if (backgrounded) 810 if (backgrounded)
810 timer_slack = base::TIMER_SLACK_MAXIMUM; 811 timer_slack = base::TIMER_SLACK_MAXIMUM;
811 base::MessageLoop::current()->SetTimerSlack(timer_slack); 812 base::MessageLoop::current()->SetTimerSlack(timer_slack);
812 } 813 }
813 814
815 void ChildThreadImpl::OnAudioStateChanged(bool has_active_audio) {}
816
814 void ChildThreadImpl::OnProcessPurgeAndSuspend() { 817 void ChildThreadImpl::OnProcessPurgeAndSuspend() {
815 } 818 }
816 819
817 void ChildThreadImpl::OnShutdown() { 820 void ChildThreadImpl::OnShutdown() {
818 base::MessageLoop::current()->QuitWhenIdle(); 821 base::MessageLoop::current()->QuitWhenIdle();
819 } 822 }
820 823
821 #if defined(IPC_MESSAGE_LOG_ENABLED) 824 #if defined(IPC_MESSAGE_LOG_ENABLED)
822 void ChildThreadImpl::OnSetIPCLoggingEnabled(bool enable) { 825 void ChildThreadImpl::OnSetIPCLoggingEnabled(bool enable) {
823 if (enable) 826 if (enable)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 base::debug::Alias(&routing_id); 904 base::debug::Alias(&routing_id);
902 base::debug::Alias(&route); 905 base::debug::Alias(&route);
903 route->OnAssociatedInterfaceRequest(name, request.PassHandle()); 906 route->OnAssociatedInterfaceRequest(name, request.PassHandle());
904 } 907 }
905 908
906 bool ChildThreadImpl::IsInBrowserProcess() const { 909 bool ChildThreadImpl::IsInBrowserProcess() const {
907 return static_cast<bool>(browser_process_io_runner_); 910 return static_cast<bool>(browser_process_io_runner_);
908 } 911 }
909 912
910 } // namespace content 913 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698