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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 294043015: Move creation of MediaStream renders from MediaStreamImpl to MediaStreamRenderFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review. Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index a7a3245b9a8777c4814053beef8bcd636bf0ebf9..ff70722d12e48546b900e888058123e641c24929 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -91,6 +91,7 @@
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebGlyphCache.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
+#include "third_party/WebKit/public/web/WebMediaStreamRegistry.h"
#include "third_party/WebKit/public/web/WebNavigationPolicy.h"
#include "third_party/WebKit/public/web/WebPlugin.h"
#include "third_party/WebKit/public/web/WebPluginParams.h"
@@ -402,7 +403,6 @@ RenderFrameImpl::RenderFrameImpl(RenderViewImpl* render_view, int routing_id)
selection_range_(gfx::Range::InvalidRange()),
handling_select_range_(false),
notification_provider_(NULL),
- media_stream_client_(NULL),
web_user_media_client_(NULL),
weak_factory_(this) {
RenderThread::Get()->AddRoute(routing_id_, this);
@@ -635,13 +635,6 @@ void RenderFrameImpl::OnImeConfirmComposition(
#endif // ENABLE_PLUGINS
-void RenderFrameImpl::SetMediaStreamClientForTesting(
- MediaStreamClient* media_stream_client) {
- DCHECK(!media_stream_client_);
- DCHECK(!web_user_media_client_);
- media_stream_client_ = media_stream_client;
-}
-
bool RenderFrameImpl::Send(IPC::Message* message) {
if (is_detaching_) {
delete message;
@@ -1375,9 +1368,10 @@ blink::WebMediaPlayer* RenderFrameImpl::createMediaPlayer(
blink::WebLocalFrame* frame,
const blink::WebURL& url,
blink::WebMediaPlayerClient* client) {
- WebMediaPlayer* player = CreateWebMediaPlayerForMediaStream(url, client);
- if (player)
- return player;
+ blink::WebMediaStream web_stream(
+ blink::WebMediaStreamRegistry::lookupMediaStreamDescriptor(url));
+ if (!web_stream.isNull())
+ return CreateWebMediaPlayerForMediaStream(url, client);
#if defined(OS_ANDROID)
return CreateAndroidWebMediaPlayer(url, client);
@@ -2733,7 +2727,7 @@ void RenderFrameImpl::willStartUsingPeerConnectionHandler(
blink::WebUserMediaClient* RenderFrameImpl::userMediaClient() {
// This can happen in tests, in which case it's OK to return NULL.
- if (!InitializeMediaStreamClient())
+ if (!InitializeUserMediaClient())
return NULL;
return web_user_media_client_;
@@ -3397,8 +3391,8 @@ void RenderFrameImpl::SyncSelectionIfRequired() {
GetRenderWidget()->UpdateSelectionBounds();
}
-bool RenderFrameImpl::InitializeMediaStreamClient() {
- if (media_stream_client_)
+bool RenderFrameImpl::InitializeUserMediaClient() {
+ if (web_user_media_client_)
return true;
if (!RenderThreadImpl::current()) // Will be NULL during unit tests.
@@ -3419,7 +3413,6 @@ bool RenderFrameImpl::InitializeMediaStreamClient() {
render_view_.get(),
render_view_->media_stream_dispatcher_,
RenderThreadImpl::current()->GetPeerConnectionDependencyFactory());
- media_stream_client_ = media_stream_impl;
web_user_media_client_ = media_stream_impl;
return true;
#else
@@ -3431,21 +3424,24 @@ WebMediaPlayer* RenderFrameImpl::CreateWebMediaPlayerForMediaStream(
const blink::WebURL& url,
WebMediaPlayerClient* client) {
#if defined(ENABLE_WEBRTC)
no longer working on chromium 2014/05/27 12:30:36 can you improve the #ifs here? like #if !defined
perkj_chrome 2014/05/27 13:27:03 Possibly. But it means that the WebMediaPlayerMS m
- if (!InitializeMediaStreamClient()) {
- LOG(ERROR) << "Failed to initialize MediaStreamClient";
- return NULL;
- }
- if (media_stream_client_->IsMediaStream(url)) {
#if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
- bool found_neon =
- (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
- UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon);
+ bool found_neon =
+ (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
+ UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon);
#endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
- return new WebMediaPlayerMS(frame_, client, weak_factory_.GetWeakPtr(),
- media_stream_client_, new RenderMediaLog());
- }
-#endif // defined(ENABLE_WEBRTC)
+ return new WebMediaPlayerMS(frame_, client, weak_factory_.GetWeakPtr(),
+ new RenderMediaLog(),
+ CreateRendererFactory());
+#else
return NULL;
+#endif // defined(ENABLE_WEBRTC)
+}
+
+scoped_ptr<MediaStreamRendererFactory>
+RenderFrameImpl::CreateRendererFactory() {
+ scoped_ptr<MediaStreamRendererFactory> factory(
no longer working on chromium 2014/05/27 12:30:36 nit, simply do return scoped_ptr<MediaStreamRender
perkj_chrome 2014/05/27 13:27:03 Done.
+ new MediaStreamRendererFactory());
+ return factory.Pass();
}
#if defined(OS_ANDROID)

Powered by Google App Engine
This is Rietveld 408576698