OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
cmumford
2014/03/13 18:28:47
2014
ericu
2014/03/13 19:31:19
Yup. I've been working on this for a while ;'>.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/browser/indexed_db/indexed_db_blob_info.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" | |
9 | |
10 namespace content { | |
11 | |
12 IndexedDBBlobInfo::IndexedDBBlobInfo() {} | |
jsbell
2014/03/13 00:01:48
Is this useful? Lots of uninitialized fields?
ericu
2014/03/13 18:12:39
Cleared out the fields without reasonable defaults
| |
13 | |
14 IndexedDBBlobInfo::IndexedDBBlobInfo(const std::string& uuid, | |
15 const base::string16& type, | |
16 int64 size) | |
17 : is_file_(false), | |
18 uuid_(uuid), | |
19 type_(type), | |
20 size_(size), | |
21 key_(DatabaseMetaDataKey::kInvalidBlobKey) {} | |
22 | |
23 IndexedDBBlobInfo::IndexedDBBlobInfo(const base::FilePath& file_path, | |
24 const base::string16& file_name, | |
25 const base::string16& type) | |
26 : is_file_(true), | |
27 type_(type), | |
28 size_(-1), | |
29 file_name_(file_name), | |
30 file_path_(file_path), | |
31 key_(DatabaseMetaDataKey::kInvalidBlobKey) {} | |
32 | |
33 IndexedDBBlobInfo::IndexedDBBlobInfo(const base::string16& type, | |
34 int64 size, | |
35 int64 key) | |
36 : is_file_(false), type_(type), size_(size), key_(key) {} | |
37 | |
38 IndexedDBBlobInfo::IndexedDBBlobInfo(int64 key, | |
39 const base::string16& type, | |
40 const base::string16& file_name) | |
41 : is_file_(true), | |
42 type_(type), | |
43 size_(-1), | |
44 file_name_(file_name), | |
45 key_(key) {} | |
46 | |
47 void IndexedDBBlobInfo::set_size(int64 size) { | |
48 DCHECK_EQ(-1, size_); | |
49 size_ = size; | |
50 } | |
51 | |
52 void IndexedDBBlobInfo::set_uuid(const std::string& uuid) { | |
53 DCHECK(!uuid_.size()); | |
cmumford
2014/03/13 18:28:47
Or DCHECK(uuid_.empty());
Also, do you want a DCH
ericu
2014/03/13 19:31:19
There's no current use for unsetting the UUID.
| |
54 uuid_ = uuid; | |
55 } | |
56 | |
57 void IndexedDBBlobInfo::set_file_path(const base::FilePath& file_path) { | |
jsbell
2014/03/13 00:01:48
DCHECK(is_file_) ?
ericu
2014/03/13 18:12:39
No, this can also be used for Blobs, pointing at t
| |
58 DCHECK(file_path_.empty()); | |
59 file_path_ = file_path; | |
60 } | |
61 | |
62 void IndexedDBBlobInfo::set_last_modified(const base::Time& time) { | |
jsbell
2014/03/13 00:01:48
DCHECK(is_file_) ?
ericu
2014/03/13 18:12:39
Done.
| |
63 DCHECK(base::Time().is_null()); | |
64 last_modified_ = time; | |
65 } | |
66 | |
67 void IndexedDBBlobInfo::set_key(int64 key) { | |
68 DCHECK(DatabaseMetaDataKey::kInvalidBlobKey == key_); | |
cmumford
2014/03/13 18:28:47
DCHECK_EQ?
ericu
2014/03/13 19:31:19
Done.
| |
69 key_ = key; | |
70 } | |
71 | |
72 void IndexedDBBlobInfo::set_mark_used_callback( | |
73 const base::Closure& mark_used_callback) { | |
74 DCHECK(mark_used_callback_.is_null()); | |
75 mark_used_callback_ = mark_used_callback; | |
76 } | |
77 | |
78 void IndexedDBBlobInfo::set_release_callback( | |
79 const ReleaseCallback& release_callback) { | |
80 DCHECK(release_callback_.is_null()); | |
81 release_callback_ = release_callback; | |
82 } | |
83 | |
84 } // namespace content | |
OLD | NEW |