Chromium Code Reviews| Index: content/browser/indexed_db/indexed_db_blob_info.cc |
| diff --git a/content/browser/indexed_db/indexed_db_blob_info.cc b/content/browser/indexed_db/indexed_db_blob_info.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1ddaaf9ec89459b72dfe4ddaef9267156315786d |
| --- /dev/null |
| +++ b/content/browser/indexed_db/indexed_db_blob_info.cc |
| @@ -0,0 +1,84 @@ |
| +// 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 ;'>.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/browser/indexed_db/indexed_db_blob_info.h" |
| + |
| +#include "base/logging.h" |
| +#include "content/browser/indexed_db/indexed_db_leveldb_coding.h" |
| + |
| +namespace content { |
| + |
| +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
|
| + |
| +IndexedDBBlobInfo::IndexedDBBlobInfo(const std::string& uuid, |
| + const base::string16& type, |
| + int64 size) |
| + : is_file_(false), |
| + uuid_(uuid), |
| + type_(type), |
| + size_(size), |
| + key_(DatabaseMetaDataKey::kInvalidBlobKey) {} |
| + |
| +IndexedDBBlobInfo::IndexedDBBlobInfo(const base::FilePath& file_path, |
| + const base::string16& file_name, |
| + const base::string16& type) |
| + : is_file_(true), |
| + type_(type), |
| + size_(-1), |
| + file_name_(file_name), |
| + file_path_(file_path), |
| + key_(DatabaseMetaDataKey::kInvalidBlobKey) {} |
| + |
| +IndexedDBBlobInfo::IndexedDBBlobInfo(const base::string16& type, |
| + int64 size, |
| + int64 key) |
| + : is_file_(false), type_(type), size_(size), key_(key) {} |
| + |
| +IndexedDBBlobInfo::IndexedDBBlobInfo(int64 key, |
| + const base::string16& type, |
| + const base::string16& file_name) |
| + : is_file_(true), |
| + type_(type), |
| + size_(-1), |
| + file_name_(file_name), |
| + key_(key) {} |
| + |
| +void IndexedDBBlobInfo::set_size(int64 size) { |
| + DCHECK_EQ(-1, size_); |
| + size_ = size; |
| +} |
| + |
| +void IndexedDBBlobInfo::set_uuid(const std::string& uuid) { |
| + 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.
|
| + uuid_ = uuid; |
| +} |
| + |
| +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
|
| + DCHECK(file_path_.empty()); |
| + file_path_ = file_path; |
| +} |
| + |
| +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.
|
| + DCHECK(base::Time().is_null()); |
| + last_modified_ = time; |
| +} |
| + |
| +void IndexedDBBlobInfo::set_key(int64 key) { |
| + DCHECK(DatabaseMetaDataKey::kInvalidBlobKey == key_); |
|
cmumford
2014/03/13 18:28:47
DCHECK_EQ?
ericu
2014/03/13 19:31:19
Done.
|
| + key_ = key; |
| +} |
| + |
| +void IndexedDBBlobInfo::set_mark_used_callback( |
| + const base::Closure& mark_used_callback) { |
| + DCHECK(mark_used_callback_.is_null()); |
| + mark_used_callback_ = mark_used_callback; |
| +} |
| + |
| +void IndexedDBBlobInfo::set_release_callback( |
| + const ReleaseCallback& release_callback) { |
| + DCHECK(release_callback_.is_null()); |
| + release_callback_ = release_callback; |
| +} |
| + |
| +} // namespace content |