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

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
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 "platform/blob/BlobData.h" 7 #include "platform/blob/BlobData.h"
8 #include "public/platform/WebBlobInfo.h" 8 #include "public/platform/WebBlobInfo.h"
9 #include "public/platform/modules/indexeddb/WebIDBValue.h" 9 #include "public/platform/modules/indexeddb/WebIDBValue.h"
10 #include "wtf/PtrUtil.h"
11 10
12 namespace blink { 11 namespace blink {
13 12
14 IDBValue::IDBValue() = default; 13 IDBValue::IDBValue() = default;
15 14
16 IDBValue::IDBValue(const WebIDBValue& value) 15 IDBValue::IDBValue(const WebIDBValue& value)
17 : IDBValue(value.data, value.webBlobInfo, value.primaryKey, value.keyPath) 16 : IDBValue(value.data, value.webBlobInfo, value.primaryKey, value.keyPath)
18 { 17 {
19 } 18 }
20 19
21 IDBValue::IDBValue(PassRefPtr<SharedBuffer> data, const WebVector<WebBlobInfo>& webBlobInfo, IDBKey* primaryKey, const IDBKeyPath& keyPath) 20 IDBValue::IDBValue(PassRefPtr<SharedBuffer> data, const WebVector<WebBlobInfo>& webBlobInfo, IDBKey* primaryKey, const IDBKeyPath& keyPath)
22 : m_data(data) 21 : m_data(data)
23 , m_blobData(wrapUnique(new Vector<RefPtr<BlobDataHandle>>())) 22 , m_blobData(adoptPtr(new Vector<RefPtr<BlobDataHandle>>()))
24 , m_blobInfo(wrapUnique(new Vector<WebBlobInfo>(webBlobInfo.size()))) 23 , m_blobInfo(adoptPtr(new Vector<WebBlobInfo>(webBlobInfo.size())))
25 , m_primaryKey(primaryKey && primaryKey->isValid() ? primaryKey : nullptr) 24 , m_primaryKey(primaryKey && primaryKey->isValid() ? primaryKey : nullptr)
26 , m_keyPath(keyPath) 25 , m_keyPath(keyPath)
27 { 26 {
28 for (size_t i = 0; i < webBlobInfo.size(); ++i) { 27 for (size_t i = 0; i < webBlobInfo.size(); ++i) {
29 const WebBlobInfo& info = (*m_blobInfo)[i] = webBlobInfo[i]; 28 const WebBlobInfo& info = (*m_blobInfo)[i] = webBlobInfo[i];
30 m_blobData->append(BlobDataHandle::create(info.uuid(), info.type(), info .size())); 29 m_blobData->append(BlobDataHandle::create(info.uuid(), info.type(), info .size()));
31 } 30 }
32 } 31 }
33 32
34 IDBValue::IDBValue(const IDBValue* value, IDBKey* primaryKey, const IDBKeyPath& keyPath) 33 IDBValue::IDBValue(const IDBValue* value, IDBKey* primaryKey, const IDBKeyPath& keyPath)
35 : m_data(value->m_data) 34 : m_data(value->m_data)
36 , m_blobData(wrapUnique(new Vector<RefPtr<BlobDataHandle>>())) 35 , m_blobData(adoptPtr(new Vector<RefPtr<BlobDataHandle>>()))
37 , m_blobInfo(wrapUnique(new Vector<WebBlobInfo>(value->m_blobInfo->size()))) 36 , m_blobInfo(adoptPtr(new Vector<WebBlobInfo>(value->m_blobInfo->size())))
38 , m_primaryKey(primaryKey) 37 , m_primaryKey(primaryKey)
39 , m_keyPath(keyPath) 38 , m_keyPath(keyPath)
40 { 39 {
41 for (size_t i = 0; i < value->m_blobInfo->size(); ++i) { 40 for (size_t i = 0; i < value->m_blobInfo->size(); ++i) {
42 const WebBlobInfo& info = (*m_blobInfo)[i] = value->m_blobInfo->at(i); 41 const WebBlobInfo& info = (*m_blobInfo)[i] = value->m_blobInfo->at(i);
43 m_blobData->append(BlobDataHandle::create(info.uuid(), info.type(), info .size())); 42 m_blobData->append(BlobDataHandle::create(info.uuid(), info.type(), info .size()));
44 } 43 }
45 } 44 }
46 45
47 PassRefPtr<IDBValue> IDBValue::create() 46 PassRefPtr<IDBValue> IDBValue::create()
(...skipping 24 matching lines...) Expand all
72 { 71 {
73 return m_data.get(); 72 return m_data.get();
74 } 73 }
75 74
76 bool IDBValue::isNull() const 75 bool IDBValue::isNull() const
77 { 76 {
78 return !m_data.get(); 77 return !m_data.get();
79 } 78 }
80 79
81 } // namespace blink 80 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698