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

Unified Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 12212007: cc: Route offscreen context creation for compositor to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo Created 7 years, 10 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/browser/renderer_host/compositor_impl_android.cc
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index 7954175feea775ff47621cde2141af9af49b1bd5..2b3a800f83734fb6741671e13717ce2d427f7d57 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -11,6 +11,7 @@
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "cc/context_provider.h"
#include "cc/input_handler.h"
#include "cc/layer.h"
#include "cc/layer_tree_host.h"
@@ -326,6 +327,38 @@ void CompositorImpl::scheduleComposite() {
client_->ScheduleComposite();
}
+class NullContextProvider : public cc::ContextProvider {
+ virtual bool InitializeOnMainThread() { return false; }
+ virtual bool BindToCurrentThread() { return false; }
+ virtual WebKit::WebGraphicsContext3D* Context3d() { return NULL; }
+ virtual class GrContext* GrContext() { return NULL; }
+ virtual void VerifyContexts() {}
+ protected:
+ virtual ~NullContextProvider() {}
+};
+
+scoped_refptr<cc::ContextProvider>
+CompositorImpl::OffscreenContextProviderForMainThread() {
+ // There is no support for offscreen contexts, or compositor filters that
+ // would require them in this compositor instance. If they are needed,
+ // then implement a context provider that provides contexts from
+ // ImageTransportSurfaceAndroid.
+ if (!null_offscreen_context_provider_)
+ null_offscreen_context_provider_ = new NullContextProvider();
+ return null_offscreen_context_provider_;
+}
+
+scoped_refptr<cc::ContextProvider>
+CompositorImpl::OffscreenContextProviderForCompositorThread() {
+ // There is no support for offscreen contexts, or compositor filters that
+ // would require them in this compositor instance. If they are needed,
+ // then implement a context provider that provides contexts from
+ // ImageTransportSurfaceAndroid.
+ if (!null_offscreen_context_provider_)
+ null_offscreen_context_provider_ = new NullContextProvider();
+ return null_offscreen_context_provider_;
+}
+
void CompositorImpl::OnViewContextSwapBuffersPosted() {
TRACE_EVENT0("compositor", "CompositorImpl::OnViewContextSwapBuffersPosted");
}

Powered by Google App Engine
This is Rietveld 408576698