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

Side by Side Diff: content/browser/indexed_db/indexed_db_backing_store.h

Issue 18023022: Blob support for IDB [Chromium] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Settle on one name for the live blob journal. Created 7 years 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_
7 7
8 #include <set>
8 #include <string> 9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "base/timer/timer.h" 16 #include "base/timer/timer.h"
16 #include "content/browser/indexed_db/indexed_db.h" 17 #include "content/browser/indexed_db/indexed_db.h"
18 #include "content/browser/indexed_db/indexed_db_active_blob_registry.h"
19 #include "content/browser/indexed_db/indexed_db_blob_info.h"
20 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h"
17 #include "content/browser/indexed_db/indexed_db_metadata.h" 21 #include "content/browser/indexed_db/indexed_db_metadata.h"
18 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h" 22 #include "content/browser/indexed_db/leveldb/leveldb_iterator.h"
19 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" 23 #include "content/browser/indexed_db/leveldb/leveldb_transaction.h"
20 #include "content/common/content_export.h" 24 #include "content/common/content_export.h"
21 #include "content/common/indexed_db/indexed_db_key.h" 25 #include "content/common/indexed_db/indexed_db_key.h"
22 #include "content/common/indexed_db/indexed_db_key_path.h" 26 #include "content/common/indexed_db/indexed_db_key_path.h"
23 #include "content/common/indexed_db/indexed_db_key_range.h" 27 #include "content/common/indexed_db/indexed_db_key_range.h"
24 #include "third_party/leveldatabase/src/include/leveldb/status.h" 28 #include "third_party/leveldatabase/src/include/leveldb/status.h"
25 #include "url/gurl.h" 29 #include "url/gurl.h"
26 30
31 class GURL;
32
33 namespace base {
34 class TaskRunner;
35 }
36
37 namespace net {
38 class URLRequestContext;
39 }
40
41 namespace webkit_blob {
42 class BlobDataHandle;
43 }
44
27 namespace content { 45 namespace content {
28 46
47 class IndexedDBFactory;
29 class LevelDBComparator; 48 class LevelDBComparator;
30 class LevelDBDatabase; 49 class LevelDBDatabase;
50 struct IndexedDBValue;
31 51
32 class LevelDBFactory { 52 class LevelDBFactory {
33 public: 53 public:
34 virtual ~LevelDBFactory() {} 54 virtual ~LevelDBFactory() {}
35 virtual leveldb::Status OpenLevelDB(const base::FilePath& file_name, 55 virtual leveldb::Status OpenLevelDB(const base::FilePath& file_name,
36 const LevelDBComparator* comparator, 56 const LevelDBComparator* comparator,
37 scoped_ptr<LevelDBDatabase>* db, 57 scoped_ptr<LevelDBDatabase>* db,
38 bool* is_disk_full) = 0; 58 bool* is_disk_full) = 0;
39 virtual bool DestroyLevelDB(const base::FilePath& file_name) = 0; 59 virtual bool DestroyLevelDB(const base::FilePath& file_name) = 0;
40 }; 60 };
41 61
42 class CONTENT_EXPORT IndexedDBBackingStore 62 class CONTENT_EXPORT IndexedDBBackingStore
43 : public base::RefCounted<IndexedDBBackingStore> { 63 : public base::RefCounted<IndexedDBBackingStore> {
44 public: 64 public:
45 class CONTENT_EXPORT Transaction; 65 class CONTENT_EXPORT Transaction;
46 66
47 const GURL& origin_url() const { return origin_url_; } 67 const GURL& origin_url() const { return origin_url_; }
48 base::OneShotTimer<IndexedDBBackingStore>* close_timer() { 68 base::OneShotTimer<IndexedDBBackingStore>* close_timer() {
49 return &close_timer_; 69 return &close_timer_;
50 } 70 }
71 IndexedDBFactory* factory() const { return indexed_db_factory_; }
51 72
52 static scoped_refptr<IndexedDBBackingStore> Open( 73 static scoped_refptr<IndexedDBBackingStore> Open(
74 IndexedDBFactory* indexed_db_factory,
53 const GURL& origin_url, 75 const GURL& origin_url,
54 const base::FilePath& path_base, 76 const base::FilePath& path_base,
55 blink::WebIDBDataLoss* data_loss, 77 net::URLRequestContext* request_context,
56 std::string* data_loss_message,
57 bool* disk_full);
58
59 static scoped_refptr<IndexedDBBackingStore> Open(
60 const GURL& origin_url,
61 const base::FilePath& path_base,
62 blink::WebIDBDataLoss* data_loss, 78 blink::WebIDBDataLoss* data_loss,
63 std::string* data_loss_message, 79 std::string* data_loss_message,
64 bool* disk_full, 80 bool* disk_full,
65 LevelDBFactory* factory); 81 base::TaskRunner* task_runner,
82 bool clean_journal);
83
84 static scoped_refptr<IndexedDBBackingStore> Open(
85 IndexedDBFactory* indexed_db_factory,
86 const GURL& origin_url,
87 const base::FilePath& path_base,
88 net::URLRequestContext* request_context,
89 blink::WebIDBDataLoss* data_loss,
90 std::string* data_loss_message,
91 bool* disk_full,
92 LevelDBFactory* factory,
93 base::TaskRunner* task_runner,
94 bool clean_journal);
66 static scoped_refptr<IndexedDBBackingStore> OpenInMemory( 95 static scoped_refptr<IndexedDBBackingStore> OpenInMemory(
67 const GURL& origin_url); 96 const GURL& origin_url);
68 static scoped_refptr<IndexedDBBackingStore> OpenInMemory( 97 static scoped_refptr<IndexedDBBackingStore> OpenInMemory(
69 const GURL& origin_url, 98 const GURL& origin_url,
70 LevelDBFactory* factory); 99 LevelDBFactory* factory);
71 100
101 void GrantChildProcessPermissions(int child_process_id);
102
72 virtual std::vector<string16> GetDatabaseNames(); 103 virtual std::vector<string16> GetDatabaseNames();
73 virtual bool GetIDBDatabaseMetaData(const string16& name, 104 virtual bool GetIDBDatabaseMetaData(const string16& name,
74 IndexedDBDatabaseMetadata* metadata, 105 IndexedDBDatabaseMetadata* metadata,
75 bool* success) WARN_UNUSED_RESULT; 106 bool* success) WARN_UNUSED_RESULT;
76 virtual bool CreateIDBDatabaseMetaData(const string16& name, 107 virtual bool CreateIDBDatabaseMetaData(const string16& name,
77 const string16& version, 108 const string16& version,
78 int64 int_version, 109 int64 int_version,
79 int64* row_id); 110 int64* row_id);
80 virtual bool UpdateIDBDatabaseIntVersion( 111 virtual bool UpdateIDBDatabaseIntVersion(
81 IndexedDBBackingStore::Transaction* transaction, 112 IndexedDBBackingStore::Transaction* transaction,
(...skipping 30 matching lines...) Expand all
112 } 143 }
113 144
114 private: 145 private:
115 // TODO(jsbell): Make it more clear that this is the *encoded* version of 146 // TODO(jsbell): Make it more clear that this is the *encoded* version of
116 // the key. 147 // the key.
117 std::string primary_key_; 148 std::string primary_key_;
118 int64 version_; 149 int64 version_;
119 DISALLOW_COPY_AND_ASSIGN(RecordIdentifier); 150 DISALLOW_COPY_AND_ASSIGN(RecordIdentifier);
120 }; 151 };
121 152
153 class BlobWriteCallback : public RefCounted<BlobWriteCallback> {
154 public:
155 virtual ~BlobWriteCallback() { }
156 virtual void didSucceed() = 0;
157 virtual void didFail() = 0;
158 };
159
122 virtual bool GetRecord(IndexedDBBackingStore::Transaction* transaction, 160 virtual bool GetRecord(IndexedDBBackingStore::Transaction* transaction,
123 int64 database_id, 161 int64 database_id,
124 int64 object_store_id, 162 int64 object_store_id,
125 const IndexedDBKey& key, 163 const IndexedDBKey& key,
126 std::string* record) WARN_UNUSED_RESULT; 164 IndexedDBValue* record) WARN_UNUSED_RESULT;
127 virtual bool PutRecord(IndexedDBBackingStore::Transaction* transaction, 165 virtual bool PutRecord(IndexedDBBackingStore::Transaction* transaction,
128 int64 database_id, 166 int64 database_id,
129 int64 object_store_id, 167 int64 object_store_id,
130 const IndexedDBKey& key, 168 const IndexedDBKey& key,
131 const std::string& value, 169 IndexedDBValue& value,
170 std::vector<webkit_blob::BlobDataHandle*>* handles,
132 RecordIdentifier* record) WARN_UNUSED_RESULT; 171 RecordIdentifier* record) WARN_UNUSED_RESULT;
133 virtual bool ClearObjectStore(IndexedDBBackingStore::Transaction* transaction, 172 virtual bool ClearObjectStore(IndexedDBBackingStore::Transaction* transaction,
134 int64 database_id, 173 int64 database_id,
135 int64 object_store_id) WARN_UNUSED_RESULT; 174 int64 object_store_id) WARN_UNUSED_RESULT;
136 virtual bool DeleteRecord(IndexedDBBackingStore::Transaction* transaction, 175 virtual bool DeleteRecord(IndexedDBBackingStore::Transaction* transaction,
137 int64 database_id, 176 int64 database_id,
138 int64 object_store_id, 177 int64 object_store_id,
139 const RecordIdentifier& record) WARN_UNUSED_RESULT; 178 const RecordIdentifier& record) WARN_UNUSED_RESULT;
179 virtual bool DeleteRange(IndexedDBBackingStore::Transaction* transaction,
180 int64 database_id,
181 int64 object_store_id,
182 const IndexedDBKeyRange&) WARN_UNUSED_RESULT;
140 virtual bool GetKeyGeneratorCurrentNumber( 183 virtual bool GetKeyGeneratorCurrentNumber(
141 IndexedDBBackingStore::Transaction* transaction, 184 IndexedDBBackingStore::Transaction* transaction,
142 int64 database_id, 185 int64 database_id,
143 int64 object_store_id, 186 int64 object_store_id,
144 int64* current_number) WARN_UNUSED_RESULT; 187 int64* current_number) WARN_UNUSED_RESULT;
145 virtual bool MaybeUpdateKeyGeneratorCurrentNumber( 188 virtual bool MaybeUpdateKeyGeneratorCurrentNumber(
146 IndexedDBBackingStore::Transaction* transaction, 189 IndexedDBBackingStore::Transaction* transaction,
147 int64 database_id, 190 int64 database_id,
148 int64 object_store_id, 191 int64 object_store_id,
149 int64 new_state, 192 int64 new_state,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 const IndexedDBKey& key, 226 const IndexedDBKey& key,
184 scoped_ptr<IndexedDBKey>* primary_key) WARN_UNUSED_RESULT; 227 scoped_ptr<IndexedDBKey>* primary_key) WARN_UNUSED_RESULT;
185 virtual bool KeyExistsInIndex(IndexedDBBackingStore::Transaction* transaction, 228 virtual bool KeyExistsInIndex(IndexedDBBackingStore::Transaction* transaction,
186 int64 database_id, 229 int64 database_id,
187 int64 object_store_id, 230 int64 object_store_id,
188 int64 index_id, 231 int64 index_id,
189 const IndexedDBKey& key, 232 const IndexedDBKey& key,
190 scoped_ptr<IndexedDBKey>* found_primary_key, 233 scoped_ptr<IndexedDBKey>* found_primary_key,
191 bool* exists) WARN_UNUSED_RESULT; 234 bool* exists) WARN_UNUSED_RESULT;
192 235
236 // Public for IndexedDBBlobRegistryCallback.
237 void ReportBlobUnused(int64 database_id, int64 blob_key);
238
239 base::FilePath GetIDBBlobFileName(int64 database_id, int64 key);
240
193 class Cursor { 241 class Cursor {
194 public: 242 public:
195 virtual ~Cursor(); 243 virtual ~Cursor();
196 244
197 enum IteratorState { 245 enum IteratorState {
198 READY = 0, 246 READY = 0,
199 SEEK 247 SEEK
200 }; 248 };
201 249
202 struct CursorOptions { 250 struct CursorOptions {
(...skipping 16 matching lines...) Expand all
219 return Continue(key, NULL, state); 267 return Continue(key, NULL, state);
220 } 268 }
221 bool Continue(const IndexedDBKey* key, 269 bool Continue(const IndexedDBKey* key,
222 const IndexedDBKey* primary_key, 270 const IndexedDBKey* primary_key,
223 IteratorState state); 271 IteratorState state);
224 bool Advance(uint32 count); 272 bool Advance(uint32 count);
225 bool FirstSeek(); 273 bool FirstSeek();
226 274
227 virtual Cursor* Clone() = 0; 275 virtual Cursor* Clone() = 0;
228 virtual const IndexedDBKey& primary_key() const; 276 virtual const IndexedDBKey& primary_key() const;
229 virtual std::string* Value() = 0; 277 virtual IndexedDBValue* Value() = 0;
230 virtual const RecordIdentifier& record_identifier() const; 278 virtual const RecordIdentifier& record_identifier() const;
231 virtual bool LoadCurrentRow() = 0; 279 virtual bool LoadCurrentRow() = 0;
232 280
233 protected: 281 protected:
234 Cursor(LevelDBTransaction* transaction, 282 Cursor(scoped_refptr<IndexedDBBackingStore> backing_store,
283 LevelDBTransaction* transaction,
284 int64 database_id,
235 const CursorOptions& cursor_options); 285 const CursorOptions& cursor_options);
236 explicit Cursor(const IndexedDBBackingStore::Cursor* other); 286 explicit Cursor(const IndexedDBBackingStore::Cursor* other);
237 287
238 virtual std::string EncodeKey(const IndexedDBKey& key) = 0; 288 virtual std::string EncodeKey(const IndexedDBKey& key) = 0;
239 virtual std::string EncodeKey(const IndexedDBKey& key, 289 virtual std::string EncodeKey(const IndexedDBKey& key,
240 const IndexedDBKey& primary_key) = 0; 290 const IndexedDBKey& primary_key) = 0;
241 291
242 bool IsPastBounds() const; 292 bool IsPastBounds() const;
243 bool HaveEnteredRange() const; 293 bool HaveEnteredRange() const;
244 294
295 scoped_refptr<IndexedDBBackingStore> backing_store_;
245 LevelDBTransaction* transaction_; 296 LevelDBTransaction* transaction_;
297 int64 database_id_;
246 const CursorOptions cursor_options_; 298 const CursorOptions cursor_options_;
247 scoped_ptr<LevelDBIterator> iterator_; 299 scoped_ptr<LevelDBIterator> iterator_;
248 scoped_ptr<IndexedDBKey> current_key_; 300 scoped_ptr<IndexedDBKey> current_key_;
249 IndexedDBBackingStore::RecordIdentifier record_identifier_; 301 IndexedDBBackingStore::RecordIdentifier record_identifier_;
250 }; 302 };
251 303
252 virtual scoped_ptr<Cursor> OpenObjectStoreKeyCursor( 304 virtual scoped_ptr<Cursor> OpenObjectStoreKeyCursor(
253 IndexedDBBackingStore::Transaction* transaction, 305 IndexedDBBackingStore::Transaction* transaction,
254 int64 database_id, 306 int64 database_id,
255 int64 object_store_id, 307 int64 object_store_id,
(...skipping 18 matching lines...) Expand all
274 int64 object_store_id, 326 int64 object_store_id,
275 int64 index_id, 327 int64 index_id,
276 const IndexedDBKeyRange& key_range, 328 const IndexedDBKeyRange& key_range,
277 indexed_db::CursorDirection); 329 indexed_db::CursorDirection);
278 330
279 class Transaction { 331 class Transaction {
280 public: 332 public:
281 explicit Transaction(IndexedDBBackingStore* backing_store); 333 explicit Transaction(IndexedDBBackingStore* backing_store);
282 ~Transaction(); 334 ~Transaction();
283 void Begin(); 335 void Begin();
284 bool Commit(); 336 // The callback will be called eventually on success or failure, or
337 // immediately if phase one is complete due to lack of any blobs to write.
338 bool CommitPhaseOne(scoped_refptr<BlobWriteCallback>);
339 bool CommitPhaseTwo();
285 void Rollback(); 340 void Rollback();
286 void Reset() { 341 void Reset() {
287 backing_store_ = NULL; 342 backing_store_ = NULL;
288 transaction_ = NULL; 343 transaction_ = NULL;
289 } 344 }
345 void PutBlobInfo(int64 database_id, int64 object_store_id,
346 const std::string& key, std::vector<IndexedDBBlobInfo>*,
347 std::vector<webkit_blob::BlobDataHandle*>* handles);
290 348
291 LevelDBTransaction* transaction() { return transaction_; } 349 LevelDBTransaction* transaction() { return transaction_; }
292 350
351 // DatabaseId, BlobKey
352 typedef std::pair<int64_t, int64_t> BlobJournalEntryType;
353 typedef std::vector<BlobJournalEntryType> BlobJournalType;
354 // This holds a BlobEntryKey and the encoded IndexedDBBlobInfo vector stored
355 // under that key.
356 typedef std::vector< std::pair<BlobEntryKey, std::string> >
357 BlobEntryKeyValuePairVec;
358
359 class WriteDescriptor {
360 public:
361 WriteDescriptor(const GURL& url, int64_t key);
362 WriteDescriptor(const base::FilePath& path, int64_t key);
363
364 bool is_file() const { return is_file_; }
365 const GURL& url() const {
366 DCHECK(!is_file_);
367 return url_;
368 }
369 const base::FilePath& file_path() const {
370 DCHECK(is_file_);
371 return file_path_;
372 }
373 int64_t key() const { return key_; }
374 private:
375 bool is_file_;
376 GURL url_;
377 base::FilePath file_path_;
378 int64_t key_;
379 };
380
381 class ChainedBlobWriter;
382
383 typedef std::vector<WriteDescriptor> WriteDescriptorVec;
384
293 private: 385 private:
386 class BlobChangeRecord {
387 public:
388 BlobChangeRecord() {}
389 ~BlobChangeRecord();
390 void set_key(const std::string& key) {
391 key_ = key;
392 }
393 const std::string& key() const {
394 return key_;
395 }
396 void set_object_store_id(int64 object_store_id) {
397 object_store_id_ = object_store_id;
398 }
399 int64 object_store_id() const {
400 return object_store_id_;
401 }
402 void SetBlobInfo(std::vector<IndexedDBBlobInfo>* blob_info);
403 std::vector<IndexedDBBlobInfo>& mutable_blob_info() {
404 return blob_info_;
405 }
406 void SetHandles(std::vector<webkit_blob::BlobDataHandle*>* handles);
407
408 private:
409 void DeleteHandles();
410
411 std::string key_;
412 int64 object_store_id_;
413 std::vector<IndexedDBBlobInfo> blob_info_;
414 std::vector<webkit_blob::BlobDataHandle*> handles_;
415 };
416 class BlobWriteCallbackWrapper;
417 typedef std::map<std::string, BlobChangeRecord*> BlobChangeMap;
418
419 // These return true on success, false on failure.
420 bool HandleBlobPreTransaction(BlobEntryKeyValuePairVec* new_blob_entries,
421 WriteDescriptorVec* new_files_to_write);
422 bool CollectBlobFilesToRemove();
423 // The callback will be called eventually on success or failure.
424 void WriteNewBlobs(BlobEntryKeyValuePairVec& new_blob_entries,
425 WriteDescriptorVec& new_files_to_write,
426 scoped_refptr<BlobWriteCallback> callback);
427 bool SortBlobsToRemove();
428
294 IndexedDBBackingStore* backing_store_; 429 IndexedDBBackingStore* backing_store_;
295 scoped_refptr<LevelDBTransaction> transaction_; 430 scoped_refptr<LevelDBTransaction> transaction_;
431 BlobChangeMap blob_change_map_;
432 int64 database_id_;
433 BlobJournalType blobs_to_remove_;
434 scoped_refptr<ChainedBlobWriter> chained_blob_writer_;
296 }; 435 };
297 436
437 LevelDBComparator* comparator() { return comparator_.get(); }
438 IndexedDBActiveBlobRegistry* active_blob_registry() {
439 return &active_blob_registry_;
440 }
441
442 base::TaskRunner* task_runner() { return task_runner_; }
443
298 protected: 444 protected:
299 IndexedDBBackingStore(const GURL& origin_url, 445 IndexedDBBackingStore(IndexedDBFactory* indexed_db_factory,
446 const GURL& origin_url,
447 const base::FilePath& blob_path,
448 net::URLRequestContext* request_context,
300 scoped_ptr<LevelDBDatabase> db, 449 scoped_ptr<LevelDBDatabase> db,
301 scoped_ptr<LevelDBComparator> comparator); 450 scoped_ptr<LevelDBComparator> comparator,
451 base::TaskRunner* task_runner);
302 virtual ~IndexedDBBackingStore(); 452 virtual ~IndexedDBBackingStore();
303 friend class base::RefCounted<IndexedDBBackingStore>; 453 friend class base::RefCounted<IndexedDBBackingStore>;
304 454
455 bool WriteBlobFile(int64 database_id,
456 const Transaction::WriteDescriptor& descriptor,
457 Transaction::ChainedBlobWriter* chained_blob_writer);
458
305 private: 459 private:
306 static scoped_refptr<IndexedDBBackingStore> Create( 460 static scoped_refptr<IndexedDBBackingStore> Create(
461 IndexedDBFactory* indexed_db_factory,
307 const GURL& origin_url, 462 const GURL& origin_url,
463 const base::FilePath& blob_path,
464 net::URLRequestContext* request_context,
308 scoped_ptr<LevelDBDatabase> db, 465 scoped_ptr<LevelDBDatabase> db,
309 scoped_ptr<LevelDBComparator> comparator); 466 scoped_ptr<LevelDBComparator> comparator,
467 base::TaskRunner* task_runner);
310 468
311 bool FindKeyInIndex(IndexedDBBackingStore::Transaction* transaction, 469 bool FindKeyInIndex(IndexedDBBackingStore::Transaction* transaction,
312 int64 database_id, 470 int64 database_id,
313 int64 object_store_id, 471 int64 object_store_id,
314 int64 index_id, 472 int64 index_id,
315 const IndexedDBKey& key, 473 const IndexedDBKey& key,
316 std::string* found_encoded_primary_key, 474 std::string* found_encoded_primary_key,
317 bool* found); 475 bool* found);
318 bool GetIndexes(int64 database_id, 476 bool GetIndexes(int64 database_id,
319 int64 object_store_id, 477 int64 object_store_id,
320 IndexedDBObjectStoreMetadata::IndexMap* map) 478 IndexedDBObjectStoreMetadata::IndexMap* map)
321 WARN_UNUSED_RESULT; 479 WARN_UNUSED_RESULT;
480 bool RemoveBlobFile(int64 database_id, int64 key);
481 bool RemoveBlobDirectory(int64 database_id);
482 bool CleanUpBlobJournal(const std::string& level_db_key);
483 void CleanPrimaryJournalIgnoreReturn();
322 484
485 IndexedDBFactory* indexed_db_factory_;
323 const GURL origin_url_; 486 const GURL origin_url_;
324 487
325 // The origin identifier is a key prefix unique to the origin used in the 488 // The origin identifier is a key prefix unique to the origin used in the
326 // leveldb backing store to partition data by origin. It is a normalized 489 // leveldb backing store to partition data by origin. It is a normalized
327 // version of the origin URL with a versioning suffix appended, e.g. 490 // version of the origin URL with a versioning suffix appended, e.g.
328 // "http_localhost_81@1" Since only one origin is stored per backing store 491 // "http_localhost_81@1" Since only one origin is stored per backing store
329 // this is redundant but necessary for backwards compatibility; the suffix 492 // this is redundant but necessary for backwards compatibility; the suffix
330 // provides for future flexibility. 493 // provides for future flexibility.
331 const std::string origin_identifier_; 494 const std::string origin_identifier_;
332 495
496 base::FilePath blob_path_;
497 net::URLRequestContext* request_context_;
498 base::TaskRunner* task_runner_;
499 std::set<int> child_process_ids_granted_;
500 base::OneShotTimer<IndexedDBBackingStore> journal_cleaning_timer_;
501
333 scoped_ptr<LevelDBDatabase> db_; 502 scoped_ptr<LevelDBDatabase> db_;
334 scoped_ptr<LevelDBComparator> comparator_; 503 scoped_ptr<LevelDBComparator> comparator_;
504 // The active_blob_registry_ will hold a refcount to this backing store
505 // whenever any live blobs are registered with it.
506 IndexedDBActiveBlobRegistry active_blob_registry_;
335 base::OneShotTimer<IndexedDBBackingStore> close_timer_; 507 base::OneShotTimer<IndexedDBBackingStore> close_timer_;
336 }; 508 };
337 509
338 } // namespace content 510 } // namespace content
339 511
340 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ 512 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698