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( |
| 15 const GURL& url, |
| 16 const string16& type, |
| 17 int64 size) |
| 18 : is_file_(false), |
| 19 url_(url), |
| 20 type_(type), |
| 21 size_(size), |
| 22 key_(DatabaseMetaDataKey::kInvalidBlobKey) { |
| 23 } |
| 24 |
| 25 IndexedDBBlobInfo::IndexedDBBlobInfo( |
| 26 const base::FilePath& file_path, |
| 27 const string16& file_name, |
| 28 const string16& type) |
| 29 : is_file_(true), |
| 30 type_(type), |
| 31 size_(-1), |
| 32 file_name_(file_name), |
| 33 file_path_(file_path), |
| 34 key_(DatabaseMetaDataKey::kInvalidBlobKey) { |
| 35 } |
| 36 |
| 37 IndexedDBBlobInfo::IndexedDBBlobInfo( |
| 38 const string16& type, int64 size, int64 key) |
| 39 : is_file_(false), |
| 40 type_(type), |
| 41 size_(size), |
| 42 key_(key) { |
| 43 } |
| 44 |
| 45 IndexedDBBlobInfo::IndexedDBBlobInfo( |
| 46 const string16& type, const string16& file_name, int64 key) |
| 47 : is_file_(true), |
| 48 type_(type), |
| 49 size_(-1), |
| 50 file_name_(file_name), |
| 51 key_(key) { |
| 52 } |
| 53 |
| 54 void IndexedDBBlobInfo::set_size(int64 size) { |
| 55 DCHECK_EQ(-1, size_); |
| 56 size_ = size; |
| 57 } |
| 58 |
| 59 void IndexedDBBlobInfo::set_url(const GURL& url) { |
| 60 DCHECK(url_.is_empty()); |
| 61 url_ = url; |
| 62 } |
| 63 |
| 64 void IndexedDBBlobInfo::set_file_path(const base::FilePath& file_path) { |
| 65 DCHECK(file_path_.empty()); |
| 66 file_path_ = file_path; |
| 67 } |
| 68 |
| 69 void IndexedDBBlobInfo::set_last_modified(const base::Time& time) { |
| 70 DCHECK(base::Time().is_null()); |
| 71 last_modified_ = time; |
| 72 } |
| 73 |
| 74 void IndexedDBBlobInfo::set_key(int64 key) { |
| 75 DCHECK(DatabaseMetaDataKey::kInvalidBlobKey == key_); |
| 76 key_ = key; |
| 77 } |
| 78 |
| 79 void IndexedDBBlobInfo::set_mark_used_callback( |
| 80 const base::Closure& mark_used_callback) { |
| 81 DCHECK(mark_used_callback_.is_null()); |
| 82 mark_used_callback_ = mark_used_callback; |
| 83 } |
| 84 |
| 85 void IndexedDBBlobInfo::set_release_callback( |
| 86 const ReleaseCallback& release_callback) { |
| 87 DCHECK(release_callback_.is_null()); |
| 88 release_callback_ = release_callback; |
| 89 } |
| 90 |
| 91 } // namespace content |
OLD | NEW |