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

Side by Side Diff: mojo/skia/ganesh_context.cc

Issue 753643002: Enable the Sky compositor again (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Moar comments Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | sky/compositor/layer_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/skia/ganesh_context.h" 5 #include "mojo/skia/ganesh_context.h"
6 6
7 #include "gpu/command_buffer/client/gles2_lib.h" 7 #include "gpu/command_buffer/client/gles2_lib.h"
8 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" 8 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h"
9 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" 9 #include "third_party/skia/include/gpu/gl/GrGLInterface.h"
10 10
(...skipping 28 matching lines...) Expand all
39 DCHECK(interface); 39 DCHECK(interface);
40 40
41 context_ = skia::AdoptRef(GrContext::Create( 41 context_ = skia::AdoptRef(GrContext::Create(
42 kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get()))); 42 kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get())));
43 DCHECK(context_); 43 DCHECK(context_);
44 context_->setResourceCacheLimits(kMaxGaneshResourceCacheCount, 44 context_->setResourceCacheLimits(kMaxGaneshResourceCacheCount,
45 kMaxGaneshResourceCacheBytes); 45 kMaxGaneshResourceCacheBytes);
46 } 46 }
47 47
48 GaneshContext::~GaneshContext() { 48 GaneshContext::~GaneshContext() {
49 if (context_) {
50 Scope scope(this);
51 context_.clear();
52 }
49 if (gl_context_.get()) 53 if (gl_context_.get())
50 gl_context_->RemoveObserver(this); 54 gl_context_->RemoveObserver(this);
51 } 55 }
52 56
53 bool GaneshContext::InScope() const { 57 bool GaneshContext::InScope() const {
54 return gles2::GetGLContext() == gl_context_->gl(); 58 return gles2::GetGLContext() == gl_context_->gl();
55 } 59 }
56 60
57 void GaneshContext::OnContextLost() { 61 void GaneshContext::OnContextLost() {
58 context_->abandonContext(); 62 context_->abandonContext();
59 context_.clear(); 63 context_.clear();
60 gl_context_.reset(); 64 gl_context_.reset();
61 } 65 }
62 66
63 } // namespace mojo 67 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | sky/compositor/layer_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698