Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: mojo/public/cpp/bindings/lib/scratch_buffer.h

Issue 229203003: Make mojo buffer allocators more robust. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tidy a little. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/public/cpp/bindings/lib/scratch_buffer.h
diff --git a/mojo/public/cpp/bindings/lib/scratch_buffer.h b/mojo/public/cpp/bindings/lib/scratch_buffer.h
index 462c6febc1300134dca077a10f3af08ace18d8bb..64dabce3502477d1e9b8b3a0343918160e2c8cec 100644
--- a/mojo/public/cpp/bindings/lib/scratch_buffer.h
+++ b/mojo/public/cpp/bindings/lib/scratch_buffer.h
@@ -24,7 +24,10 @@ class ScratchBuffer : public Buffer {
MOJO_OVERRIDE;
private:
- enum { kMinSegmentSize = 512 };
+ enum {
+ kMinSegmentSize = 512,
+ kMaxSegmentSize = 1024 * 1024 * 1024,
+ };
struct Segment {
Segment* next;
@@ -33,7 +36,7 @@ class ScratchBuffer : public Buffer {
};
void* AllocateInSegment(Segment* segment, size_t num_bytes);
- void AddOverflowSegment(size_t delta);
+ bool AddOverflowSegment(size_t delta);
char fixed_data_[kMinSegmentSize];
Segment fixed_;

Powered by Google App Engine
This is Rietveld 408576698