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

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

Issue 2691033003: IndexedDB: Added external memory counting for IDBValue. (Closed)
Patch Set: Created 3 years, 10 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 #ifndef IDBValue_h 5 #ifndef IDBValue_h
6 #define IDBValue_h 6 #define IDBValue_h
7 7
8 #include "modules/ModulesExport.h" 8 #include "modules/ModulesExport.h"
9 #include "modules/indexeddb/IDBKey.h" 9 #include "modules/indexeddb/IDBKey.h"
10 #include "modules/indexeddb/IDBKeyPath.h" 10 #include "modules/indexeddb/IDBKeyPath.h"
11 #include "platform/SharedBuffer.h" 11 #include "platform/SharedBuffer.h"
12 #include "public/platform/WebVector.h" 12 #include "public/platform/WebVector.h"
13 #include "wtf/RefPtr.h" 13 #include "wtf/RefPtr.h"
14 #include <memory> 14 #include <memory>
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class BlobDataHandle; 18 class BlobDataHandle;
19 class SerializedScriptValue;
19 class WebBlobInfo; 20 class WebBlobInfo;
20 struct WebIDBValue; 21 struct WebIDBValue;
21 22
22 class MODULES_EXPORT IDBValue final : public RefCounted<IDBValue> { 23 class MODULES_EXPORT IDBValue final : public RefCounted<IDBValue> {
23 public: 24 public:
24 static PassRefPtr<IDBValue> create(); 25 static PassRefPtr<IDBValue> create();
25 static PassRefPtr<IDBValue> create(const WebIDBValue&); 26 static PassRefPtr<IDBValue> create(const WebIDBValue&);
26 static PassRefPtr<IDBValue> create(const IDBValue*, 27 static PassRefPtr<IDBValue> create(const IDBValue*,
27 IDBKey*, 28 IDBKey*,
28 const IDBKeyPath&); 29 const IDBKeyPath&);
29 ~IDBValue(); 30 ~IDBValue();
30 31
31 bool isNull() const; 32 bool isNull() const;
32 Vector<String> getUUIDs() const; 33 Vector<String> getUUIDs() const;
33 const SharedBuffer* data() const; 34 RefPtr<SerializedScriptValue> createSerializedValue() const;
34 Vector<WebBlobInfo>* blobInfo() const { return m_blobInfo.get(); } 35 Vector<WebBlobInfo>* blobInfo() const { return m_blobInfo.get(); }
35 const IDBKey* primaryKey() const { return m_primaryKey; } 36 const IDBKey* primaryKey() const { return m_primaryKey; }
36 const IDBKeyPath& keyPath() const { return m_keyPath; } 37 const IDBKeyPath& keyPath() const { return m_keyPath; }
37 38
38 private: 39 private:
39 IDBValue(); 40 IDBValue();
40 IDBValue(const WebIDBValue&); 41 IDBValue(const WebIDBValue&);
41 IDBValue(PassRefPtr<SharedBuffer>, 42 IDBValue(PassRefPtr<SharedBuffer>,
42 const WebVector<WebBlobInfo>&, 43 const WebVector<WebBlobInfo>&,
43 IDBKey*, 44 IDBKey*,
44 const IDBKeyPath&); 45 const IDBKeyPath&);
45 IDBValue(const IDBValue*, IDBKey*, const IDBKeyPath&); 46 IDBValue(const IDBValue*, IDBKey*, const IDBKeyPath&);
46 47
48 // Keep this private to prevent new refs because we manually bookkeep the
49 // memory to V8.
47 const RefPtr<SharedBuffer> m_data; 50 const RefPtr<SharedBuffer> m_data;
48 const std::unique_ptr<Vector<RefPtr<BlobDataHandle>>> m_blobData; 51 const std::unique_ptr<Vector<RefPtr<BlobDataHandle>>> m_blobData;
49 const std::unique_ptr<Vector<WebBlobInfo>> m_blobInfo; 52 const std::unique_ptr<Vector<WebBlobInfo>> m_blobInfo;
50 const Persistent<IDBKey> m_primaryKey; 53 const Persistent<IDBKey> m_primaryKey;
51 const IDBKeyPath m_keyPath; 54 const IDBKeyPath m_keyPath;
55 int64_t m_externalAllocatedSize = 0;
52 }; 56 };
53 57
54 } // namespace blink 58 } // namespace blink
55 59
56 #endif 60 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698