aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrAllocator.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-01-11 10:32:34 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-11 16:01:07 +0000
commitbc6b99d22e8d9f6543ffffdc846e40e8075046c5 (patch)
tree26867cf018bf9ef55028efe2e0ffc6fc176a06eb /src/gpu/GrAllocator.h
parenta5494f117086d712855e4b6289c58c92d1549bcf (diff)
Add test for processor->resource ref/io counts
Change-Id: I63a8cb9f1564bfc15ef98121b77946a647c79f32 Reviewed-on: https://skia-review.googlesource.com/6814 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrAllocator.h')
-rw-r--r--src/gpu/GrAllocator.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gpu/GrAllocator.h b/src/gpu/GrAllocator.h
index 5b9bd5bab9..e5d2f4ea61 100644
--- a/src/gpu/GrAllocator.h
+++ b/src/gpu/GrAllocator.h
@@ -258,6 +258,13 @@ public:
return *(T*)item;
}
+ template <typename... Args> T& emplace_back(Args&&... args) {
+ void* item = fAllocator.push_back();
+ SkASSERT(item);
+ new (item) T(std::forward<Args>(args)...);
+ return *(T*)item;
+ }
+
/**
* Remove the last item, only call if count() != 0
*/