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

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: Resolve comments, rebase to ToT 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 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 e422f3c130832ef3d5e657ec8809d8c15d1919cd..632eb66c551591448d7e651224f4c9bdce530ead 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -151,6 +151,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)
@@ -246,7 +248,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
@@ -262,7 +264,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;
@@ -270,7 +272,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";
@@ -305,7 +307,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)) {
@@ -332,15 +334,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;
@@ -472,10 +474,24 @@ CommonNavigationParams MakeCommonNavigationParams(
return params;
}
+#if !defined(OS_ANDROID)
+media::Context3DProvider GetSharedMainThreadContext3DProvider() {
+ RenderThreadImpl* render_thread = RenderThreadImpl::current();
+ DCHECK(render_thread);
scherkus (not reviewing) 2014/10/30 20:40:11 nit: I'm not sure how useful these DCHECKs are in
dshwang 2014/10/31 09:29:16 I agree. I removed DCHECKs.
+ DCHECK(render_thread->message_loop() == base::MessageLoop::current());
+ cc::ContextProvider* provider =
+ render_thread->SharedMainThreadContextProvider().get();
+ if (!provider)
+ return {nullptr, nullptr};
+ return {provider->ContextGL(), provider->GrContext()};
+}
+#endif
+
+RenderFrameImpl* (*g_create_render_frame_impl)(RenderViewImpl*,
+ int32) = nullptr;
+
} // namespace
-static RenderFrameImpl* (*g_create_render_frame_impl)(RenderViewImpl*, int32) =
- NULL;
// static
RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view,
@@ -1702,6 +1718,7 @@ blink::WebMediaPlayer* RenderFrameImpl::createMediaPlayer(
render_thread->GetMediaThreadTaskRunner(),
render_thread->compositor_message_loop_proxy(),
base::Bind(&EncryptedMediaPlayerSupportImpl::Create),
+ base::Bind(&GetSharedMainThreadContext3DProvider),
initial_cdm);
return new media::WebMediaPlayerImpl(
frame, client, weak_factory_.GetWeakPtr(), nullptr, params);

Powered by Google App Engine
This is Rietveld 408576698