summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeno Albisser <zeno.albisser@digia.com>2014-03-17 20:13:37 +0100
committerZeno Albisser <zeno.albisser@digia.com>2014-03-17 20:22:22 +0100
commite90d7c4b152c56919d963987e2503f9909a666d2 (patch)
tree768e8cc889ba09a87f75d651a4742b17ee5bf5d3
parent95854d944fb9195e2b2871367726f69cea9113d8 (diff)
downloadqtwebengine-chromium-e90d7c4b152c56919d963987e2503f9909a666d2.tar.gz
Cherry-Pick: Delay setting initial memory block until it officially exists.
BUG=323017 R=robertphillips@google.com Author: mtklein@google.com Review URL: https://codereview.chromium.org/99833002 Not submitting a separate patch to QtWebEngine. This change is known to be contained in our next snapshot. Change-Id: Id267513b61ebc89446808206755661ae946e0a45 Reviewed-by: Andras Becsi <andras.becsi@digia.com>
-rwxr-xr-xchromium/third_party/skia/src/gpu/GrAllocator.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/chromium/third_party/skia/src/gpu/GrAllocator.h b/chromium/third_party/skia/src/gpu/GrAllocator.h
index 57ca03cd329..d3580e776bd 100755
--- a/chromium/third_party/skia/src/gpu/GrAllocator.h
+++ b/chromium/third_party/skia/src/gpu/GrAllocator.h
@@ -39,6 +39,14 @@ public:
SkDEBUGCODE(if (!fOwnFirstBlock) {*((char*)initialBlock+fBlockSize-1)='a';} );
}
+ void setInitialBlock(void* initialBlock) {
+ SkASSERT(0 == fCount);
+ SkASSERT(1 == fBlocks.count());
+ SkASSERT(NULL == fBlocks.back());
+ fOwnFirstBlock = false;
+ fBlocks.back() = initialBlock;
+ }
+
/**
* Adds an item and returns pointer to it.
*
@@ -223,8 +231,8 @@ public:
}
protected:
- GrTAllocator(int itemsPerBlock, void* initialBlock)
- : fAllocator(sizeof(T), itemsPerBlock, initialBlock) {
+ void setInitialBlock(void* initialBlock) {
+ fAllocator.setInitialBlock(initialBlock);
}
private:
@@ -236,8 +244,10 @@ template <int N, typename T> class GrSTAllocator : public GrTAllocator<T> {
private:
typedef GrTAllocator<T> INHERITED;
+
public:
- GrSTAllocator() : INHERITED(N, fStorage.get()) {
+ GrSTAllocator() : INHERITED(N) {
+ this->setInitialBlock(fStorage.get());
}
private: