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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 bool ChildThreadImpl::IsInBrowserProcess() const { | 682 bool ChildThreadImpl::IsInBrowserProcess() const { |
683 return browser_process_io_runner_; | 683 return browser_process_io_runner_; |
684 } | 684 } |
685 | 685 |
686 void ChildThreadImpl::OnProcessBackgrounded(bool background) { | 686 void ChildThreadImpl::OnProcessBackgrounded(bool background) { |
687 // Set timer slack to maximum on main thread when in background. | 687 // Set timer slack to maximum on main thread when in background. |
688 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; | 688 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; |
689 if (background) | 689 if (background) |
690 timer_slack = base::TIMER_SLACK_MAXIMUM; | 690 timer_slack = base::TIMER_SLACK_MAXIMUM; |
691 base::MessageLoop::current()->SetTimerSlack(timer_slack); | 691 base::MessageLoop::current()->SetTimerSlack(timer_slack); |
692 | |
693 #ifdef OS_WIN | |
694 // Windows Vista+ has a fancy process backgrounding mode that can only be set | |
695 // from within the process. This used to be how chrome set its renderers into | |
696 // background mode on Windows but was removed due to http://crbug.com/398103. | |
697 // As we experiment with bringing back some other form of background mode for | |
698 // hidden renderers, add a bucket to allow us to trigger this undesired method | |
699 // of setting background state in order to confirm that the metrics which were | |
700 // added to prevent regressions on the aforementioned issue indeed catch such | |
701 // regressions and are thus a reliable way to confirm that our latest proposal | |
702 // doesn't cause such issues. TODO(gab): Remove this once the experiment is | |
703 // over (http://crbug.com/458594). | |
704 base::FieldTrial* trial = | |
705 base::FieldTrialList::Find("BackgroundRendererProcesses"); | |
706 if (trial && trial->group_name() == "AllowBackgroundModeFromRenderer") | |
707 base::Process::Current().SetProcessBackgrounded(background); | |
708 #endif // OS_WIN | |
709 } | 692 } |
710 | 693 |
711 } // namespace content | 694 } // namespace content |
OLD | NEW |