OLD | NEW |
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 #ifndef MOJO_SKIA_GANESH_CONTEXT_H_ | 5 #ifndef MOJO_SKIA_GANESH_CONTEXT_H_ |
6 #define MOJO_SKIA_GANESH_CONTEXT_H_ | 6 #define MOJO_SKIA_GANESH_CONTEXT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "mojo/gpu/gl_context.h" | 10 #include "mojo/gpu/gl_context.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 class Scope { | 24 class Scope { |
25 public: | 25 public: |
26 explicit Scope(GaneshContext*); | 26 explicit Scope(GaneshContext*); |
27 ~Scope(); | 27 ~Scope(); |
28 | 28 |
29 private: | 29 private: |
30 gpu::gles2::GLES2Interface* previous_; | 30 gpu::gles2::GLES2Interface* previous_; |
31 }; | 31 }; |
32 | 32 |
33 explicit GaneshContext(base::WeakPtr<GLContext> gl_context); | 33 explicit GaneshContext(base::WeakPtr<GLContext> gl_context); |
34 ~GaneshContext(); | 34 ~GaneshContext() override; |
35 | 35 |
36 // Note: You must be in a GaneshContext::Scope to use GrContext. | 36 // Note: You must be in a GaneshContext::Scope to use GrContext. |
37 GrContext* gr() const { | 37 GrContext* gr() const { |
38 DCHECK(InScope()); | 38 DCHECK(InScope()); |
39 return context_.get(); | 39 return context_.get(); |
40 } | 40 } |
41 | 41 |
42 private: | 42 private: |
43 bool InScope() const; | 43 bool InScope() const; |
44 void OnContextLost() override; | 44 void OnContextLost() override; |
45 | 45 |
46 base::WeakPtr<GLContext> gl_context_; | 46 base::WeakPtr<GLContext> gl_context_; |
47 skia::RefPtr<GrContext> context_; | 47 skia::RefPtr<GrContext> context_; |
48 | 48 |
49 DISALLOW_COPY_AND_ASSIGN(GaneshContext); | 49 DISALLOW_COPY_AND_ASSIGN(GaneshContext); |
50 }; | 50 }; |
51 | 51 |
52 } // namespace mojo | 52 } // namespace mojo |
53 | 53 |
54 #endif // MOJO_SKIA_GANESH_CONTEXT_H_ | 54 #endif // MOJO_SKIA_GANESH_CONTEXT_H_ |
OLD | NEW |