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

Unified Diff: cc/ganesh_resource_provider.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: Back to a single OffscreenContext class 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: cc/ganesh_resource_provider.cc
diff --git a/cc/ganesh_resource_provider.cc b/cc/ganesh_resource_provider.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3617a4a9696a2a81e3e798db11aafc2f4e28c1bd
--- /dev/null
+++ b/cc/ganesh_resource_provider.cc
@@ -0,0 +1,43 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/ganesh_resource_provider.h"
+
+#include "cc/resource_provider.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
+#include "third_party/skia/include/gpu/GrContext.h"
+
+namespace cc {
+
+GaneshResourceProvider::GaneshResourceProvider()
+ : context3d_(NULL),
+ gr_context_(NULL) {
+}
+
+GaneshResourceProvider::~GaneshResourceProvider() {}
+
+GaneshResourceProvider::ScopedContexts::ScopedContexts(
+ GaneshResourceProvider* ganesh_resource_provider)
+ : ganesh_resource_provider_(ganesh_resource_provider) {
+}
+
+GaneshResourceProvider::ScopedContexts::~ScopedContexts() {}
+
+GaneshResourceProvider::ScopedContextsFlushed::ScopedContextsFlushed(
+ ResourceProvider* resource_provider,
+ GaneshResourceProvider* ganesh_resource_provider)
+ : ScopedContexts(ganesh_resource_provider) {
+ resource_provider->flush();
+}
+
+GaneshResourceProvider::ScopedContextsFlushed::~ScopedContextsFlushed() {
+ // Flush ganesh context so that all the rendered stuff appears on the
+ // texture.
+ if (gr_context()) gr_context()->flush();
piman 2013/02/11 18:45:33 nit: statement goes onto next line.
danakj 2013/02/11 18:58:13 Done.
+ // Flush the GL context so rendering results from this context are
+ // visible in the compositor's context.
+ if (context3d()) context3d()->flush();
piman 2013/02/11 18:45:33 nit: statement goes onto next line.
danakj 2013/02/11 18:58:13 Done.
+}
+
+} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698