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..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( |
|
haraken
2017/02/14 02:16:09
We want to deprecate v8::Isolate::GetCurrent(). Wo
|
| + 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( |
|
haraken
2017/02/14 02:16:08
Ditto. We can add IDBValue::m_isolate and use it h
|
| + -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 { |