Chromium Code Reviews| 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..5d120e37119e0238491a53450a9e3ab4cabaf174 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 = true; |
| + if (m_data) { |
| + v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory( |
| + m_data->size()); |
| + } |
| } |
| IDBValue::IDBValue(PassRefPtr<SharedBuffer> data, |
| @@ -49,7 +57,12 @@ IDBValue::IDBValue(const IDBValue* value, |
| } |
| } |
| -IDBValue::~IDBValue() {} |
| +IDBValue::~IDBValue() { |
| + if (m_data && m_externalAllocatedSize) { |
|
cmumford
2017/02/14 00:59:24
How about instead having this:
int64_t m_external
dmurph
2017/02/14 01:10:01
I like it - I'm still going to check to see if it'
|
| + v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory( |
| + -m_data->size()); |
| + } |
| +} |
| 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()); |
|
jsbell
2017/02/14 01:11:34
Note that this does a data copy (because it does b
|
| } |
| bool IDBValue::isNull() const { |