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

Side by Side Diff: include/gpu/GrContextFactory.h

Issue 422323002: Some fixes around GrContext::abandonContext: (Closed) Base URL: https://skia.googlesource.com/skia.git@abandon
Patch Set: Address comments Created 6 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | include/gpu/GrTexture.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 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrContextFactory_DEFINED 8 #ifndef GrContextFactory_DEFINED
9 #define GrContextFactory_DEFINED 9 #define GrContextFactory_DEFINED
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 fContexts[i].fGrContext->unref(); 100 fContexts[i].fGrContext->unref();
101 if (NULL != fContexts[i].fGLContext) { 101 if (NULL != fContexts[i].fGLContext) {
102 fContexts[i].fGLContext->unref(); 102 fContexts[i].fGLContext->unref();
103 } 103 }
104 } 104 }
105 fContexts.reset(); 105 fContexts.reset();
106 } 106 }
107 107
108 void abandonContexts() { 108 void abandonContexts() {
109 for (int i = 0; i < fContexts.count(); ++i) { 109 for (int i = 0; i < fContexts.count(); ++i) {
110 SkSafeSetNull(fContexts[i].fGLContext); 110 if (NULL != fContexts[i].fGLContext) {
111 fContexts[i].fGLContext->testAbandon();
112 SkSafeSetNull(fContexts[i].fGLContext);
113 }
111 fContexts[i].fGrContext->abandonContext(); 114 fContexts[i].fGrContext->abandonContext();
112 } 115 }
113 } 116 }
114 117
115 /** 118 /**
116 * Get a GrContext initialized with a type of GL context. It also makes the GL context current. 119 * Get a GrContext initialized with a type of GL context. It also makes the GL context current.
117 */ 120 */
118 GrContext* get(GLContextType type, GrGLStandard forcedGpuAPI = kNone_GrGLSta ndard) { 121 GrContext* get(GLContextType type, GrGLStandard forcedGpuAPI = kNone_GrGLSta ndard) {
119 for (int i = 0; i < fContexts.count(); ++i) { 122 for (int i = 0; i < fContexts.count(); ++i) {
120 if (forcedGpuAPI != kNone_GrGLStandard && 123 if (forcedGpuAPI != kNone_GrGLStandard &&
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 private: 204 private:
202 struct GPUContext { 205 struct GPUContext {
203 GLContextType fType; 206 GLContextType fType;
204 SkGLContextHelper* fGLContext; 207 SkGLContextHelper* fGLContext;
205 GrContext* fGrContext; 208 GrContext* fGrContext;
206 }; 209 };
207 SkTArray<GPUContext, true> fContexts; 210 SkTArray<GPUContext, true> fContexts;
208 }; 211 };
209 212
210 #endif 213 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrTexture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698