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

Unified Diff: src/gpu/GrDrawingManager.h

Issue 2307053002: Restructure flushing relationship between GrContext, GrDrawingManager, and GrResourceCache. (Closed)
Patch Set: Fix uninit vars Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrDrawContext.cpp ('k') | src/gpu/GrDrawingManager.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawingManager.h
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index 745820f439b62ff2db98a3e9d5edb4c194faba8b..449044f85dce1349d23258aa650d1c237d73b681 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -13,6 +13,7 @@
#include "GrBatchFlushState.h"
#include "GrPathRendererChain.h"
#include "GrPathRenderer.h"
+#include "GrResourceCache.h"
#include "SkTDArray.h"
class GrContext;
@@ -49,11 +50,19 @@ public:
GrPathRendererChain::DrawType drawType,
GrPathRenderer::StencilSupport* stencilSupport = NULL);
+ void flushIfNecessary() {
+ if (fContext->getResourceCache()->requestsFlush()) {
+ this->internalFlush(GrResourceCache::kCacheRequested);
+ } else if (fIsImmediateMode) {
+ this->internalFlush(GrResourceCache::kImmediateMode);
+ }
+ }
+
static bool ProgramUnitTest(GrContext* context, int maxStages);
private:
GrDrawingManager(GrContext* context, const GrDrawTarget::Options& optionsForDrawTargets,
- GrSingleOwner* singleOwner)
+ bool isImmediateMode, GrSingleOwner* singleOwner)
: fContext(context)
, fOptionsForDrawTargets(optionsForDrawTargets)
, fSingleOwner(singleOwner)
@@ -62,14 +71,15 @@ private:
, fPathRendererChain(nullptr)
, fSoftwarePathRenderer(nullptr)
, fFlushState(context->getGpu(), context->resourceProvider())
- , fFlushing(false) {
+ , fFlushing(false)
+ , fIsImmediateMode(isImmediateMode) {
}
void abandon();
void cleanup();
void reset();
- /** Returns true if there was anything to flush and false otherwise */
- bool flush();
+ void flush() { this->internalFlush(GrResourceCache::FlushType::kExternal); }
+ void internalFlush(GrResourceCache::FlushType);
friend class GrContext; // for access to: ctor, abandon, reset & flush
@@ -92,6 +102,8 @@ private:
GrBatchFlushState fFlushState;
bool fFlushing;
+
+ bool fIsImmediateMode;
};
#endif
« no previous file with comments | « src/gpu/GrDrawContext.cpp ('k') | src/gpu/GrDrawingManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698