| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/indexeddb/IDBValue.h" | 5 #include "modules/indexeddb/IDBValue.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/SerializedScriptValue.h" | 7 #include "bindings/core/v8/SerializedScriptValue.h" |
| 8 #include "platform/blob/BlobData.h" | 8 #include "platform/blob/BlobData.h" |
| 9 #include "platform/wtf/PtrUtil.h" | 9 #include "platform/wtf/PtrUtil.h" |
| 10 #include "public/platform/WebBlobInfo.h" | 10 #include "public/platform/WebBlobInfo.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 WTF::WrapUnique(new Vector<WebBlobInfo>(value->blob_info_->size()))), | 53 WTF::WrapUnique(new Vector<WebBlobInfo>(value->blob_info_->size()))), |
| 54 primary_key_(primary_key), | 54 primary_key_(primary_key), |
| 55 key_path_(key_path) { | 55 key_path_(key_path) { |
| 56 for (size_t i = 0; i < value->blob_info_->size(); ++i) { | 56 for (size_t i = 0; i < value->blob_info_->size(); ++i) { |
| 57 const WebBlobInfo& info = (*blob_info_)[i] = value->blob_info_->at(i); | 57 const WebBlobInfo& info = (*blob_info_)[i] = value->blob_info_->at(i); |
| 58 blob_data_->push_back( | 58 blob_data_->push_back( |
| 59 BlobDataHandle::Create(info.Uuid(), info.GetType(), info.size())); | 59 BlobDataHandle::Create(info.Uuid(), info.GetType(), info.size())); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 IDBValue::IDBValue(PassRefPtr<SharedBuffer> unwrapped_data, |
| 64 std::unique_ptr<Vector<RefPtr<BlobDataHandle>>> blob_data, |
| 65 std::unique_ptr<Vector<WebBlobInfo>> blob_info) |
| 66 : data_(std::move(unwrapped_data)), |
| 67 blob_data_(std::move(blob_data)), |
| 68 blob_info_(std::move(blob_info)) {} |
| 69 |
| 63 IDBValue::~IDBValue() { | 70 IDBValue::~IDBValue() { |
| 64 if (isolate_) | 71 if (isolate_) |
| 65 isolate_->AdjustAmountOfExternalAllocatedMemory(-external_allocated_size_); | 72 isolate_->AdjustAmountOfExternalAllocatedMemory(-external_allocated_size_); |
| 66 } | 73 } |
| 67 | 74 |
| 68 PassRefPtr<IDBValue> IDBValue::Create() { | 75 PassRefPtr<IDBValue> IDBValue::Create() { |
| 69 return AdoptRef(new IDBValue()); | 76 return AdoptRef(new IDBValue()); |
| 70 } | 77 } |
| 71 | 78 |
| 72 PassRefPtr<IDBValue> IDBValue::Create(const WebIDBValue& value, | 79 PassRefPtr<IDBValue> IDBValue::Create(const WebIDBValue& value, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 90 | 97 |
| 91 RefPtr<SerializedScriptValue> IDBValue::CreateSerializedValue() const { | 98 RefPtr<SerializedScriptValue> IDBValue::CreateSerializedValue() const { |
| 92 return SerializedScriptValue::Create(data_->Data(), data_->size()); | 99 return SerializedScriptValue::Create(data_->Data(), data_->size()); |
| 93 } | 100 } |
| 94 | 101 |
| 95 bool IDBValue::IsNull() const { | 102 bool IDBValue::IsNull() const { |
| 96 return !data_.Get(); | 103 return !data_.Get(); |
| 97 } | 104 } |
| 98 | 105 |
| 99 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |