diff options
author | Chris Dalton <csmartdalton@google.com> | 2017-05-05 11:26:15 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-05 15:53:36 +0000 |
commit | fe199b7d512a7cfc56deaaa134260e1d47a1e7e0 (patch) | |
tree | 24fc11a386071faf994735e193c8f37095a589d4 /tools | |
parent | 9d687dfa3e341bc4bae7806b6e3262ae3d441889 (diff) |
Add postFlush call to GrOnFlushCallbackObject
Adds a new postFlush method and renames the class to
GrOnFlushCallbackObject. Also removes the ref counting in favor of
making the callback object a purely virtual interface. ref/unref on the
callback interface would conflict with existing ref/unref methods on the
subclass. It is now the caller’s responsibility to ensure the lifetime
of the callback is tied to that of the context.
Bug: skia:
Change-Id: I2fc1f98c700032e296a36f3a9a09c0753ab47aea
Reviewed-on: https://skia-review.googlesource.com/15463
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gpu/GrTest.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp index f5459b1bba..6dc21bb836 100644 --- a/tools/gpu/GrTest.cpp +++ b/tools/gpu/GrTest.cpp @@ -9,6 +9,7 @@ #include "GrBackendSurface.h" #include "GrContextOptions.h" +#include "GrContextPriv.h" #include "GrDrawOpAtlas.h" #include "GrDrawingManager.h" #include "GrGpuResourceCacheAccess.h" @@ -26,6 +27,8 @@ #include "text/GrAtlasGlyphCache.h" #include "text/GrTextBlobCache.h" +#include <algorithm> + namespace GrTest { void SetupAlwaysEvictAtlas(GrContext* context) { // These sizes were selected because they allow each atlas to hold a single plot and will thus @@ -436,3 +439,15 @@ void GrContext::initMockContext() { // resources in the buffer pools. fDrawingManager->abandon(); } + +void GrContextPriv::testingOnly_flushAndRemoveOnFlushCallbackObject(GrOnFlushCallbackObject* cb) { + fContext->flush(); + fContext->fDrawingManager->testingOnly_removeOnFlushCallbackObject(cb); +} + +void GrDrawingManager::testingOnly_removeOnFlushCallbackObject(GrOnFlushCallbackObject* cb) { + int n = std::find(fOnFlushCBObjects.begin(), fOnFlushCBObjects.end(), cb) - + fOnFlushCBObjects.begin(); + SkASSERT(n < fOnFlushCBObjects.count()); + fOnFlushCBObjects.removeShuffle(n); +} |