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

Side by Side Diff: src/gpu/GrContext.cpp

Issue 14049028: Exit ~GrContext early if GrContext::init() failed. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 int GrContext::GetThreadInstanceCount() { 134 int GrContext::GetThreadInstanceCount() {
135 return THREAD_INSTANCE_COUNT; 135 return THREAD_INSTANCE_COUNT;
136 } 136 }
137 137
138 GrContext::~GrContext() { 138 GrContext::~GrContext() {
139 for (int i = 0; i < fCleanUpData.count(); ++i) { 139 for (int i = 0; i < fCleanUpData.count(); ++i) {
140 (*fCleanUpData[i].fFunc)(this, fCleanUpData[i].fInfo); 140 (*fCleanUpData[i].fFunc)(this, fCleanUpData[i].fInfo);
141 } 141 }
142 142
143 if (NULL == fGpu) {
144 return;
145 }
146
143 this->flush(); 147 this->flush();
144 148
145 // Since the gpu can hold scratch textures, give it a chance to let go 149 // Since the gpu can hold scratch textures, give it a chance to let go
146 // of them before freeing the texture cache 150 // of them before freeing the texture cache
147 fGpu->purgeResources(); 151 fGpu->purgeResources();
148 152
149 delete fTextureCache; 153 delete fTextureCache;
150 fTextureCache = NULL; 154 fTextureCache = NULL;
151 delete fFontCache; 155 delete fFontCache;
152 delete fDrawBuffer; 156 delete fDrawBuffer;
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 return srcTexture; 1789 return srcTexture;
1786 } 1790 }
1787 } 1791 }
1788 1792
1789 /////////////////////////////////////////////////////////////////////////////// 1793 ///////////////////////////////////////////////////////////////////////////////
1790 #if GR_CACHE_STATS 1794 #if GR_CACHE_STATS
1791 void GrContext::printCacheStats() const { 1795 void GrContext::printCacheStats() const {
1792 fTextureCache->printStats(); 1796 fTextureCache->printStats();
1793 } 1797 }
1794 #endif 1798 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698