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

Side by Side Diff: webkit/dom_storage/dom_storage_context.cc

Issue 11434037: Debug prints for a failing test (ContinueWhereILeftOffTest.LocalStorageClearedOnExit). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 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 | « chrome/browser/sessions/session_service.cc ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/dom_storage/dom_storage_context.h" 5 #include "webkit/dom_storage/dom_storage_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // which is backed by disk. 163 // which is backed by disk.
164 // TODO(marja): Purge sessionStorage, too. (Requires changes to the FastClear 164 // TODO(marja): Purge sessionStorage, too. (Requires changes to the FastClear
165 // functionality.) 165 // functionality.)
166 StorageNamespaceMap::iterator found = 166 StorageNamespaceMap::iterator found =
167 namespaces_.find(kLocalStorageNamespaceId); 167 namespaces_.find(kLocalStorageNamespaceId);
168 if (found != namespaces_.end()) 168 if (found != namespaces_.end())
169 found->second->PurgeMemory(); 169 found->second->PurgeMemory();
170 } 170 }
171 171
172 void DomStorageContext::Shutdown() { 172 void DomStorageContext::Shutdown() {
173 LOG(ERROR) << "DomStorageContext::Shutdown";
173 is_shutdown_ = true; 174 is_shutdown_ = true;
174 StorageNamespaceMap::const_iterator it = namespaces_.begin(); 175 StorageNamespaceMap::const_iterator it = namespaces_.begin();
175 for (; it != namespaces_.end(); ++it) 176 for (; it != namespaces_.end(); ++it)
176 it->second->Shutdown(); 177 it->second->Shutdown();
177 178
178 if (localstorage_directory_.empty() && !session_storage_database_.get()) 179 if (localstorage_directory_.empty() && !session_storage_database_.get()) {
180 LOG(ERROR) << "No databases";
179 return; 181 return;
182 }
180 183
181 // Respect the content policy settings about what to 184 // Respect the content policy settings about what to
182 // keep and what to discard. 185 // keep and what to discard.
183 if (force_keep_session_state_) 186 if (force_keep_session_state_) {
187 LOG(ERROR) << "Saving the session state";
184 return; // Keep everything. 188 return; // Keep everything.
189 }
185 190
186 bool has_session_only_origins = 191 bool has_session_only_origins =
187 special_storage_policy_.get() && 192 special_storage_policy_.get() &&
188 special_storage_policy_->HasSessionOnlyOrigins(); 193 special_storage_policy_->HasSessionOnlyOrigins();
189 194
190 if (has_session_only_origins) { 195 if (has_session_only_origins) {
196 LOG(ERROR) << "There is session only data to clear";
191 // We may have to delete something. We continue on the 197 // We may have to delete something. We continue on the
192 // commit sequence after area shutdown tasks have cycled 198 // commit sequence after area shutdown tasks have cycled
193 // thru that sequence (and closed their database files). 199 // thru that sequence (and closed their database files).
194 bool success = task_runner_->PostShutdownBlockingTask( 200 bool success = task_runner_->PostShutdownBlockingTask(
195 FROM_HERE, 201 FROM_HERE,
196 DomStorageTaskRunner::COMMIT_SEQUENCE, 202 DomStorageTaskRunner::COMMIT_SEQUENCE,
197 base::Bind(&DomStorageContext::ClearSessionOnlyOrigins, this)); 203 base::Bind(&DomStorageContext::ClearSessionOnlyOrigins, this));
198 DCHECK(success); 204 DCHECK(success);
199 } 205 }
200 } 206 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 CreateSessionNamespace(new_id, new_persistent_id); 305 CreateSessionNamespace(new_id, new_persistent_id);
300 } 306 }
301 307
302 void DomStorageContext::ClearSessionOnlyOrigins() { 308 void DomStorageContext::ClearSessionOnlyOrigins() {
303 if (!localstorage_directory_.empty()) { 309 if (!localstorage_directory_.empty()) {
304 std::vector<LocalStorageUsageInfo> infos; 310 std::vector<LocalStorageUsageInfo> infos;
305 const bool kDontIncludeFileInfo = false; 311 const bool kDontIncludeFileInfo = false;
306 GetLocalStorageUsage(&infos, kDontIncludeFileInfo); 312 GetLocalStorageUsage(&infos, kDontIncludeFileInfo);
307 for (size_t i = 0; i < infos.size(); ++i) { 313 for (size_t i = 0; i < infos.size(); ++i) {
308 const GURL& origin = infos[i].origin; 314 const GURL& origin = infos[i].origin;
309 if (special_storage_policy_->IsStorageProtected(origin)) 315 LOG(ERROR) << "Data for origin " << origin;
316 if (special_storage_policy_->IsStorageProtected(origin)) {
317 LOG(ERROR) << "Was protected";
310 continue; 318 continue;
311 if (!special_storage_policy_->IsStorageSessionOnly(origin)) 319 }
320 if (!special_storage_policy_->IsStorageSessionOnly(origin)) {
321 LOG(ERROR) << "Not session only";
312 continue; 322 continue;
323 }
313 324
325 LOG(ERROR) << "Clearing it";
314 const bool kNotRecursive = false; 326 const bool kNotRecursive = false;
315 FilePath database_file_path = localstorage_directory_.Append( 327 FilePath database_file_path = localstorage_directory_.Append(
316 DomStorageArea::DatabaseFileNameFromOrigin(origin)); 328 DomStorageArea::DatabaseFileNameFromOrigin(origin));
317 file_util::Delete(database_file_path, kNotRecursive); 329 file_util::Delete(database_file_path, kNotRecursive);
318 file_util::Delete( 330 file_util::Delete(
319 DomStorageDatabase::GetJournalFilePath(database_file_path), 331 DomStorageDatabase::GetJournalFilePath(database_file_path),
320 kNotRecursive); 332 kNotRecursive);
321 } 333 }
322 } 334 }
323 if (session_storage_database_.get()) { 335 if (session_storage_database_.get()) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 if (!deletable_persistent_namespace_ids_.empty()) { 426 if (!deletable_persistent_namespace_ids_.empty()) {
415 task_runner_->PostDelayedTask( 427 task_runner_->PostDelayedTask(
416 FROM_HERE, base::Bind( 428 FROM_HERE, base::Bind(
417 &DomStorageContext::DeleteNextUnusedNamespace, 429 &DomStorageContext::DeleteNextUnusedNamespace,
418 this), 430 this),
419 base::TimeDelta::FromSeconds(kSessionStoraceScavengingSeconds)); 431 base::TimeDelta::FromSeconds(kSessionStoraceScavengingSeconds));
420 } 432 }
421 } 433 }
422 434
423 } // namespace dom_storage 435 } // namespace dom_storage
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698