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

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

Issue 1538013002: Add Drawing Manager guards against re-entrant flushes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 | « src/gpu/GrDrawingManager.h ('k') | 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 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 #include "GrDrawContext.h" 8 #include "GrDrawContext.h"
9 #include "GrDrawingManager.h" 9 #include "GrDrawingManager.h"
10 #include "GrDrawTarget.h" 10 #include "GrDrawTarget.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 void GrDrawingManager::reset() { 59 void GrDrawingManager::reset() {
60 for (int i = 0; i < fDrawTargets.count(); ++i) { 60 for (int i = 0; i < fDrawTargets.count(); ++i) {
61 fDrawTargets[i]->reset(); 61 fDrawTargets[i]->reset();
62 } 62 }
63 fFlushState.reset(); 63 fFlushState.reset();
64 } 64 }
65 65
66 void GrDrawingManager::flush() { 66 void GrDrawingManager::flush() {
67 if (fFlushing) {
68 return;
69 }
70 fFlushing = true;
71
67 SkDEBUGCODE(bool result =) 72 SkDEBUGCODE(bool result =)
68 SkTTopoSort<GrDrawTarget, GrDrawTarget::TopoSortTraits>( &fDrawTargets); 73 SkTTopoSort<GrDrawTarget, GrDrawTarget::TopoSortTraits>( &fDrawTargets);
69 SkASSERT(result); 74 SkASSERT(result);
70 75
71 #if 0 76 #if 0
72 for (int i = 0; i < fDrawTargets.count(); ++i) { 77 for (int i = 0; i < fDrawTargets.count(); ++i) {
73 SkDEBUGCODE(fDrawTargets[i]->dump();) 78 SkDEBUGCODE(fDrawTargets[i]->dump();)
74 } 79 }
75 #endif 80 #endif
76 81
(...skipping 23 matching lines...) Expand all
100 SkASSERT(fDrawTargets.count() == 1); 105 SkASSERT(fDrawTargets.count() == 1);
101 // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnm arked check 106 // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnm arked check
102 // won't bark 107 // won't bark
103 fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag); 108 fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag);
104 } 109 }
105 #else 110 #else
106 fDrawTargets.reset(); 111 fDrawTargets.reset();
107 #endif 112 #endif
108 113
109 fFlushState.reset(); 114 fFlushState.reset();
115 fFlushing = false;
110 } 116 }
111 117
112 GrTextContext* GrDrawingManager::textContext(const SkSurfaceProps& props, 118 GrTextContext* GrDrawingManager::textContext(const SkSurfaceProps& props,
113 GrRenderTarget* rt) { 119 GrRenderTarget* rt) {
114 if (this->abandoned()) { 120 if (this->abandoned()) {
115 return nullptr; 121 return nullptr;
116 } 122 }
117 123
118 SkASSERT(props.pixelGeometry() < kNumPixelGeometries); 124 SkASSERT(props.pixelGeometry() < kNumPixelGeometries);
119 bool useDIF = props.isUseDeviceIndependentFonts(); 125 bool useDIF = props.isUseDeviceIndependentFonts();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 194 }
189 195
190 GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt, 196 GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt,
191 const SkSurfaceProps* surfaceProps) { 197 const SkSurfaceProps* surfaceProps) {
192 if (this->abandoned()) { 198 if (this->abandoned()) {
193 return nullptr; 199 return nullptr;
194 } 200 }
195 201
196 return new GrDrawContext(this, rt, surfaceProps); 202 return new GrDrawContext(this, rt, surfaceProps);
197 } 203 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawingManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698