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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 445013002: media: Optimize HW Video to 2D Canvas copy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK context_provider and rebase to ToT Created 6 years, 1 month 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 abb8320f7210e424bb17b3b9ba545e271f62d67d..5e7db41181101d2a22b394ad292ba5eb7e852c83 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -153,6 +153,8 @@
#include "content/renderer/media/android/renderer_media_player_manager.h"
#include "content/renderer/media/android/stream_texture_factory_impl.h"
#include "content/renderer/media/android/webmediaplayer_android.h"
+#else
+#include "webkit/common/gpu/context_provider_web_context.h"
#endif
#if defined(ENABLE_PEPPER_CDMS)
@@ -248,7 +250,7 @@ void GetRedirectChain(WebDataSource* ds, std::vector<GURL>* result) {
// Returns the original request url. If there is no redirect, the original
// url is the same as ds->request()->url(). If the WebDataSource belongs to a
// frame was loaded by loadData, the original url will be ds->unreachableURL()
-static GURL GetOriginalRequestURL(WebDataSource* ds) {
+GURL GetOriginalRequestURL(WebDataSource* ds) {
// WebDataSource has unreachable URL means that the frame is loaded through
// blink::WebFrame::loadData(), and the base URL will be in the redirect
// chain. However, we never visited the baseURL. So in this case, we should
@@ -264,7 +266,7 @@ static GURL GetOriginalRequestURL(WebDataSource* ds) {
return ds->originalRequest().url();
}
-NOINLINE static void CrashIntentionally() {
+NOINLINE void CrashIntentionally() {
// NOTE(shess): Crash directly rather than using NOTREACHED() so
// that the signature is easier to triage in crash reports.
volatile int* zero = NULL;
@@ -272,7 +274,7 @@ NOINLINE static void CrashIntentionally() {
}
#if defined(ADDRESS_SANITIZER) || defined(SYZYASAN)
-NOINLINE static void MaybeTriggerAsanError(const GURL& url) {
+NOINLINE void MaybeTriggerAsanError(const GURL& url) {
// NOTE(rogerm): We intentionally perform an invalid heap access here in
// order to trigger an Address Sanitizer (ASAN) error report.
const char kCrashDomain[] = "crash";
@@ -307,7 +309,7 @@ NOINLINE static void MaybeTriggerAsanError(const GURL& url) {
}
#endif // ADDRESS_SANITIZER || SYZYASAN
-static void MaybeHandleDebugURL(const GURL& url) {
+void MaybeHandleDebugURL(const GURL& url) {
if (!url.SchemeIs(kChromeUIScheme))
return;
if (url == GURL(kChromeUICrashURL)) {
@@ -334,15 +336,15 @@ static void MaybeHandleDebugURL(const GURL& url) {
}
// Returns false unless this is a top-level navigation.
-static bool IsTopLevelNavigation(WebFrame* frame) {
+bool IsTopLevelNavigation(WebFrame* frame) {
return frame->parent() == NULL;
}
// Returns false unless this is a top-level navigation that crosses origins.
-static bool IsNonLocalTopLevelNavigation(const GURL& url,
- WebFrame* frame,
- WebNavigationType type,
- bool is_form_post) {
+bool IsNonLocalTopLevelNavigation(const GURL& url,
+ WebFrame* frame,
+ WebNavigationType type,
+ bool is_form_post) {
if (!IsTopLevelNavigation(frame))
return false;
@@ -474,10 +476,21 @@ CommonNavigationParams MakeCommonNavigationParams(
return params;
}
+#if !defined(OS_ANDROID)
+media::Context3DProvider GetSharedMainThreadContext3DProvider() {
+ cc::ContextProvider* provider =
+ RenderThreadImpl::current()->SharedMainThreadContextProvider().get();
+ if (!provider)
+ return {nullptr, nullptr};
jamesr 2014/11/13 20:39:16 please don't use this initialization syntax
+ return {provider->ContextGL(), provider->GrContext()};
+}
+#endif
+
+RenderFrameImpl* (*g_create_render_frame_impl)(RenderViewImpl*,
+ int32) = nullptr;
jamesr 2014/11/13 20:39:16 could you use a type alias to make this more reada
+
} // namespace
-static RenderFrameImpl* (*g_create_render_frame_impl)(RenderViewImpl*, int32) =
- NULL;
// static
RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view,
@@ -1739,13 +1752,12 @@ blink::WebMediaPlayer* RenderFrameImpl::createMediaPlayer(
static_cast<RenderFrame*>(this)),
render_thread->GetAudioRendererMixerManager()->CreateInput(
render_view_->routing_id_, routing_id_),
- *render_thread->GetAudioHardwareConfig(),
- new RenderMediaLog(),
+ *render_thread->GetAudioHardwareConfig(), new RenderMediaLog(),
render_thread->GetGpuFactories(),
render_thread->GetMediaThreadTaskRunner(),
render_thread->compositor_message_loop_proxy(),
base::Bind(&EncryptedMediaPlayerSupportImpl::Create),
- initial_cdm);
+ base::Bind(&GetSharedMainThreadContext3DProvider), initial_cdm);
return new media::WebMediaPlayerImpl(
frame, client, weak_factory_.GetWeakPtr(), nullptr, params);
#endif // defined(OS_ANDROID)

Powered by Google App Engine
This is Rietveld 408576698