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

Unified Diff: src/api.cc

Issue 2492943002: ValueSerializer: Replace use of std::vector with a delegate-allocated buffer. (Closed)
Patch Set: correct comment Created 4 years, 1 month 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
« no previous file with comments | « include/v8.h ('k') | src/value-serializer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index a414f00f297b6c61ade4339532ea03c6f9d66173..87e92d4aed2c16ec8251ce3f7479a66a605bdd2a 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2972,6 +2972,17 @@ Maybe<bool> ValueSerializer::Delegate::WriteHostObject(Isolate* v8_isolate,
return Nothing<bool>();
}
+void* ValueSerializer::Delegate::ReallocateBufferMemory(void* old_buffer,
+ size_t size,
+ size_t* actual_size) {
+ *actual_size = size;
+ return realloc(old_buffer, size);
+}
+
+void ValueSerializer::Delegate::FreeBufferMemory(void* buffer) {
+ return free(buffer);
+}
+
struct ValueSerializer::PrivateData {
explicit PrivateData(i::Isolate* i, ValueSerializer::Delegate* delegate)
: isolate(i), serializer(i, delegate) {}
@@ -3004,6 +3015,10 @@ std::vector<uint8_t> ValueSerializer::ReleaseBuffer() {
return private_->serializer.ReleaseBuffer();
}
+std::pair<uint8_t*, size_t> ValueSerializer::Release() {
+ return private_->serializer.Release();
+}
+
void ValueSerializer::TransferArrayBuffer(uint32_t transfer_id,
Local<ArrayBuffer> array_buffer) {
private_->serializer.TransferArrayBuffer(transfer_id,
« no previous file with comments | « include/v8.h ('k') | src/value-serializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698