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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2655413004: Strip out stream counting from AudioRendererHost. (Closed)
Patch Set: Add moar DCHECKs. Created 3 years, 10 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 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 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 if (visible_widgets_ == 0) { 1565 if (visible_widgets_ == 0) {
1566 DCHECK(!is_process_backgrounded_); 1566 DCHECK(!is_process_backgrounded_);
1567 UpdateProcessPriority(); 1567 UpdateProcessPriority();
1568 } 1568 }
1569 } 1569 }
1570 1570
1571 int RenderProcessHostImpl::VisibleWidgetCount() const { 1571 int RenderProcessHostImpl::VisibleWidgetCount() const {
1572 return visible_widgets_; 1572 return visible_widgets_;
1573 } 1573 }
1574 1574
1575 void RenderProcessHostImpl::AudioStateChanged() { 1575 void RenderProcessHostImpl::OnAudioStreamAdded() {
1576 ++audio_stream_count_;
1576 UpdateProcessPriority(); 1577 UpdateProcessPriority();
1577 } 1578 }
1578 1579
1580 void RenderProcessHostImpl::OnAudioStreamRemoved() {
1581 DCHECK_GT(audio_stream_count_, 0);
1582 --audio_stream_count_;
1583 UpdateProcessPriority();
1584 }
1585
1579 bool RenderProcessHostImpl::IsForGuestsOnly() const { 1586 bool RenderProcessHostImpl::IsForGuestsOnly() const {
1580 return is_for_guests_only_; 1587 return is_for_guests_only_;
1581 } 1588 }
1582 1589
1583 StoragePartition* RenderProcessHostImpl::GetStoragePartition() const { 1590 StoragePartition* RenderProcessHostImpl::GetStoragePartition() const {
1584 return storage_partition_impl_; 1591 return storage_partition_impl_;
1585 } 1592 }
1586 1593
1587 static void AppendCompositorCommandLineFlags(base::CommandLine* command_line) { 1594 static void AppendCompositorCommandLineFlags(base::CommandLine* command_line) {
1588 command_line->AppendSwitchASCII( 1595 command_line->AppendSwitchASCII(
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
2824 2831
2825 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 2832 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
2826 switches::kDisableRendererPriorityManagement)) { 2833 switches::kDisableRendererPriorityManagement)) {
2827 return; 2834 return;
2828 } 2835 }
2829 2836
2830 // We background a process as soon as it hosts no active audio streams and no 2837 // We background a process as soon as it hosts no active audio streams and no
2831 // visible widgets -- the callers must call this function whenever we 2838 // visible widgets -- the callers must call this function whenever we
2832 // transition in/out of those states. 2839 // transition in/out of those states.
2833 const bool should_background = 2840 const bool should_background =
2834 visible_widgets_ == 0 && !audio_renderer_host_->HasActiveAudio() && 2841 visible_widgets_ == 0 && audio_stream_count_ == 0 &&
2835 !base::CommandLine::ForCurrentProcess()->HasSwitch( 2842 !base::CommandLine::ForCurrentProcess()->HasSwitch(
2836 switches::kDisableRendererBackgrounding); 2843 switches::kDisableRendererBackgrounding);
2837 2844
2838 // TODO(sebsg): Remove this ifdef when https://crbug.com/537671 is fixed. 2845 // TODO(sebsg): Remove this ifdef when https://crbug.com/537671 is fixed.
2839 #if !defined(OS_ANDROID) 2846 #if !defined(OS_ANDROID)
2840 if (is_process_backgrounded_ == should_background) 2847 if (is_process_backgrounded_ == should_background)
2841 return; 2848 return;
2842 #endif 2849 #endif
2843 2850
2844 TRACE_EVENT1("renderer_host", "RenderProcessHostImpl::UpdateProcessPriority", 2851 TRACE_EVENT1("renderer_host", "RenderProcessHostImpl::UpdateProcessPriority",
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
3073 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3080 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3074 3081
3075 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. 3082 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing.
3076 // Capture the error message in a crash key value. 3083 // Capture the error message in a crash key value.
3077 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); 3084 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error);
3078 bad_message::ReceivedBadMessage(render_process_id, 3085 bad_message::ReceivedBadMessage(render_process_id,
3079 bad_message::RPH_MOJO_PROCESS_ERROR); 3086 bad_message::RPH_MOJO_PROCESS_ERROR);
3080 } 3087 }
3081 3088
3082 } // namespace content 3089 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | content/public/browser/render_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698