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

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

Issue 2614663008: Migrate WTF::Vector::append() to ::push_back() [part 13 of N] (Closed)
Patch Set: Created 3 years, 11 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" 10 #include "wtf/PtrUtil.h"
(...skipping 10 matching lines...) Expand all
21 const WebVector<WebBlobInfo>& webBlobInfo, 21 const WebVector<WebBlobInfo>& webBlobInfo,
22 IDBKey* primaryKey, 22 IDBKey* primaryKey,
23 const IDBKeyPath& keyPath) 23 const IDBKeyPath& keyPath)
24 : m_data(data), 24 : m_data(data),
25 m_blobData(WTF::makeUnique<Vector<RefPtr<BlobDataHandle>>>()), 25 m_blobData(WTF::makeUnique<Vector<RefPtr<BlobDataHandle>>>()),
26 m_blobInfo(WTF::wrapUnique(new Vector<WebBlobInfo>(webBlobInfo.size()))), 26 m_blobInfo(WTF::wrapUnique(new Vector<WebBlobInfo>(webBlobInfo.size()))),
27 m_primaryKey(primaryKey && primaryKey->isValid() ? primaryKey : nullptr), 27 m_primaryKey(primaryKey && primaryKey->isValid() ? primaryKey : nullptr),
28 m_keyPath(keyPath) { 28 m_keyPath(keyPath) {
29 for (size_t i = 0; i < webBlobInfo.size(); ++i) { 29 for (size_t i = 0; i < webBlobInfo.size(); ++i) {
30 const WebBlobInfo& info = (*m_blobInfo)[i] = webBlobInfo[i]; 30 const WebBlobInfo& info = (*m_blobInfo)[i] = webBlobInfo[i];
31 m_blobData->append( 31 m_blobData->push_back(
32 BlobDataHandle::create(info.uuid(), info.type(), info.size())); 32 BlobDataHandle::create(info.uuid(), info.type(), info.size()));
33 } 33 }
34 } 34 }
35 35
36 IDBValue::IDBValue(const IDBValue* value, 36 IDBValue::IDBValue(const IDBValue* value,
37 IDBKey* primaryKey, 37 IDBKey* primaryKey,
38 const IDBKeyPath& keyPath) 38 const IDBKeyPath& keyPath)
39 : m_data(value->m_data), 39 : m_data(value->m_data),
40 m_blobData(WTF::makeUnique<Vector<RefPtr<BlobDataHandle>>>()), 40 m_blobData(WTF::makeUnique<Vector<RefPtr<BlobDataHandle>>>()),
41 m_blobInfo( 41 m_blobInfo(
42 WTF::wrapUnique(new Vector<WebBlobInfo>(value->m_blobInfo->size()))), 42 WTF::wrapUnique(new Vector<WebBlobInfo>(value->m_blobInfo->size()))),
43 m_primaryKey(primaryKey), 43 m_primaryKey(primaryKey),
44 m_keyPath(keyPath) { 44 m_keyPath(keyPath) {
45 for (size_t i = 0; i < value->m_blobInfo->size(); ++i) { 45 for (size_t i = 0; i < value->m_blobInfo->size(); ++i) {
46 const WebBlobInfo& info = (*m_blobInfo)[i] = value->m_blobInfo->at(i); 46 const WebBlobInfo& info = (*m_blobInfo)[i] = value->m_blobInfo->at(i);
47 m_blobData->append( 47 m_blobData->push_back(
48 BlobDataHandle::create(info.uuid(), info.type(), info.size())); 48 BlobDataHandle::create(info.uuid(), info.type(), info.size()));
49 } 49 }
50 } 50 }
51 51
52 IDBValue::~IDBValue() {} 52 IDBValue::~IDBValue() {}
53 53
54 PassRefPtr<IDBValue> IDBValue::create() { 54 PassRefPtr<IDBValue> IDBValue::create() {
55 return adoptRef(new IDBValue()); 55 return adoptRef(new IDBValue());
56 } 56 }
57 57
58 PassRefPtr<IDBValue> IDBValue::create(const WebIDBValue& value) { 58 PassRefPtr<IDBValue> IDBValue::create(const WebIDBValue& value) {
59 return adoptRef(new IDBValue(value)); 59 return adoptRef(new IDBValue(value));
60 } 60 }
61 61
62 PassRefPtr<IDBValue> IDBValue::create(const IDBValue* value, 62 PassRefPtr<IDBValue> IDBValue::create(const IDBValue* value,
63 IDBKey* primaryKey, 63 IDBKey* primaryKey,
64 const IDBKeyPath& keyPath) { 64 const IDBKeyPath& keyPath) {
65 return adoptRef(new IDBValue(value, primaryKey, keyPath)); 65 return adoptRef(new IDBValue(value, primaryKey, keyPath));
66 } 66 }
67 67
68 Vector<String> IDBValue::getUUIDs() const { 68 Vector<String> IDBValue::getUUIDs() const {
69 Vector<String> uuids; 69 Vector<String> uuids;
70 uuids.reserveCapacity(m_blobInfo->size()); 70 uuids.reserveCapacity(m_blobInfo->size());
71 for (const auto& info : *m_blobInfo) 71 for (const auto& info : *m_blobInfo)
72 uuids.append(info.uuid()); 72 uuids.push_back(info.uuid());
73 return uuids; 73 return uuids;
74 } 74 }
75 75
76 const SharedBuffer* IDBValue::data() const { 76 const SharedBuffer* IDBValue::data() const {
77 return m_data.get(); 77 return m_data.get();
78 } 78 }
79 79
80 bool IDBValue::isNull() const { 80 bool IDBValue::isNull() const {
81 return !m_data.get(); 81 return !m_data.get();
82 } 82 }
83 83
84 } // namespace blink 84 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698