aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-09-14 11:11:17 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-09-14 11:11:17 -0700
commit5a744b780190adbe6f210ffa4da9693b66d87afd (patch)
treeab91a6d0146cd85d89387f1f34503dbced17ae78 /src/core
parenta46ada5635351cf3ceefa1a3570212a21c2a8224 (diff)
Have SkVarAlloc::alloc() use sk_malloc_throw.
Very right, it's not prepared to handle return-NULL mallocs at all. BUG=530759 Review URL: https://codereview.chromium.org/1339093002
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkRecord.h2
-rw-r--r--src/core/SkVarAlloc.cpp8
-rw-r--r--src/core/SkVarAlloc.h8
3 files changed, 9 insertions, 9 deletions
diff --git a/src/core/SkRecord.h b/src/core/SkRecord.h
index 933cccceb8..6893cb02ab 100644
--- a/src/core/SkRecord.h
+++ b/src/core/SkRecord.h
@@ -68,7 +68,7 @@ public:
// Here T can be any class, not just those from SkRecords. Throws on failure.
template <typename T>
T* alloc(size_t count = 1) {
- return (T*)fAlloc.alloc(sizeof(T) * count, SK_MALLOC_THROW);
+ return (T*)fAlloc.alloc(sizeof(T) * count);
}
// Add a new command of type T to the end of this SkRecord.
diff --git a/src/core/SkVarAlloc.cpp b/src/core/SkVarAlloc.cpp
index f95370585d..840cf28347 100644
--- a/src/core/SkVarAlloc.cpp
+++ b/src/core/SkVarAlloc.cpp
@@ -18,9 +18,9 @@ struct SkVarAlloc::Block {
Block* prev;
char* data() { return (char*)(this + 1); }
- static Block* Alloc(Block* prev, size_t size, unsigned flags) {
+ static Block* Alloc(Block* prev, size_t size) {
SkASSERT(size >= sizeof(Block));
- Block* b = (Block*)sk_malloc_flags(size, flags);
+ Block* b = (Block*)sk_malloc_throw(size);
b->prev = prev;
return b;
}
@@ -49,7 +49,7 @@ SkVarAlloc::~SkVarAlloc() {
}
}
-void SkVarAlloc::makeSpace(size_t bytes, unsigned flags) {
+void SkVarAlloc::makeSpace(size_t bytes) {
SkASSERT(SkIsAlignPtr(bytes));
size_t alloc = 1<<fLgSize++;
@@ -57,7 +57,7 @@ void SkVarAlloc::makeSpace(size_t bytes, unsigned flags) {
alloc *= 2;
}
fBytesAllocated += alloc;
- fBlock = Block::Alloc(fBlock, alloc, flags);
+ fBlock = Block::Alloc(fBlock, alloc);
fByte = fBlock->data();
fRemaining = alloc - sizeof(Block);
diff --git a/src/core/SkVarAlloc.h b/src/core/SkVarAlloc.h
index 0d0984285b..3729bad105 100644
--- a/src/core/SkVarAlloc.h
+++ b/src/core/SkVarAlloc.h
@@ -19,12 +19,12 @@ public:
~SkVarAlloc();
- // Returns contiguous bytes aligned at least for pointers. You may pass SK_MALLOC_THROW, etc.
- char* alloc(size_t bytes, unsigned sk_malloc_flags) {
+ // Returns contiguous bytes aligned at least for pointers.
+ char* alloc(size_t bytes) {
bytes = SkAlignPtr(bytes);
if (bytes > fRemaining) {
- this->makeSpace(bytes, sk_malloc_flags);
+ this->makeSpace(bytes);
}
SkASSERT(bytes <= fRemaining);
@@ -39,7 +39,7 @@ public:
size_t approxBytesAllocated() const { return fBytesAllocated; }
private:
- void makeSpace(size_t bytes, unsigned flags);
+ void makeSpace(size_t bytes);
size_t fBytesAllocated;