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
3 // found in the LICENSE file.
5 #include "content/browser/indexed_db/indexed_db_blob_info.h"
7 #include "base/logging.h"
8 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h"
12 IndexedDBBlobInfo::IndexedDBBlobInfo()
15 key_(DatabaseMetaDataKey::kInvalidBlobKey) {}
17 IndexedDBBlobInfo::~IndexedDBBlobInfo() {}
19 IndexedDBBlobInfo::IndexedDBBlobInfo(const std::string& uuid,
20 const base::string16& type,
26 key_(DatabaseMetaDataKey::kInvalidBlobKey) {}
28 IndexedDBBlobInfo::IndexedDBBlobInfo(const base::string16& type,
31 : is_file_(false), type_(type), size_(size), key_(key) {}
33 IndexedDBBlobInfo::IndexedDBBlobInfo(const base::FilePath& file_path,
34 const base::string16& file_name,
35 const base::string16& type)
39 file_name_(file_name),
40 file_path_(file_path),
41 key_(DatabaseMetaDataKey::kInvalidBlobKey) {}
43 IndexedDBBlobInfo::IndexedDBBlobInfo(int64 key,
44 const base::string16& type,
45 const base::string16& file_name)
49 file_name_(file_name),
52 void IndexedDBBlobInfo::set_size(int64 size) {
57 void IndexedDBBlobInfo::set_uuid(const std::string& uuid) {
58 DCHECK(uuid_.empty());
60 DCHECK(!uuid_.empty());
63 void IndexedDBBlobInfo::set_file_path(const base::FilePath& file_path) {
64 DCHECK(file_path_.empty());
65 file_path_ = file_path;
68 void IndexedDBBlobInfo::set_last_modified(const base::Time& time) {
69 DCHECK(base::Time().is_null());
71 last_modified_ = time;
74 void IndexedDBBlobInfo::set_key(int64 key) {
75 DCHECK_EQ(DatabaseMetaDataKey::kInvalidBlobKey, key_);
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;
85 void IndexedDBBlobInfo::set_release_callback(
86 const ReleaseCallback& release_callback) {
87 DCHECK(release_callback_.is_null());
88 release_callback_ = release_callback;
91 } // namespace content