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

Unified Diff: sky/shell/gpu/ganesh_context.cc

Issue 891143002: Teach SkyShell how to draw with Ganesh (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Moar comments Created 5 years, 11 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
« no previous file with comments | « sky/shell/gpu/ganesh_context.h ('k') | sky/shell/gpu/ganesh_surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/shell/gpu/ganesh_context.cc
diff --git a/sky/shell/gpu/ganesh_context.cc b/sky/shell/gpu/ganesh_context.cc
new file mode 100644
index 0000000000000000000000000000000000000000..77833b34c76c828ac25cf31aa0321042a0cc2de9
--- /dev/null
+++ b/sky/shell/gpu/ganesh_context.cc
@@ -0,0 +1,42 @@
+// Copyright 2015 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 "sky/shell/gpu/ganesh_context.h"
+
+#include "base/logging.h"
+#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
+#include "ui/gl/gl_bindings_skia_in_process.h"
+
+namespace sky {
+namespace shell {
+namespace {
+
+// The limit of the number of GPU resources we hold in the GrContext's
+// GPU cache.
+const int kMaxGaneshResourceCacheCount = 2048;
+
+// The limit of the bytes allocated toward GPU resources in the GrContext's
+// GPU cache.
+const size_t kMaxGaneshResourceCacheBytes = 96 * 1024 * 1024;
+
+} // namespace
+
+GaneshContext::GaneshContext(scoped_refptr<gfx::GLContext> gl_context)
+ : gl_context_(gl_context) {
+ skia::RefPtr<GrGLInterface> interface =
+ skia::AdoptRef(gfx::CreateInProcessSkiaGLBinding());
+ DCHECK(interface);
+
+ gr_context_ = skia::AdoptRef(GrContext::Create(
+ kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get())));
+ DCHECK(gr_context_);
+ gr_context_->setResourceCacheLimits(kMaxGaneshResourceCacheCount,
+ kMaxGaneshResourceCacheBytes);
+}
+
+GaneshContext::~GaneshContext() {
+}
+
+} // namespace shell
+} // namespace sky
« no previous file with comments | « sky/shell/gpu/ganesh_context.h ('k') | sky/shell/gpu/ganesh_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698