| 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/logging.h" | 8 #include "base/logging.h" |
| 8 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" | 9 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" |
| 9 | 10 |
| 10 namespace content { | 11 namespace content { |
| 11 | 12 |
| 12 IndexedDBBlobInfo::IndexedDBBlobInfo() | 13 IndexedDBBlobInfo::IndexedDBBlobInfo() |
| 13 : is_file_(false), | 14 : is_file_(false), size_(-1), key_(DatabaseMetaDataKey::kInvalidBlobKey) { |
| 14 size_(-1), | 15 } |
| 15 key_(DatabaseMetaDataKey::kInvalidBlobKey) {} | |
| 16 | 16 |
| 17 IndexedDBBlobInfo::~IndexedDBBlobInfo() {} | 17 IndexedDBBlobInfo::~IndexedDBBlobInfo() {} |
| 18 | 18 |
| 19 IndexedDBBlobInfo::IndexedDBBlobInfo(const std::string& uuid, | 19 IndexedDBBlobInfo::IndexedDBBlobInfo(const std::string& uuid, |
| 20 const base::string16& type, | 20 const base::string16& type, |
| 21 int64 size) | 21 int64 size) |
| 22 : is_file_(false), | 22 : is_file_(false), |
| 23 uuid_(uuid), | 23 uuid_(uuid), |
| 24 type_(type), | 24 type_(type), |
| 25 size_(size), | 25 size_(size), |
| 26 key_(DatabaseMetaDataKey::kInvalidBlobKey) {} | 26 key_(DatabaseMetaDataKey::kInvalidBlobKey) { |
| 27 } |
| 27 | 28 |
| 28 IndexedDBBlobInfo::IndexedDBBlobInfo(const base::string16& type, | 29 IndexedDBBlobInfo::IndexedDBBlobInfo(const base::string16& type, |
| 29 int64 size, | 30 int64 size, |
| 30 int64 key) | 31 int64 key) |
| 31 : is_file_(false), type_(type), size_(size), key_(key) {} | 32 : is_file_(false), type_(type), size_(size), key_(key) { |
| 33 } |
| 32 | 34 |
| 33 IndexedDBBlobInfo::IndexedDBBlobInfo(const base::FilePath& file_path, | 35 IndexedDBBlobInfo::IndexedDBBlobInfo(const std::string& uuid, |
| 36 const base::FilePath& file_path, |
| 34 const base::string16& file_name, | 37 const base::string16& file_name, |
| 35 const base::string16& type) | 38 const base::string16& type) |
| 36 : is_file_(true), | 39 : is_file_(true), |
| 40 uuid_(uuid), |
| 37 type_(type), | 41 type_(type), |
| 38 size_(-1), | 42 size_(-1), |
| 39 file_name_(file_name), | 43 file_name_(file_name), |
| 40 file_path_(file_path), | 44 file_path_(file_path), |
| 41 key_(DatabaseMetaDataKey::kInvalidBlobKey) {} | 45 key_(DatabaseMetaDataKey::kInvalidBlobKey) { |
| 46 } |
| 42 | 47 |
| 43 IndexedDBBlobInfo::IndexedDBBlobInfo(int64 key, | 48 IndexedDBBlobInfo::IndexedDBBlobInfo(int64 key, |
| 44 const base::string16& type, | 49 const base::string16& type, |
| 45 const base::string16& file_name) | 50 const base::string16& file_name) |
| 46 : is_file_(true), | 51 : is_file_(true), type_(type), size_(-1), file_name_(file_name), key_(key) { |
| 47 type_(type), | 52 } |
| 48 size_(-1), | |
| 49 file_name_(file_name), | |
| 50 key_(key) {} | |
| 51 | 53 |
| 52 void IndexedDBBlobInfo::set_size(int64 size) { | 54 void IndexedDBBlobInfo::set_size(int64 size) { |
| 53 DCHECK_EQ(-1, size_); | 55 DCHECK_EQ(-1, size_); |
| 54 size_ = size; | 56 size_ = size; |
| 55 } | 57 } |
| 56 | 58 |
| 57 void IndexedDBBlobInfo::set_uuid(const std::string& uuid) { | 59 void IndexedDBBlobInfo::set_uuid(const std::string& uuid) { |
| 58 DCHECK(uuid_.empty()); | 60 DCHECK(uuid_.empty()); |
| 59 uuid_ = uuid; | 61 uuid_ = uuid; |
| 60 DCHECK(!uuid_.empty()); | 62 DCHECK(!uuid_.empty()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 82 mark_used_callback_ = mark_used_callback; | 84 mark_used_callback_ = mark_used_callback; |
| 83 } | 85 } |
| 84 | 86 |
| 85 void IndexedDBBlobInfo::set_release_callback( | 87 void IndexedDBBlobInfo::set_release_callback( |
| 86 const ReleaseCallback& release_callback) { | 88 const ReleaseCallback& release_callback) { |
| 87 DCHECK(release_callback_.is_null()); | 89 DCHECK(release_callback_.is_null()); |
| 88 release_callback_ = release_callback; | 90 release_callback_ = release_callback; |
| 89 } | 91 } |
| 90 | 92 |
| 91 } // namespace content | 93 } // namespace content |
| OLD | NEW |