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

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

Issue 1071553002: Optimizes the operation of DeleteDatabase when no backing store exists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Optimizes the operation of DeleteDatabase when no backing store exists. Created 5 years, 8 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
« no previous file with comments | « content/browser/indexed_db/indexed_db_browsertest.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) 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_factory_impl.h" 5 #include "content/browser/indexed_db/indexed_db_factory_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 ASCIIToUTF16( 250 ASCIIToUTF16(
251 "Internal error opening backing store " 251 "Internal error opening backing store "
252 "for indexedDB.deleteDatabase.")); 252 "for indexedDB.deleteDatabase."));
253 callbacks->OnError(error); 253 callbacks->OnError(error);
254 if (s.IsCorruption()) { 254 if (s.IsCorruption()) {
255 HandleBackingStoreCorruption(origin_url, error); 255 HandleBackingStoreCorruption(origin_url, error);
256 } 256 }
257 return; 257 return;
258 } 258 }
259 259
260 std::vector<base::string16> names = backing_store->GetDatabaseNames(&s);
261 if (!s.ok()) {
262 DLOG(ERROR) << "Internal error getting database names";
263 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError,
264 "Internal error opening backing store for "
265 "indexedDB.webkitGetDatabaseNames.");
jsbell 2015/04/13 16:32:39 This should be "indexedDB.deleteDatabase"
266 callbacks->OnError(error);
267 backing_store = NULL;
268 if (s.IsCorruption())
269 HandleBackingStoreCorruption(origin_url, error);
270 return;
271 }
272 if(std::find(names.begin(), names.end(), name) == names.end())
jsbell 2015/04/13 16:32:39 #include "base/stl_util.h" and use: base::Contain
jsbell 2015/04/13 16:32:40 Space between if and ( please use `git cl format`
273 {
jsbell 2015/04/13 16:32:40 { should be on same line as if please use `git cl
274 int64 version = 0;
jsbell 2015/04/13 16:32:40 Make this const
275 callbacks->OnSuccess(version);
276 backing_store = NULL;
277 ReleaseBackingStore(origin_url, false );
jsbell 2015/04/13 16:32:39 Please document the use of false here (e.g. /* imm
jsbell 2015/04/13 16:32:39 No space before ) please use `git cl format` befo
278 return;
279 }
280
260 scoped_refptr<IndexedDBDatabase> database = IndexedDBDatabase::Create( 281 scoped_refptr<IndexedDBDatabase> database = IndexedDBDatabase::Create(
261 name, backing_store.get(), this, unique_identifier, &s); 282 name, backing_store.get(), this, unique_identifier, &s);
262 if (!database.get()) { 283 if (!database.get()) {
263 IndexedDBDatabaseError error( 284 IndexedDBDatabaseError error(
264 blink::WebIDBDatabaseExceptionUnknownError, 285 blink::WebIDBDatabaseExceptionUnknownError,
265 ASCIIToUTF16( 286 ASCIIToUTF16(
266 "Internal error creating database backend for " 287 "Internal error creating database backend for "
267 "indexedDB.deleteDatabase.")); 288 "indexedDB.deleteDatabase."));
268 callbacks->OnError(error); 289 callbacks->OnError(error);
269 if (s.IsCorruption()) { 290 if (s.IsCorruption()) {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 size_t count(0); 515 size_t count(0);
495 516
496 OriginDBs range = GetOpenDatabasesForOrigin(origin_url); 517 OriginDBs range = GetOpenDatabasesForOrigin(origin_url);
497 for (OriginDBMapIterator it = range.first; it != range.second; ++it) 518 for (OriginDBMapIterator it = range.first; it != range.second; ++it)
498 count += it->second->ConnectionCount(); 519 count += it->second->ConnectionCount();
499 520
500 return count; 521 return count;
501 } 522 }
502 523
503 } // namespace content 524 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698