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 | |
126 // abandon first to so destructors | 121 // abandon first to so destructors |
127 // don't try to free the resources in the API. | 122 // don't try to free the resources in the API. |
128 fResourceCache->abandonAll(); | 123 fResourceCache->abandonAll(); |
129 | 124 |
130 fGpu->contextAbandoned(); | 125 fGpu->contextAbandoned(); |
131 | 126 |
| 127 fDrawingManager->abandon(); |
| 128 |
132 fBatchFontCache->freeAll(); | 129 fBatchFontCache->freeAll(); |
133 fLayerCache->freeAll(); | 130 fLayerCache->freeAll(); |
134 fTextBlobCache->freeAll(); | 131 fTextBlobCache->freeAll(); |
135 } | 132 } |
136 | 133 |
137 void GrContext::resetContext(uint32_t state) { | 134 void GrContext::resetContext(uint32_t state) { |
138 fGpu->markContextDirty(state); | 135 fGpu->markContextDirty(state); |
139 } | 136 } |
140 | 137 |
141 void GrContext::freeGpuResources() { | 138 void GrContext::freeGpuResources() { |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 | 618 |
622 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes)
{ | 619 void GrContext::setResourceCacheLimits(int maxTextures, size_t maxTextureBytes)
{ |
623 fResourceCache->setLimits(maxTextures, maxTextureBytes); | 620 fResourceCache->setLimits(maxTextures, maxTextureBytes); |
624 } | 621 } |
625 | 622 |
626 ////////////////////////////////////////////////////////////////////////////// | 623 ////////////////////////////////////////////////////////////////////////////// |
627 | 624 |
628 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { | 625 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const { |
629 fResourceCache->dumpMemoryStatistics(traceMemoryDump); | 626 fResourceCache->dumpMemoryStatistics(traceMemoryDump); |
630 } | 627 } |
OLD | NEW |