Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
| 6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
| 7 | 7 |
| 8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1085 if (visible_widgets_ == 0) { | 1085 if (visible_widgets_ == 0) { |
| 1086 DCHECK(!backgrounded_); | 1086 DCHECK(!backgrounded_); |
| 1087 SetBackgrounded(true); | 1087 SetBackgrounded(true); |
| 1088 } | 1088 } |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 int RenderProcessHostImpl::VisibleWidgetCount() const { | 1091 int RenderProcessHostImpl::VisibleWidgetCount() const { |
| 1092 return visible_widgets_; | 1092 return visible_widgets_; |
| 1093 } | 1093 } |
| 1094 | 1094 |
| 1095 void RenderProcessHostImpl::AudioStopped() { | |
| 1096 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 1097 | |
| 1098 // If the backgrounding was skipped because audio was playing, we background | |
|
gab
2015/06/30 13:41:41
-we (in general we try to avoid "we" in comments),
sebsg
2015/07/02 12:58:08
Done.
| |
| 1099 // the tab. | |
| 1100 if (backgrounded_) | |
| 1101 SetBackgrounded(true); | |
| 1102 } | |
| 1103 | |
| 1104 void RenderProcessHostImpl::AudioStarted() { | |
| 1105 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 1106 | |
| 1107 // If audio starts from a backgrounded tab, we un-background it. | |
|
gab
2015/06/30 13:41:41
// If audio starts playing from a backgrounded tab
sebsg
2015/07/02 12:58:08
Done.
| |
| 1108 if (backgrounded_) { | |
| 1109 SetBackgrounded(false); | |
| 1110 | |
| 1111 // Since it's not a visible tab, we need to set it to backgrounded so that | |
| 1112 // it is backgrounded again when the video finishes. | |
|
gab
2015/06/30 13:41:41
// Since it's not a visible tab, it needs to be ma
sebsg
2015/07/02 12:58:09
Done.
| |
| 1113 SetBackgrounded(true); | |
| 1114 } | |
| 1115 } | |
| 1116 | |
| 1095 bool RenderProcessHostImpl::IsForGuestsOnly() const { | 1117 bool RenderProcessHostImpl::IsForGuestsOnly() const { |
| 1096 return is_for_guests_only_; | 1118 return is_for_guests_only_; |
| 1097 } | 1119 } |
| 1098 | 1120 |
| 1099 StoragePartition* RenderProcessHostImpl::GetStoragePartition() const { | 1121 StoragePartition* RenderProcessHostImpl::GetStoragePartition() const { |
| 1100 return storage_partition_impl_; | 1122 return storage_partition_impl_; |
| 1101 } | 1123 } |
| 1102 | 1124 |
| 1103 static void AppendCompositorCommandLineFlags(base::CommandLine* command_line) { | 1125 static void AppendCompositorCommandLineFlags(base::CommandLine* command_line) { |
| 1104 if (IsPropertyTreeVerificationEnabled()) | 1126 if (IsPropertyTreeVerificationEnabled()) |
| (...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2230 mojo_application_host_->WillDestroySoon(); | 2252 mojo_application_host_->WillDestroySoon(); |
| 2231 | 2253 |
| 2232 Send(new ChildProcessMsg_Shutdown()); | 2254 Send(new ChildProcessMsg_Shutdown()); |
| 2233 } | 2255 } |
| 2234 | 2256 |
| 2235 void RenderProcessHostImpl::SuddenTerminationChanged(bool enabled) { | 2257 void RenderProcessHostImpl::SuddenTerminationChanged(bool enabled) { |
| 2236 SetSuddenTerminationAllowed(enabled); | 2258 SetSuddenTerminationAllowed(enabled); |
| 2237 } | 2259 } |
| 2238 | 2260 |
| 2239 void RenderProcessHostImpl::SetBackgrounded(bool backgrounded) { | 2261 void RenderProcessHostImpl::SetBackgrounded(bool backgrounded) { |
| 2262 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 2240 TRACE_EVENT1("renderer_host", "RenderProcessHostImpl::SetBackgrounded", | 2263 TRACE_EVENT1("renderer_host", "RenderProcessHostImpl::SetBackgrounded", |
| 2241 "backgrounded", backgrounded); | 2264 "backgrounded", backgrounded); |
| 2242 // Note: we always set the backgrounded_ value. If the process is NULL | 2265 // Note: we always set the backgrounded_ value. If the process is NULL |
| 2243 // (and hence hasn't been created yet), we will set the process priority | 2266 // (and hence hasn't been created yet), we will set the process priority |
| 2244 // later when we create the process. | 2267 // later when we create the process. |
| 2245 backgrounded_ = backgrounded; | 2268 backgrounded_ = backgrounded; |
| 2246 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting()) | 2269 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting()) |
| 2247 return; | 2270 return; |
| 2248 | 2271 |
| 2249 // Don't background processes which have active audio streams. | 2272 // Don't background processes which have active audio streams. |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2512 void RenderProcessHostImpl::GetAudioOutputControllers( | 2535 void RenderProcessHostImpl::GetAudioOutputControllers( |
| 2513 const GetAudioOutputControllersCallback& callback) const { | 2536 const GetAudioOutputControllersCallback& callback) const { |
| 2514 audio_renderer_host()->GetOutputControllers(callback); | 2537 audio_renderer_host()->GetOutputControllers(callback); |
| 2515 } | 2538 } |
| 2516 | 2539 |
| 2517 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { | 2540 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { |
| 2518 return bluetooth_dispatcher_host_.get(); | 2541 return bluetooth_dispatcher_host_.get(); |
| 2519 } | 2542 } |
| 2520 | 2543 |
| 2521 } // namespace content | 2544 } // namespace content |
| OLD | NEW |