OLD | NEW |
---|---|
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 Loading... | |
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."); | |
266 callbacks->OnError(error); | |
267 backing_store = NULL; | |
268 if (s.IsCorruption()) | |
269 HandleBackingStoreCorruption(origin_url, error); | |
270 return; | |
271 } | |
272 std::vector<base::string16>::iterator findItr = | |
273 std::find(names.begin(), names.end(), name); | |
274 if(findItr == names.end()) | |
cmumford
2015/04/10 14:58:15
You aren't using findIter so just use:
if (std::f
| |
275 { | |
276 backing_store = NULL; | |
277 ReleaseBackingStore(origin_url, false /* immediate */); | |
278 callbacks->OnSuccess(); | |
279 return; | |
280 } | |
281 | |
260 scoped_refptr<IndexedDBDatabase> database = IndexedDBDatabase::Create( | 282 scoped_refptr<IndexedDBDatabase> database = IndexedDBDatabase::Create( |
261 name, backing_store.get(), this, unique_identifier, &s); | 283 name, backing_store.get(), this, unique_identifier, &s); |
262 if (!database.get()) { | 284 if (!database.get()) { |
263 IndexedDBDatabaseError error( | 285 IndexedDBDatabaseError error( |
264 blink::WebIDBDatabaseExceptionUnknownError, | 286 blink::WebIDBDatabaseExceptionUnknownError, |
265 ASCIIToUTF16( | 287 ASCIIToUTF16( |
266 "Internal error creating database backend for " | 288 "Internal error creating database backend for " |
267 "indexedDB.deleteDatabase.")); | 289 "indexedDB.deleteDatabase.")); |
268 callbacks->OnError(error); | 290 callbacks->OnError(error); |
269 if (s.IsCorruption()) { | 291 if (s.IsCorruption()) { |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
494 size_t count(0); | 516 size_t count(0); |
495 | 517 |
496 OriginDBs range = GetOpenDatabasesForOrigin(origin_url); | 518 OriginDBs range = GetOpenDatabasesForOrigin(origin_url); |
497 for (OriginDBMapIterator it = range.first; it != range.second; ++it) | 519 for (OriginDBMapIterator it = range.first; it != range.second; ++it) |
498 count += it->second->ConnectionCount(); | 520 count += it->second->ConnectionCount(); |
499 | 521 |
500 return count; | 522 return count; |
501 } | 523 } |
502 | 524 |
503 } // namespace content | 525 } // namespace content |
OLD | NEW |