OLD | NEW |
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 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 5 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 | 542 |
543 // static | 543 // static |
544 scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open( | 544 scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open( |
545 IndexedDBFactory* indexed_db_factory, | 545 IndexedDBFactory* indexed_db_factory, |
546 const GURL& origin_url, | 546 const GURL& origin_url, |
547 const base::FilePath& path_base, | 547 const base::FilePath& path_base, |
548 net::URLRequestContext* request_context, | 548 net::URLRequestContext* request_context, |
549 blink::WebIDBDataLoss* data_loss, | 549 blink::WebIDBDataLoss* data_loss, |
550 std::string* data_loss_message, | 550 std::string* data_loss_message, |
551 bool* disk_full, | 551 bool* disk_full, |
552 base::TaskRunner* task_runner) { | 552 base::TaskRunner* task_runner, |
| 553 bool clean_journal) { |
553 *data_loss = blink::WebIDBDataLossNone; | 554 *data_loss = blink::WebIDBDataLossNone; |
554 DefaultLevelDBFactory leveldb_factory; | 555 DefaultLevelDBFactory leveldb_factory; |
555 return IndexedDBBackingStore::Open(indexed_db_factory, | 556 return IndexedDBBackingStore::Open(indexed_db_factory, |
556 origin_url, | 557 origin_url, |
557 path_base, | 558 path_base, |
558 request_context, | 559 request_context, |
559 data_loss, | 560 data_loss, |
560 data_loss_message, | 561 data_loss_message, |
561 disk_full, | 562 disk_full, |
562 &leveldb_factory, | 563 &leveldb_factory, |
563 task_runner); | 564 task_runner, |
| 565 clean_journal); |
564 } | 566 } |
565 | 567 |
566 static std::string OriginToCustomHistogramSuffix(const GURL& origin_url) { | 568 static std::string OriginToCustomHistogramSuffix(const GURL& origin_url) { |
567 if (origin_url.host() == "docs.google.com") | 569 if (origin_url.host() == "docs.google.com") |
568 return ".Docs"; | 570 return ".Docs"; |
569 return std::string(); | 571 return std::string(); |
570 } | 572 } |
571 | 573 |
572 static void HistogramOpenStatus(IndexedDBBackingStoreOpenResult result, | 574 static void HistogramOpenStatus(IndexedDBBackingStoreOpenResult result, |
573 const GURL& origin_url) { | 575 const GURL& origin_url) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 // static | 696 // static |
695 scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open( | 697 scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open( |
696 IndexedDBFactory* indexed_db_factory, | 698 IndexedDBFactory* indexed_db_factory, |
697 const GURL& origin_url, | 699 const GURL& origin_url, |
698 const base::FilePath& path_base, | 700 const base::FilePath& path_base, |
699 net::URLRequestContext* request_context, | 701 net::URLRequestContext* request_context, |
700 blink::WebIDBDataLoss* data_loss, | 702 blink::WebIDBDataLoss* data_loss, |
701 std::string* data_loss_message, | 703 std::string* data_loss_message, |
702 bool* is_disk_full, | 704 bool* is_disk_full, |
703 LevelDBFactory* leveldb_factory, | 705 LevelDBFactory* leveldb_factory, |
704 base::TaskRunner* task_runner) { | 706 base::TaskRunner* task_runner, |
| 707 bool clean_journal) { |
705 IDB_TRACE("IndexedDBBackingStore::Open"); | 708 IDB_TRACE("IndexedDBBackingStore::Open"); |
706 DCHECK(!path_base.empty()); | 709 DCHECK(!path_base.empty()); |
707 *data_loss = blink::WebIDBDataLossNone; | 710 *data_loss = blink::WebIDBDataLossNone; |
708 *data_loss_message = ""; | 711 *data_loss_message = ""; |
709 *is_disk_full = false; | 712 *is_disk_full = false; |
710 | 713 |
711 scoped_ptr<LevelDBComparator> comparator(new Comparator()); | 714 scoped_ptr<LevelDBComparator> comparator(new Comparator()); |
712 | 715 |
713 if (!IsStringASCII(path_base.AsUTF8Unsafe())) { | 716 if (!IsStringASCII(path_base.AsUTF8Unsafe())) { |
714 HistogramOpenStatus(INDEXED_DB_BACKING_STORE_OPEN_ATTEMPT_NON_ASCII, | 717 HistogramOpenStatus(INDEXED_DB_BACKING_STORE_OPEN_ATTEMPT_NON_ASCII, |
(...skipping 2596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3311 const GURL& url, | 3314 const GURL& url, |
3312 int64_t key) | 3315 int64_t key) |
3313 : is_file_(false), url_(url), key_(key) {} | 3316 : is_file_(false), url_(url), key_(key) {} |
3314 | 3317 |
3315 IndexedDBBackingStore::Transaction::WriteDescriptor::WriteDescriptor( | 3318 IndexedDBBackingStore::Transaction::WriteDescriptor::WriteDescriptor( |
3316 const FilePath& file_path, | 3319 const FilePath& file_path, |
3317 int64_t key) | 3320 int64_t key) |
3318 : is_file_(true), file_path_(file_path), key_(key) {} | 3321 : is_file_(true), file_path_(file_path), key_(key) {} |
3319 | 3322 |
3320 } // namespace content | 3323 } // namespace content |
OLD | NEW |