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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 #include "content/renderer/devtools_agent.h" | 64 #include "content/renderer/devtools_agent.h" |
65 #include "content/renderer/dom_automation_controller.h" | 65 #include "content/renderer/dom_automation_controller.h" |
66 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 66 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
67 #include "content/renderer/external_popup_menu.h" | 67 #include "content/renderer/external_popup_menu.h" |
68 #include "content/renderer/geolocation_dispatcher.h" | 68 #include "content/renderer/geolocation_dispatcher.h" |
69 #include "content/renderer/gpu/compositor_thread.h" | 69 #include "content/renderer/gpu/compositor_thread.h" |
70 #include "content/renderer/idle_user_detector.h" | 70 #include "content/renderer/idle_user_detector.h" |
71 #include "content/renderer/input_tag_speech_dispatcher.h" | 71 #include "content/renderer/input_tag_speech_dispatcher.h" |
72 #include "content/renderer/java/java_bridge_dispatcher.h" | 72 #include "content/renderer/java/java_bridge_dispatcher.h" |
73 #include "content/renderer/load_progress_tracker.h" | 73 #include "content/renderer/load_progress_tracker.h" |
| 74 #include "content/renderer/media/audio_device.h" |
| 75 #include "content/renderer/media/audio_device_factory.h" |
74 #include "content/renderer/media/audio_message_filter.h" | 76 #include "content/renderer/media/audio_message_filter.h" |
75 #include "content/renderer/media/media_stream_dependency_factory.h" | 77 #include "content/renderer/media/media_stream_dependency_factory.h" |
76 #include "content/renderer/media/media_stream_dispatcher.h" | 78 #include "content/renderer/media/media_stream_dispatcher.h" |
77 #include "content/renderer/media/media_stream_impl.h" | 79 #include "content/renderer/media/media_stream_impl.h" |
78 #include "content/renderer/media/render_audiosourceprovider.h" | 80 #include "content/renderer/media/render_audiosourceprovider.h" |
79 #include "content/renderer/media/render_media_log.h" | 81 #include "content/renderer/media/render_media_log.h" |
80 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h" | 82 #include "content/renderer/media/renderer_gpu_video_decoder_factories.h" |
81 #include "content/renderer/mhtml_generator.h" | 83 #include "content/renderer/mhtml_generator.h" |
82 #include "content/renderer/notification_provider.h" | 84 #include "content/renderer/notification_provider.h" |
83 #include "content/renderer/p2p/socket_dispatcher.h" | 85 #include "content/renderer/p2p/socket_dispatcher.h" |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 | 560 |
559 // Ensure we start with a valid next_page_id_ from the browser. | 561 // Ensure we start with a valid next_page_id_ from the browser. |
560 DCHECK_GE(next_page_id_, 0); | 562 DCHECK_GE(next_page_id_, 0); |
561 | 563 |
562 #if defined(ENABLE_NOTIFICATIONS) | 564 #if defined(ENABLE_NOTIFICATIONS) |
563 notification_provider_ = new NotificationProvider(this); | 565 notification_provider_ = new NotificationProvider(this); |
564 #else | 566 #else |
565 notification_provider_ = NULL; | 567 notification_provider_ = NULL; |
566 #endif | 568 #endif |
567 | 569 |
| 570 // Create the audio device factory to ensure that it can be injected into |
| 571 // WebRTC, WebAudio and HTML5 <audio>/<video> clients. |
| 572 audio_device_factory_.reset( |
| 573 new AudioDeviceFactory<AudioDevice, AudioMessageFilter>( |
| 574 RenderThreadImpl::current()->audio_message_filter())); |
| 575 |
568 webwidget_ = WebView::create(this); | 576 webwidget_ = WebView::create(this); |
569 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); | 577 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); |
570 | 578 |
571 if (counter) { | 579 if (counter) { |
572 shared_popup_counter_ = counter; | 580 shared_popup_counter_ = counter; |
573 // Only count this if it isn't swapped out upon creation. | 581 // Only count this if it isn't swapped out upon creation. |
574 if (!swapped_out) | 582 if (!swapped_out) |
575 shared_popup_counter_->data++; | 583 shared_popup_counter_->data++; |
576 decrement_shared_popup_at_destruction_ = true; | 584 decrement_shared_popup_at_destruction_ = true; |
577 } else { | 585 } else { |
(...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2344 media::FilterCollection* collection = new media::FilterCollection(); | 2352 media::FilterCollection* collection = new media::FilterCollection(); |
2345 RenderMediaLog* render_media_log = new RenderMediaLog(); | 2353 RenderMediaLog* render_media_log = new RenderMediaLog(); |
2346 | 2354 |
2347 RenderAudioSourceProvider* audio_source_provider = NULL; | 2355 RenderAudioSourceProvider* audio_source_provider = NULL; |
2348 | 2356 |
2349 // Add in any custom filter factories first. | 2357 // Add in any custom filter factories first. |
2350 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 2358 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
2351 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { | 2359 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { |
2352 // audio_source_provider is a "provider" to WebKit, and a sink | 2360 // audio_source_provider is a "provider" to WebKit, and a sink |
2353 // from the perspective of the audio renderer. | 2361 // from the perspective of the audio renderer. |
2354 audio_source_provider = new RenderAudioSourceProvider(); | 2362 audio_source_provider = new RenderAudioSourceProvider( |
| 2363 audio_device_factory()); |
2355 | 2364 |
2356 // Add the chrome specific audio renderer, using audio_source_provider | 2365 // Add the chrome specific audio renderer, using audio_source_provider |
2357 // as the sink. | 2366 // as the sink. |
2358 media::AudioRendererImpl* audio_renderer = | 2367 media::AudioRendererImpl* audio_renderer = |
2359 new media::AudioRendererImpl(audio_source_provider); | 2368 new media::AudioRendererImpl(audio_source_provider); |
2360 collection->AddAudioRenderer(audio_renderer); | 2369 collection->AddAudioRenderer(audio_renderer); |
2361 } | 2370 } |
2362 | 2371 |
2363 // Currently only cros/arm has any HW video decode support in | 2372 // Currently only cros/arm has any HW video decode support in |
2364 // GpuVideoDecodeAccelerator so we don't even try to use it on other | 2373 // GpuVideoDecodeAccelerator so we don't even try to use it on other |
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3490 return; | 3499 return; |
3491 | 3500 |
3492 #if defined(ENABLE_WEBRTC) | 3501 #if defined(ENABLE_WEBRTC) |
3493 if (!p2p_socket_dispatcher_) | 3502 if (!p2p_socket_dispatcher_) |
3494 p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); | 3503 p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); |
3495 | 3504 |
3496 if (!media_stream_dispatcher_) | 3505 if (!media_stream_dispatcher_) |
3497 media_stream_dispatcher_ = new MediaStreamDispatcher(this); | 3506 media_stream_dispatcher_ = new MediaStreamDispatcher(this); |
3498 | 3507 |
3499 if (!media_stream_impl_) { | 3508 if (!media_stream_impl_) { |
| 3509 DCHECK(audio_device_factory()); |
3500 MediaStreamDependencyFactory* factory = new MediaStreamDependencyFactory( | 3510 MediaStreamDependencyFactory* factory = new MediaStreamDependencyFactory( |
3501 RenderThreadImpl::current()->video_capture_impl_manager()); | 3511 RenderThreadImpl::current()->video_capture_impl_manager()); |
3502 media_stream_impl_ = new MediaStreamImpl( | 3512 media_stream_impl_ = new MediaStreamImpl( |
3503 this, | 3513 this, |
3504 media_stream_dispatcher_, | 3514 media_stream_dispatcher_, |
3505 p2p_socket_dispatcher_, | 3515 p2p_socket_dispatcher_, |
3506 RenderThreadImpl::current()->video_capture_impl_manager(), | 3516 RenderThreadImpl::current()->video_capture_impl_manager(), |
3507 factory); | 3517 factory, |
| 3518 audio_device_factory()); |
3508 } | 3519 } |
3509 #endif | 3520 #endif |
3510 } | 3521 } |
3511 | 3522 |
3512 void RenderViewImpl::didChangeContentsSize(WebFrame* frame, | 3523 void RenderViewImpl::didChangeContentsSize(WebFrame* frame, |
3513 const WebSize& size) { | 3524 const WebSize& size) { |
3514 if (webview()->mainFrame() != frame) | 3525 if (webview()->mainFrame() != frame) |
3515 return; | 3526 return; |
3516 WebView* frameView = frame->view(); | 3527 WebView* frameView = frame->view(); |
3517 if (!frameView) | 3528 if (!frameView) |
(...skipping 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5658 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5669 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
5659 return !!RenderThreadImpl::current()->compositor_thread(); | 5670 return !!RenderThreadImpl::current()->compositor_thread(); |
5660 } | 5671 } |
5661 | 5672 |
5662 void RenderViewImpl::OnJavaBridgeInit() { | 5673 void RenderViewImpl::OnJavaBridgeInit() { |
5663 DCHECK(!java_bridge_dispatcher_); | 5674 DCHECK(!java_bridge_dispatcher_); |
5664 #if defined(ENABLE_JAVA_BRIDGE) | 5675 #if defined(ENABLE_JAVA_BRIDGE) |
5665 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); | 5676 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); |
5666 #endif | 5677 #endif |
5667 } | 5678 } |
OLD | NEW |