OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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 #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() {} |
| 13 |
| 14 IndexedDBBlobInfo::IndexedDBBlobInfo(const std::string& uuid, |
| 15 const 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 string16& file_name, |
| 25 const 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 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 string16& type, |
| 40 const 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()); |
| 54 uuid_ = uuid; |
| 55 } |
| 56 |
| 57 void IndexedDBBlobInfo::set_file_path(const base::FilePath& file_path) { |
| 58 DCHECK(file_path_.empty()); |
| 59 file_path_ = file_path; |
| 60 } |
| 61 |
| 62 void IndexedDBBlobInfo::set_last_modified(const base::Time& time) { |
| 63 DCHECK(base::Time().is_null()); |
| 64 last_modified_ = time; |
| 65 } |
| 66 |
| 67 void IndexedDBBlobInfo::set_key(int64 key) { |
| 68 DCHECK(DatabaseMetaDataKey::kInvalidBlobKey == key_); |
| 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 |