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

Side by Side Diff: webkit/database/database_tracker.cc

Issue 8820009: Appcache, local storage, indexed db, databases: skip exit-time deletion when restarting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review. Created 9 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
« no previous file with comments | « webkit/database/database_tracker.h ('k') | webkit/database/database_tracker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/database/database_tracker.h" 5 #include "webkit/database/database_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 DatabaseTracker::DatabaseTracker( 93 DatabaseTracker::DatabaseTracker(
94 const FilePath& profile_path, 94 const FilePath& profile_path,
95 bool is_incognito, 95 bool is_incognito,
96 bool clear_local_state_on_exit, 96 bool clear_local_state_on_exit,
97 quota::SpecialStoragePolicy* special_storage_policy, 97 quota::SpecialStoragePolicy* special_storage_policy,
98 quota::QuotaManagerProxy* quota_manager_proxy, 98 quota::QuotaManagerProxy* quota_manager_proxy,
99 base::MessageLoopProxy* db_tracker_thread) 99 base::MessageLoopProxy* db_tracker_thread)
100 : is_initialized_(false), 100 : is_initialized_(false),
101 is_incognito_(is_incognito), 101 is_incognito_(is_incognito),
102 clear_local_state_on_exit_(clear_local_state_on_exit), 102 clear_local_state_on_exit_(clear_local_state_on_exit),
103 save_session_state_(false),
103 shutting_down_(false), 104 shutting_down_(false),
104 profile_path_(profile_path), 105 profile_path_(profile_path),
105 db_dir_(is_incognito_ ? 106 db_dir_(is_incognito_ ?
106 profile_path_.Append(kIncognitoDatabaseDirectoryName) : 107 profile_path_.Append(kIncognitoDatabaseDirectoryName) :
107 profile_path_.Append(kDatabaseDirectoryName)), 108 profile_path_.Append(kDatabaseDirectoryName)),
108 db_(new sql::Connection()), 109 db_(new sql::Connection()),
109 databases_table_(NULL), 110 databases_table_(NULL),
110 meta_table_(NULL), 111 meta_table_(NULL),
111 special_storage_policy_(special_storage_policy), 112 special_storage_policy_(special_storage_policy),
112 quota_manager_proxy_(quota_manager_proxy), 113 quota_manager_proxy_(quota_manager_proxy),
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 851
851 void DatabaseTracker::Shutdown() { 852 void DatabaseTracker::Shutdown() {
852 DCHECK(db_tracker_thread_.get()); 853 DCHECK(db_tracker_thread_.get());
853 DCHECK(db_tracker_thread_->BelongsToCurrentThread()); 854 DCHECK(db_tracker_thread_->BelongsToCurrentThread());
854 if (shutting_down_) { 855 if (shutting_down_) {
855 NOTREACHED(); 856 NOTREACHED();
856 return; 857 return;
857 } 858 }
858 if (is_incognito_) 859 if (is_incognito_)
859 DeleteIncognitoDBDirectory(); 860 DeleteIncognitoDBDirectory();
860 else 861 else if (!save_session_state_)
861 ClearLocalState(clear_local_state_on_exit_); 862 ClearLocalState(clear_local_state_on_exit_);
862 } 863 }
863 864
864 void DatabaseTracker::SetClearLocalStateOnExit(bool clear_local_state_on_exit) { 865 void DatabaseTracker::SetClearLocalStateOnExit(bool clear_local_state_on_exit) {
865 DCHECK(db_tracker_thread_.get()); 866 DCHECK(db_tracker_thread_.get());
866 if (!db_tracker_thread_->BelongsToCurrentThread()) { 867 if (!db_tracker_thread_->BelongsToCurrentThread()) {
867 db_tracker_thread_->PostTask( 868 db_tracker_thread_->PostTask(
868 FROM_HERE, 869 FROM_HERE,
869 base::Bind(&DatabaseTracker::SetClearLocalStateOnExit, this, 870 base::Bind(&DatabaseTracker::SetClearLocalStateOnExit, this,
870 clear_local_state_on_exit)); 871 clear_local_state_on_exit));
871 return; 872 return;
872 } 873 }
873 if (shutting_down_) { 874 if (shutting_down_) {
874 NOTREACHED(); 875 NOTREACHED();
875 return; 876 return;
876 } 877 }
877 clear_local_state_on_exit_ = clear_local_state_on_exit; 878 clear_local_state_on_exit_ = clear_local_state_on_exit;
878 } 879 }
879 880
881 void DatabaseTracker::SaveSessionState() {
882 DCHECK(db_tracker_thread_.get());
883 if (!db_tracker_thread_->BelongsToCurrentThread()) {
884 db_tracker_thread_->PostTask(
885 FROM_HERE,
886 base::Bind(&DatabaseTracker::SaveSessionState, this));
887 return;
888 }
889 save_session_state_ = true;
890 }
891
880 } // namespace webkit_database 892 } // namespace webkit_database
OLDNEW
« no previous file with comments | « webkit/database/database_tracker.h ('k') | webkit/database/database_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698