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

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

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

Powered by Google App Engine
This is Rietveld 408576698