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

Side by Side Diff: chrome/browser/net/sqlite_channel_id_store.cc

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build Created 6 years, 4 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 2014 The Chromium Authors. All rights reserved. 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 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 "chrome/browser/net/sqlite_channel_id_store.h" 5 #include "chrome/browser/net/sqlite_channel_id_store.h"
6 6
7 #include <list> 7 #include <list>
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 18 matching lines...) Expand all
29 #include "webkit/browser/quota/special_storage_policy.h" 29 #include "webkit/browser/quota/special_storage_policy.h"
30 30
31 // This class is designed to be shared between any calling threads and the 31 // This class is designed to be shared between any calling threads and the
32 // background task runner. It batches operations and commits them on a timer. 32 // background task runner. It batches operations and commits them on a timer.
33 class SQLiteChannelIDStore::Backend 33 class SQLiteChannelIDStore::Backend
34 : public base::RefCountedThreadSafe<SQLiteChannelIDStore::Backend> { 34 : public base::RefCountedThreadSafe<SQLiteChannelIDStore::Backend> {
35 public: 35 public:
36 Backend( 36 Backend(
37 const base::FilePath& path, 37 const base::FilePath& path,
38 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, 38 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner,
39 quota::SpecialStoragePolicy* special_storage_policy) 39 storage::SpecialStoragePolicy* special_storage_policy)
40 : path_(path), 40 : path_(path),
41 num_pending_(0), 41 num_pending_(0),
42 force_keep_session_state_(false), 42 force_keep_session_state_(false),
43 background_task_runner_(background_task_runner), 43 background_task_runner_(background_task_runner),
44 special_storage_policy_(special_storage_policy), 44 special_storage_policy_(special_storage_policy),
45 corruption_detected_(false) {} 45 corruption_detected_(false) {}
46 46
47 // Creates or loads the SQLite database. 47 // Creates or loads the SQLite database.
48 void Load(const LoadedCallback& loaded_callback); 48 void Load(const LoadedCallback& loaded_callback);
49 49
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // True if the persistent store should skip clear on exit rules. 123 // True if the persistent store should skip clear on exit rules.
124 bool force_keep_session_state_; 124 bool force_keep_session_state_;
125 // Guard |pending_|, |num_pending_| and |force_keep_session_state_|. 125 // Guard |pending_|, |num_pending_| and |force_keep_session_state_|.
126 base::Lock lock_; 126 base::Lock lock_;
127 127
128 // Cache of origins we have channel IDs stored for. 128 // Cache of origins we have channel IDs stored for.
129 std::set<std::string> channel_id_origins_; 129 std::set<std::string> channel_id_origins_;
130 130
131 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; 131 scoped_refptr<base::SequencedTaskRunner> background_task_runner_;
132 132
133 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; 133 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_;
134 134
135 // Indicates if the kill-database callback has been scheduled. 135 // Indicates if the kill-database callback has been scheduled.
136 bool corruption_detected_; 136 bool corruption_detected_;
137 137
138 DISALLOW_COPY_AND_ASSIGN(Backend); 138 DISALLOW_COPY_AND_ASSIGN(Backend);
139 }; 139 };
140 140
141 // Version number of the database. 141 // Version number of the database.
142 static const int kCurrentVersionNumber = 4; 142 static const int kCurrentVersionNumber = 4;
143 static const int kCompatibleVersionNumber = 1; 143 static const int kCompatibleVersionNumber = 1;
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 } 603 }
604 604
605 void SQLiteChannelIDStore::Backend::SetForceKeepSessionState() { 605 void SQLiteChannelIDStore::Backend::SetForceKeepSessionState() {
606 base::AutoLock locked(lock_); 606 base::AutoLock locked(lock_);
607 force_keep_session_state_ = true; 607 force_keep_session_state_ = true;
608 } 608 }
609 609
610 SQLiteChannelIDStore::SQLiteChannelIDStore( 610 SQLiteChannelIDStore::SQLiteChannelIDStore(
611 const base::FilePath& path, 611 const base::FilePath& path,
612 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, 612 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner,
613 quota::SpecialStoragePolicy* special_storage_policy) 613 storage::SpecialStoragePolicy* special_storage_policy)
614 : backend_(new Backend(path, 614 : backend_(
615 background_task_runner, 615 new Backend(path, background_task_runner, special_storage_policy)) {
616 special_storage_policy)) {} 616 }
617 617
618 void SQLiteChannelIDStore::Load( 618 void SQLiteChannelIDStore::Load(
619 const LoadedCallback& loaded_callback) { 619 const LoadedCallback& loaded_callback) {
620 backend_->Load(loaded_callback); 620 backend_->Load(loaded_callback);
621 } 621 }
622 622
623 void SQLiteChannelIDStore::AddChannelID( 623 void SQLiteChannelIDStore::AddChannelID(
624 const net::DefaultChannelIDStore::ChannelID& channel_id) { 624 const net::DefaultChannelIDStore::ChannelID& channel_id) {
625 backend_->AddChannelID(channel_id); 625 backend_->AddChannelID(channel_id);
626 } 626 }
627 627
628 void SQLiteChannelIDStore::DeleteChannelID( 628 void SQLiteChannelIDStore::DeleteChannelID(
629 const net::DefaultChannelIDStore::ChannelID& channel_id) { 629 const net::DefaultChannelIDStore::ChannelID& channel_id) {
630 backend_->DeleteChannelID(channel_id); 630 backend_->DeleteChannelID(channel_id);
631 } 631 }
632 632
633 void SQLiteChannelIDStore::SetForceKeepSessionState() { 633 void SQLiteChannelIDStore::SetForceKeepSessionState() {
634 backend_->SetForceKeepSessionState(); 634 backend_->SetForceKeepSessionState();
635 } 635 }
636 636
637 SQLiteChannelIDStore::~SQLiteChannelIDStore() { 637 SQLiteChannelIDStore::~SQLiteChannelIDStore() {
638 backend_->Close(); 638 backend_->Close();
639 // We release our reference to the Backend, though it will probably still have 639 // We release our reference to the Backend, though it will probably still have
640 // a reference if the background thread has not run Close() yet. 640 // a reference if the background thread has not run Close() yet.
641 } 641 }
OLDNEW
« no previous file with comments | « chrome/browser/net/sqlite_channel_id_store.h ('k') | chrome/browser/profiles/off_the_record_profile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698