diff options
author | Greg Daniel <egdaniel@google.com> | 2018-03-08 15:27:36 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-08 21:05:21 +0000 |
commit | 4684f82ebca85d4c7043e5c1028e34cf5631da32 (patch) | |
tree | 6e640d1b212ab614fa19ccd4e43c5adff440dacd /src/gpu/GrUninstantiateProxyTracker.cpp | |
parent | 3adc12213b2d1efbe417476517ff3381af17a311 (diff) |
Add ability to uninstantiate lazy proxies after every flush.
Bug: skia:
Change-Id: Id32540cda54a9c5e3e6cb721776699be3cc8ac1a
Reviewed-on: https://skia-review.googlesource.com/113263
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrUninstantiateProxyTracker.cpp')
-rw-r--r-- | src/gpu/GrUninstantiateProxyTracker.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/gpu/GrUninstantiateProxyTracker.cpp b/src/gpu/GrUninstantiateProxyTracker.cpp new file mode 100644 index 0000000000..c4da21b9dc --- /dev/null +++ b/src/gpu/GrUninstantiateProxyTracker.cpp @@ -0,0 +1,30 @@ +/* + * Copyright 2018 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "GrUninstantiateProxyTracker.h" + +#include "GrSurfaceProxy.h" +#include "GrSurfaceProxyPriv.h" + +void GrUninstantiateProxyTracker::addProxy(GrSurfaceProxy* proxy) { +#ifdef SK_DEBUG + using LazyType = GrSurfaceProxy::LazyInstantiationType; + SkASSERT(LazyType::kUninstantiate == proxy->priv().lazyInstantiationType()); + for (int i = 0; i < fProxies.count(); ++i) { + SkASSERT(proxy != fProxies[i]); + } +#endif + fProxies.push_back(proxy); +} + +void GrUninstantiateProxyTracker::uninstantiateAllProxies() { + for (int i = 0; i < fProxies.count(); ++i) { + GrSurfaceProxy* proxy = fProxies[i]; + SkASSERT(proxy->priv().isSafeToUninstantiate()); + proxy->deInstantiate(); + } +} |