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

Unified Diff: third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp

Issue 2847543003: Report BytesConsumer::Chunk buffer size to V8 (Closed)
Patch Set: fix Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp b/third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp
index 7bf2ce96295625d00e70aa55c2e33993e8711261..0c7e7095ad4aaf7e8fc24e26cfc7c4ef50e384e3 100644
--- a/third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp
+++ b/third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp
@@ -13,6 +13,7 @@
#include "platform/blob/BlobData.h"
#include "platform/wtf/Functional.h"
#include "platform/wtf/RefPtr.h"
+#include "v8/include/v8.h"
namespace blink {
@@ -114,6 +115,13 @@ class TeeHelper final : public GarbageCollectedFinalized<TeeHelper>,
Chunk(const char* data, size_t size) {
buffer_.ReserveInitialCapacity(size);
buffer_.Append(data, size);
+ // Report buffer size to V8 so GC can be triggered appropriately.
+ v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(
+ static_cast<int64_t>(buffer_.size()));
+ }
+ ~Chunk() {
+ v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(
+ -static_cast<int64_t>(buffer_.size()));
}
const char* data() const { return buffer_.data(); }
size_t size() const { return buffer_.size(); }
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698