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

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

Issue 259063004: Track which IndexedDBBackingStores have been opened since boot. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
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/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 INDEXED_DB_BACKING_STORE_OPEN_NO_RECOVERY, 499 INDEXED_DB_BACKING_STORE_OPEN_NO_RECOVERY,
500 INDEXED_DB_BACKING_STORE_OPEN_FAILED_PRIOR_CORRUPTION, 500 INDEXED_DB_BACKING_STORE_OPEN_FAILED_PRIOR_CORRUPTION,
501 INDEXED_DB_BACKING_STORE_OPEN_MAX, 501 INDEXED_DB_BACKING_STORE_OPEN_MAX,
502 }; 502 };
503 503
504 // static 504 // static
505 scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open( 505 scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open(
506 IndexedDBFactory* indexed_db_factory, 506 IndexedDBFactory* indexed_db_factory,
507 const GURL& origin_url, 507 const GURL& origin_url,
508 const base::FilePath& path_base, 508 const base::FilePath& path_base,
509 net::URLRequestContext* request_context,
509 blink::WebIDBDataLoss* data_loss, 510 blink::WebIDBDataLoss* data_loss,
510 std::string* data_loss_message, 511 std::string* data_loss_message,
511 bool* disk_full, 512 bool* disk_full,
512 base::TaskRunner* task_runner) { 513 base::TaskRunner* task_runner,
514 bool clean_journal) {
513 *data_loss = blink::WebIDBDataLossNone; 515 *data_loss = blink::WebIDBDataLossNone;
514 DefaultLevelDBFactory leveldb_factory; 516 DefaultLevelDBFactory leveldb_factory;
515 return IndexedDBBackingStore::Open(indexed_db_factory, 517 return IndexedDBBackingStore::Open(indexed_db_factory,
516 origin_url, 518 origin_url,
517 path_base, 519 path_base,
520 request_context,
518 data_loss, 521 data_loss,
519 data_loss_message, 522 data_loss_message,
520 disk_full, 523 disk_full,
521 &leveldb_factory, 524 &leveldb_factory,
522 task_runner); 525 task_runner,
526 clean_journal);
523 } 527 }
524 528
525 static std::string OriginToCustomHistogramSuffix(const GURL& origin_url) { 529 static std::string OriginToCustomHistogramSuffix(const GURL& origin_url) {
526 if (origin_url.host() == "docs.google.com") 530 if (origin_url.host() == "docs.google.com")
527 return ".Docs"; 531 return ".Docs";
528 return std::string(); 532 return std::string();
529 } 533 }
530 534
531 static void HistogramOpenStatus(IndexedDBBackingStoreOpenResult result, 535 static void HistogramOpenStatus(IndexedDBBackingStoreOpenResult result,
532 const GURL& origin_url) { 536 const GURL& origin_url) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 return false; 652 return false;
649 int written = file.Write(0, output_js.c_str(), output_js.length()); 653 int written = file.Write(0, output_js.c_str(), output_js.length());
650 return size_t(written) == output_js.length(); 654 return size_t(written) == output_js.length();
651 } 655 }
652 656
653 // static 657 // static
654 scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open( 658 scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open(
655 IndexedDBFactory* indexed_db_factory, 659 IndexedDBFactory* indexed_db_factory,
656 const GURL& origin_url, 660 const GURL& origin_url,
657 const base::FilePath& path_base, 661 const base::FilePath& path_base,
662 net::URLRequestContext* request_context,
cmumford 2014/04/29 16:08:34 Why add these two unused parameters to this versio
ericu 2014/04/29 18:24:19 Now that I've committed blob_writer and merged out
658 blink::WebIDBDataLoss* data_loss, 663 blink::WebIDBDataLoss* data_loss,
659 std::string* data_loss_message, 664 std::string* data_loss_message,
660 bool* is_disk_full, 665 bool* is_disk_full,
661 LevelDBFactory* leveldb_factory, 666 LevelDBFactory* leveldb_factory,
662 base::TaskRunner* task_runner) { 667 base::TaskRunner* task_runner,
668 bool clean_journal) {
663 IDB_TRACE("IndexedDBBackingStore::Open"); 669 IDB_TRACE("IndexedDBBackingStore::Open");
664 DCHECK(!path_base.empty()); 670 DCHECK(!path_base.empty());
665 *data_loss = blink::WebIDBDataLossNone; 671 *data_loss = blink::WebIDBDataLossNone;
666 *data_loss_message = ""; 672 *data_loss_message = "";
667 *is_disk_full = false; 673 *is_disk_full = false;
668 674
669 scoped_ptr<LevelDBComparator> comparator(new Comparator()); 675 scoped_ptr<LevelDBComparator> comparator(new Comparator());
670 676
671 if (!IsStringASCII(path_base.AsUTF8Unsafe())) { 677 if (!IsStringASCII(path_base.AsUTF8Unsafe())) {
672 HistogramOpenStatus(INDEXED_DB_BACKING_STORE_OPEN_ATTEMPT_NON_ASCII, 678 HistogramOpenStatus(INDEXED_DB_BACKING_STORE_OPEN_ATTEMPT_NON_ASCII,
(...skipping 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after
2998 } else { 3004 } else {
2999 record = it->second; 3005 record = it->second;
3000 } 3006 }
3001 DCHECK_EQ(record->object_store_id(), object_store_id); 3007 DCHECK_EQ(record->object_store_id(), object_store_id);
3002 record->SetBlobInfo(blob_info); 3008 record->SetBlobInfo(blob_info);
3003 record->SetHandles(handles); 3009 record->SetHandles(handles);
3004 DCHECK(!handles || !handles->size()); 3010 DCHECK(!handles || !handles->size());
3005 } 3011 }
3006 3012
3007 } // namespace content 3013 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698