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

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

Issue 562273008: Add audio signal to the ResourceScheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 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/browser/renderer_host/render_view_host_impl.h" 5 #include "content/browser/renderer_host/render_view_host_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 return static_cast<RenderViewHostImpl*>(RenderWidgetHostImpl::From(widget)); 160 return static_cast<RenderViewHostImpl*>(RenderWidgetHostImpl::From(widget));
161 } 161 }
162 162
163 RenderViewHostImpl::RenderViewHostImpl( 163 RenderViewHostImpl::RenderViewHostImpl(
164 SiteInstance* instance, 164 SiteInstance* instance,
165 RenderViewHostDelegate* delegate, 165 RenderViewHostDelegate* delegate,
166 RenderWidgetHostDelegate* widget_delegate, 166 RenderWidgetHostDelegate* widget_delegate,
167 int routing_id, 167 int routing_id,
168 int main_frame_routing_id, 168 int main_frame_routing_id,
169 bool swapped_out, 169 bool swapped_out,
170 bool hidden) 170 bool hidden,
171 bool has_initialized_audio_host)
171 : RenderWidgetHostImpl(widget_delegate, 172 : RenderWidgetHostImpl(widget_delegate,
172 instance->GetProcess(), 173 instance->GetProcess(),
173 routing_id, 174 routing_id,
174 hidden), 175 hidden),
175 frames_ref_count_(0), 176 frames_ref_count_(0),
176 delegate_(delegate), 177 delegate_(delegate),
177 instance_(static_cast<SiteInstanceImpl*>(instance)), 178 instance_(static_cast<SiteInstanceImpl*>(instance)),
178 waiting_for_drag_context_response_(false), 179 waiting_for_drag_context_response_(false),
179 enabled_bindings_(0), 180 enabled_bindings_(0),
180 page_id_(-1), 181 page_id_(-1),
181 is_active_(!swapped_out), 182 is_active_(!swapped_out),
182 is_swapped_out_(swapped_out), 183 is_swapped_out_(swapped_out),
183 main_frame_routing_id_(main_frame_routing_id), 184 main_frame_routing_id_(main_frame_routing_id),
184 run_modal_reply_msg_(NULL), 185 run_modal_reply_msg_(NULL),
185 run_modal_opener_id_(MSG_ROUTING_NONE), 186 run_modal_opener_id_(MSG_ROUTING_NONE),
186 is_waiting_for_close_ack_(false), 187 is_waiting_for_close_ack_(false),
187 sudden_termination_allowed_(false), 188 sudden_termination_allowed_(false),
188 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), 189 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING),
189 virtual_keyboard_requested_(false), 190 virtual_keyboard_requested_(false),
190 is_focused_element_editable_(false), 191 is_focused_element_editable_(false),
191 updating_web_preferences_(false), 192 updating_web_preferences_(false),
192 weak_factory_(this) { 193 weak_factory_(this) {
193 DCHECK(instance_.get()); 194 DCHECK(instance_.get());
194 CHECK(delegate_); // http://crbug.com/82827 195 CHECK(delegate_); // http://crbug.com/82827
195 196
196 GetProcess()->EnableSendQueue(); 197 GetProcess()->EnableSendQueue();
197 198
198 if (ResourceDispatcherHostImpl::Get()) { 199 if (ResourceDispatcherHostImpl::Get()) {
200 bool has_active_audio = false;
201 if (has_initialized_audio_host) {
202 scoped_refptr<AudioRendererHost> arh =
203 static_cast<RenderProcessHostImpl*>(GetProcess())
204 ->audio_renderer_host();
205 if (arh.get())
206 has_active_audio = arh->RenderViewHasActiveAudio(GetRoutingID());
207 }
199 BrowserThread::PostTask( 208 BrowserThread::PostTask(
200 BrowserThread::IO, FROM_HERE, 209 BrowserThread::IO,
210 FROM_HERE,
201 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostCreated, 211 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostCreated,
202 base::Unretained(ResourceDispatcherHostImpl::Get()), 212 base::Unretained(ResourceDispatcherHostImpl::Get()),
203 GetProcess()->GetID(), GetRoutingID(), !is_hidden())); 213 GetProcess()->GetID(),
214 GetRoutingID(),
215 !is_hidden(),
216 has_active_audio));
204 } 217 }
205
206 #if defined(ENABLE_BROWSER_CDMS) 218 #if defined(ENABLE_BROWSER_CDMS)
207 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); 219 media_web_contents_observer_.reset(new MediaWebContentsObserver(this));
208 #endif 220 #endif
209 } 221 }
210 222
211 RenderViewHostImpl::~RenderViewHostImpl() { 223 RenderViewHostImpl::~RenderViewHostImpl() {
212 if (ResourceDispatcherHostImpl::Get()) { 224 if (ResourceDispatcherHostImpl::Get()) {
213 BrowserThread::PostTask( 225 BrowserThread::PostTask(
214 BrowserThread::IO, FROM_HERE, 226 BrowserThread::IO, FROM_HERE,
215 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostDeleted, 227 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostDeleted,
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 FrameTree* frame_tree = delegate_->GetFrameTree(); 1407 FrameTree* frame_tree = delegate_->GetFrameTree();
1396 1408
1397 frame_tree->ResetForMainFrameSwap(); 1409 frame_tree->ResetForMainFrameSwap();
1398 } 1410 }
1399 1411
1400 void RenderViewHostImpl::SelectWordAroundCaret() { 1412 void RenderViewHostImpl::SelectWordAroundCaret() {
1401 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); 1413 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID()));
1402 } 1414 }
1403 1415
1404 } // namespace content 1416 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.h ('k') | content/test/test_render_view_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698