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

Unified Diff: src/value-serializer.h

Issue 2643723010: [d8] Use ValueSerializer for postMessage (instead of ad-hoc serializer) (Closed)
Patch Set: forgot hash_combine Created 3 years, 11 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: src/value-serializer.h
diff --git a/src/value-serializer.h b/src/value-serializer.h
index 1ed9457b779033cc8e0ed3e5074c544f800131b4..d300e39aa715035519c28e779867538602fa9f45 100644
--- a/src/value-serializer.h
+++ b/src/value-serializer.h
@@ -86,7 +86,7 @@ class ValueSerializer {
private:
// Managing allocations of the internal buffer.
- void ExpandBuffer(size_t required_capacity);
+ Maybe<bool> ExpandBuffer(size_t required_capacity);
// Writing the wire format.
void WriteTag(SerializationTag tag);
@@ -96,7 +96,7 @@ class ValueSerializer {
void WriteZigZag(T value);
void WriteOneByteString(Vector<const uint8_t> chars);
void WriteTwoByteString(Vector<const uc16> chars);
- uint8_t* ReserveRawBytes(size_t bytes);
+ Maybe<uint8_t*> ReserveRawBytes(size_t bytes);
// Writing V8 objects of various kinds.
void WriteOddball(Oddball* oddball);
@@ -134,11 +134,14 @@ class ValueSerializer {
V8_NOINLINE void ThrowDataCloneError(MessageTemplate::Template template_index,
Handle<Object> arg0);
+ Maybe<bool> ThrowIfOutOfMemory();
+
Isolate* const isolate_;
v8::ValueSerializer::Delegate* const delegate_;
uint8_t* buffer_ = nullptr;
size_t buffer_size_ = 0;
size_t buffer_capacity_ = 0;
+ bool out_of_memory_ = false;
Zone zone_;
// To avoid extra lookups in the identity map, ID+1 is actually stored in the

Powered by Google App Engine
This is Rietveld 408576698