OLD | NEW |
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 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrContextOptions.h" | 10 #include "GrContextOptions.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 delete fResourceProvider; | 111 delete fResourceProvider; |
112 delete fResourceCache; | 112 delete fResourceCache; |
113 delete fBatchFontCache; | 113 delete fBatchFontCache; |
114 | 114 |
115 fGpu->unref(); | 115 fGpu->unref(); |
116 fCaps->unref(); | 116 fCaps->unref(); |
117 } | 117 } |
118 | 118 |
119 void GrContext::abandonContext() { | 119 void GrContext::abandonContext() { |
120 fResourceProvider->abandon(); | 120 fResourceProvider->abandon(); |
| 121 |
| 122 // Need to abandon the drawing manager first so all the render targets |
| 123 // will be released/forgotten before they too are abandoned. |
| 124 fDrawingManager->abandon(); |
| 125 |
121 // abandon first to so destructors | 126 // abandon first to so destructors |
122 // don't try to free the resources in the API. | 127 // don't try to free the resources in the API. |
123 fResourceCache->abandonAll(); | 128 fResourceCache->abandonAll(); |
124 | 129 |
125 fGpu->contextAbandoned(); | 130 fGpu->contextAbandoned(); |
126 | 131 |
127 fDrawingManager->abandon(); | |
128 | |
129 fBatchFontCache->freeAll(); | 132 fBatchFontCache->freeAll(); |
130 fLayerCache->freeAll(); | 133 fLayerCache->freeAll(); |
131 fTextBlobCache->freeAll(); | 134 fTextBlobCache->freeAll(); |
132 } | 135 } |
133 | 136 |
134 void GrContext::resetContext(uint32_t state) { | 137 void GrContext::resetContext(uint32_t state) { |
135 fGpu->markContextDirty(state); | 138 fGpu->markContextDirty(state); |
136 } | 139 } |
137 | 140 |
138 void GrContext::freeGpuResources() { | 141 void GrContext::freeGpuResources() { |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 | 621 |
619 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes)
{ | 622 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes)
{ |
620 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 623 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
621 } | 624 } |
622 | 625 |
623 ////////////////////////////////////////////////////////////////////////////// | 626 ////////////////////////////////////////////////////////////////////////////// |
624 | 627 |
625 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 628 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
626 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 629 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
627 } | 630 } |
OLD | NEW |