1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_VALUE_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_VALUE_H_ 7 8 #include <algorithm> 9 #include <string> 10 #include <vector> 11 12 #include "content/browser/indexed_db/indexed_db_blob_info.h" 13 #include "content/common/content_export.h" 14 15 namespace content { 16 17 struct CONTENT_EXPORT IndexedDBValue { 18 IndexedDBValue(); 19 IndexedDBValue(const std::string& input_bits, 20 const std::vector<IndexedDBBlobInfo>& input_blob_info); 21 ~IndexedDBValue(); 22 23 void swap(IndexedDBValue& value) { 24 bits.swap(value.bits); 25 blob_info.swap(value.blob_info); 26 } 27 28 bool empty() const { return bits.empty(); } 29 void clear() { 30 bits.clear(); 31 blob_info.clear(); 32 } 33 34 size_t SizeEstimate() const { 35 return bits.size() + blob_info.size() * sizeof(IndexedDBBlobInfo); 36 } 37 38 std::string bits; 39 std::vector<IndexedDBBlobInfo> blob_info; 40 }; 41 42 } // namespace content 43 44 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_VALUE_H_ 45