OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "sky/shell/gpu/ganesh_context.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" |
| 9 #include "ui/gl/gl_bindings_skia_in_process.h" |
| 10 |
| 11 namespace sky { |
| 12 namespace shell { |
| 13 namespace { |
| 14 |
| 15 // The limit of the number of GPU resources we hold in the GrContext's |
| 16 // GPU cache. |
| 17 const int kMaxGaneshResourceCacheCount = 2048; |
| 18 |
| 19 // The limit of the bytes allocated toward GPU resources in the GrContext's |
| 20 // GPU cache. |
| 21 const size_t kMaxGaneshResourceCacheBytes = 96 * 1024 * 1024; |
| 22 |
| 23 } // namespace |
| 24 |
| 25 GaneshContext::GaneshContext(scoped_refptr<gfx::GLContext> gl_context) |
| 26 : gl_context_(gl_context) { |
| 27 skia::RefPtr<GrGLInterface> interface = |
| 28 skia::AdoptRef(gfx::CreateInProcessSkiaGLBinding()); |
| 29 DCHECK(interface); |
| 30 |
| 31 gr_context_ = skia::AdoptRef(GrContext::Create( |
| 32 kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get()))); |
| 33 DCHECK(gr_context_); |
| 34 gr_context_->setResourceCacheLimits(kMaxGaneshResourceCacheCount, |
| 35 kMaxGaneshResourceCacheBytes); |
| 36 } |
| 37 |
| 38 GaneshContext::~GaneshContext() { |
| 39 } |
| 40 |
| 41 } // namespace shell |
| 42 } // namespace sky |
OLD | NEW |