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

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp

Issue 2694283002: IndexedDB: Added external memory counting for IDBValue. (Closed)
Patch Set: Created 3 years, 10 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 | « third_party/WebKit/Source/modules/indexeddb/IDBValue.h ('k') | 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/indexeddb/IDBValue.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp
index 279a4ebe86b419f919a3acae3110efeb2a65da8d..981c5d9ac9d2d9bc803706d776b82d01b8bb3593 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp
@@ -4,6 +4,9 @@
#include "modules/indexeddb/IDBValue.h"
+#include <v8.h>
+
+#include "bindings/core/v8/SerializedScriptValue.h"
#include "platform/blob/BlobData.h"
#include "public/platform/WebBlobInfo.h"
#include "public/platform/modules/indexeddb/WebIDBValue.h"
@@ -15,6 +18,11 @@ IDBValue::IDBValue() = default;
IDBValue::IDBValue(const WebIDBValue& value)
: IDBValue(value.data, value.webBlobInfo, value.primaryKey, value.keyPath) {
+ m_externalAllocatedSize = m_data ? static_cast<int64_t>(m_data->size()) : 0l;
+ if (m_externalAllocatedSize) {
+ v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(
+ m_externalAllocatedSize);
+ }
}
IDBValue::IDBValue(PassRefPtr<SharedBuffer> data,
@@ -49,7 +57,12 @@ IDBValue::IDBValue(const IDBValue* value,
}
}
-IDBValue::~IDBValue() {}
+IDBValue::~IDBValue() {
+ if (m_externalAllocatedSize) {
+ v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(
+ -m_externalAllocatedSize);
+ }
+}
PassRefPtr<IDBValue> IDBValue::create() {
return adoptRef(new IDBValue());
@@ -73,8 +86,8 @@ Vector<String> IDBValue::getUUIDs() const {
return uuids;
}
-const SharedBuffer* IDBValue::data() const {
- return m_data.get();
+RefPtr<SerializedScriptValue> IDBValue::createSerializedValue() const {
+ return SerializedScriptValue::create(m_data->data(), m_data->size());
}
bool IDBValue::isNull() const {
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBValue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698