Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: content/browser/indexed_db/indexed_db_blob_info.cc

Issue 197023009: Add IndexedDBBlobInfo class, to be used for IDB Blob support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make clang happy. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 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.
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 : is_file_(false),
14 size_(-1),
15 key_(DatabaseMetaDataKey::kInvalidBlobKey) {}
16
17 IndexedDBBlobInfo::~IndexedDBBlobInfo() {}
18
19 IndexedDBBlobInfo::IndexedDBBlobInfo(const std::string& uuid,
20 const base::string16& type,
21 int64 size)
22 : is_file_(false),
23 uuid_(uuid),
24 type_(type),
25 size_(size),
26 key_(DatabaseMetaDataKey::kInvalidBlobKey) {}
27
28 IndexedDBBlobInfo::IndexedDBBlobInfo(const base::string16& type,
29 int64 size,
30 int64 key)
31 : is_file_(false), type_(type), size_(size), key_(key) {}
32
33 IndexedDBBlobInfo::IndexedDBBlobInfo(const base::FilePath& file_path,
34 const base::string16& file_name,
35 const base::string16& type)
36 : is_file_(true),
37 type_(type),
38 size_(-1),
39 file_name_(file_name),
40 file_path_(file_path),
41 key_(DatabaseMetaDataKey::kInvalidBlobKey) {}
42
43 IndexedDBBlobInfo::IndexedDBBlobInfo(int64 key,
44 const base::string16& type,
45 const base::string16& file_name)
46 : is_file_(true),
47 type_(type),
48 size_(-1),
49 file_name_(file_name),
50 key_(key) {}
51
52 void IndexedDBBlobInfo::set_size(int64 size) {
53 DCHECK_EQ(-1, size_);
54 size_ = size;
55 }
56
57 void IndexedDBBlobInfo::set_uuid(const std::string& uuid) {
58 DCHECK(uuid_.empty());
59 uuid_ = uuid;
60 DCHECK(!uuid_.empty());
61 }
62
63 void IndexedDBBlobInfo::set_file_path(const base::FilePath& file_path) {
64 DCHECK(file_path_.empty());
65 file_path_ = file_path;
66 }
67
68 void IndexedDBBlobInfo::set_last_modified(const base::Time& time) {
69 DCHECK(base::Time().is_null());
70 DCHECK(is_file_);
71 last_modified_ = time;
72 }
73
74 void IndexedDBBlobInfo::set_key(int64 key) {
75 DCHECK_EQ(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
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_blob_info.h ('k') | content/browser/indexed_db/indexed_db_leveldb_coding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698