OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "content/browser/indexed_db/indexed_db_blob_info.h" | 5 #include "content/browser/indexed_db/indexed_db_blob_info.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" | 9 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 IndexedDBBlobInfo::IndexedDBBlobInfo() | 13 IndexedDBBlobInfo::IndexedDBBlobInfo() |
14 : is_file_(false), size_(-1), key_(DatabaseMetaDataKey::kInvalidBlobKey) { | 14 : is_file_(false), size_(-1), key_(DatabaseMetaDataKey::kInvalidBlobKey) { |
15 } | 15 } |
16 | 16 |
17 IndexedDBBlobInfo::IndexedDBBlobInfo(const std::string& uuid, | 17 IndexedDBBlobInfo::IndexedDBBlobInfo(const std::string& uuid, |
18 const base::string16& type, | 18 const base::string16& type, |
19 int64 size) | 19 int64_t size) |
20 : is_file_(false), | 20 : is_file_(false), |
21 uuid_(uuid), | 21 uuid_(uuid), |
22 type_(type), | 22 type_(type), |
23 size_(size), | 23 size_(size), |
24 key_(DatabaseMetaDataKey::kInvalidBlobKey) { | 24 key_(DatabaseMetaDataKey::kInvalidBlobKey) {} |
25 } | |
26 | 25 |
27 IndexedDBBlobInfo::IndexedDBBlobInfo(const base::string16& type, | 26 IndexedDBBlobInfo::IndexedDBBlobInfo(const base::string16& type, |
28 int64 size, | 27 int64_t size, |
29 int64 key) | 28 int64_t key) |
30 : is_file_(false), type_(type), size_(size), key_(key) { | 29 : is_file_(false), type_(type), size_(size), key_(key) {} |
31 } | |
32 | 30 |
33 IndexedDBBlobInfo::IndexedDBBlobInfo(const std::string& uuid, | 31 IndexedDBBlobInfo::IndexedDBBlobInfo(const std::string& uuid, |
34 const base::FilePath& file_path, | 32 const base::FilePath& file_path, |
35 const base::string16& file_name, | 33 const base::string16& file_name, |
36 const base::string16& type) | 34 const base::string16& type) |
37 : is_file_(true), | 35 : is_file_(true), |
38 uuid_(uuid), | 36 uuid_(uuid), |
39 type_(type), | 37 type_(type), |
40 size_(-1), | 38 size_(-1), |
41 file_name_(file_name), | 39 file_name_(file_name), |
42 file_path_(file_path), | 40 file_path_(file_path), |
43 key_(DatabaseMetaDataKey::kInvalidBlobKey) { | 41 key_(DatabaseMetaDataKey::kInvalidBlobKey) { |
44 } | 42 } |
45 | 43 |
46 IndexedDBBlobInfo::IndexedDBBlobInfo(int64 key, | 44 IndexedDBBlobInfo::IndexedDBBlobInfo(int64_t key, |
47 const base::string16& type, | 45 const base::string16& type, |
48 const base::string16& file_name) | 46 const base::string16& file_name) |
49 : is_file_(true), type_(type), size_(-1), file_name_(file_name), key_(key) { | 47 : is_file_(true), |
50 } | 48 type_(type), |
| 49 size_(-1), |
| 50 file_name_(file_name), |
| 51 key_(key) {} |
51 | 52 |
52 IndexedDBBlobInfo::IndexedDBBlobInfo(const IndexedDBBlobInfo& other) = default; | 53 IndexedDBBlobInfo::IndexedDBBlobInfo(const IndexedDBBlobInfo& other) = default; |
53 | 54 |
54 IndexedDBBlobInfo::~IndexedDBBlobInfo() = default; | 55 IndexedDBBlobInfo::~IndexedDBBlobInfo() = default; |
55 | 56 |
56 IndexedDBBlobInfo& IndexedDBBlobInfo::operator=( | 57 IndexedDBBlobInfo& IndexedDBBlobInfo::operator=( |
57 const IndexedDBBlobInfo& other) = default; | 58 const IndexedDBBlobInfo& other) = default; |
58 | 59 |
59 void IndexedDBBlobInfo::set_size(int64 size) { | 60 void IndexedDBBlobInfo::set_size(int64_t size) { |
60 DCHECK_EQ(-1, size_); | 61 DCHECK_EQ(-1, size_); |
61 size_ = size; | 62 size_ = size; |
62 } | 63 } |
63 | 64 |
64 void IndexedDBBlobInfo::set_uuid(const std::string& uuid) { | 65 void IndexedDBBlobInfo::set_uuid(const std::string& uuid) { |
65 DCHECK(uuid_.empty()); | 66 DCHECK(uuid_.empty()); |
66 uuid_ = uuid; | 67 uuid_ = uuid; |
67 DCHECK(!uuid_.empty()); | 68 DCHECK(!uuid_.empty()); |
68 } | 69 } |
69 | 70 |
70 void IndexedDBBlobInfo::set_file_path(const base::FilePath& file_path) { | 71 void IndexedDBBlobInfo::set_file_path(const base::FilePath& file_path) { |
71 DCHECK(file_path_.empty()); | 72 DCHECK(file_path_.empty()); |
72 file_path_ = file_path; | 73 file_path_ = file_path; |
73 } | 74 } |
74 | 75 |
75 void IndexedDBBlobInfo::set_last_modified(const base::Time& time) { | 76 void IndexedDBBlobInfo::set_last_modified(const base::Time& time) { |
76 DCHECK(base::Time().is_null()); | 77 DCHECK(base::Time().is_null()); |
77 DCHECK(is_file_); | 78 DCHECK(is_file_); |
78 last_modified_ = time; | 79 last_modified_ = time; |
79 } | 80 } |
80 | 81 |
81 void IndexedDBBlobInfo::set_key(int64 key) { | 82 void IndexedDBBlobInfo::set_key(int64_t key) { |
82 DCHECK_EQ(DatabaseMetaDataKey::kInvalidBlobKey, key_); | 83 DCHECK_EQ(DatabaseMetaDataKey::kInvalidBlobKey, key_); |
83 key_ = key; | 84 key_ = key; |
84 } | 85 } |
85 | 86 |
86 void IndexedDBBlobInfo::set_mark_used_callback( | 87 void IndexedDBBlobInfo::set_mark_used_callback( |
87 const base::Closure& mark_used_callback) { | 88 const base::Closure& mark_used_callback) { |
88 DCHECK(mark_used_callback_.is_null()); | 89 DCHECK(mark_used_callback_.is_null()); |
89 mark_used_callback_ = mark_used_callback; | 90 mark_used_callback_ = mark_used_callback; |
90 } | 91 } |
91 | 92 |
92 void IndexedDBBlobInfo::set_release_callback( | 93 void IndexedDBBlobInfo::set_release_callback( |
93 const ReleaseCallback& release_callback) { | 94 const ReleaseCallback& release_callback) { |
94 DCHECK(release_callback_.is_null()); | 95 DCHECK(release_callback_.is_null()); |
95 release_callback_ = release_callback; | 96 release_callback_ = release_callback; |
96 } | 97 } |
97 | 98 |
98 } // namespace content | 99 } // namespace content |
OLD | NEW |