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 <stdint.h> |
| 8 |
7 #include <utility> | 9 #include <utility> |
8 #include <vector> | 10 #include <vector> |
9 | 11 |
10 #include "base/logging.h" | 12 #include "base/logging.h" |
11 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
12 #include "base/time/time.h" | 14 #include "base/time/time.h" |
13 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 15 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
14 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 16 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
15 #include "content/browser/indexed_db/indexed_db_database_error.h" | 17 #include "content/browser/indexed_db/indexed_db_database_error.h" |
16 #include "content/browser/indexed_db/indexed_db_tracing.h" | 18 #include "content/browser/indexed_db/indexed_db_tracing.h" |
17 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" | 19 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" |
18 #include "storage/common/database/database_identifier.h" | 20 #include "storage/common/database/database_identifier.h" |
19 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseExc
eption.h" | 21 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseExc
eption.h" |
20 #include "third_party/leveldatabase/env_chromium.h" | 22 #include "third_party/leveldatabase/env_chromium.h" |
21 | 23 |
22 using base::ASCIIToUTF16; | 24 using base::ASCIIToUTF16; |
23 | 25 |
24 namespace content { | 26 namespace content { |
25 | 27 |
26 const int64 kBackingStoreGracePeriodMs = 2000; | 28 const int64_t kBackingStoreGracePeriodMs = 2000; |
27 | 29 |
28 IndexedDBFactoryImpl::IndexedDBFactoryImpl(IndexedDBContextImpl* context) | 30 IndexedDBFactoryImpl::IndexedDBFactoryImpl(IndexedDBContextImpl* context) |
29 : context_(context) { | 31 : context_(context) { |
30 } | 32 } |
31 | 33 |
32 IndexedDBFactoryImpl::~IndexedDBFactoryImpl() { | 34 IndexedDBFactoryImpl::~IndexedDBFactoryImpl() { |
33 } | 35 } |
34 | 36 |
35 void IndexedDBFactoryImpl::RemoveDatabaseFromMaps( | 37 void IndexedDBFactoryImpl::RemoveDatabaseFromMaps( |
36 const IndexedDBDatabase::Identifier& identifier) { | 38 const IndexedDBDatabase::Identifier& identifier) { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, | 265 IndexedDBDatabaseError error(blink::WebIDBDatabaseExceptionUnknownError, |
264 "Internal error opening backing store for " | 266 "Internal error opening backing store for " |
265 "indexedDB.deleteDatabase."); | 267 "indexedDB.deleteDatabase."); |
266 callbacks->OnError(error); | 268 callbacks->OnError(error); |
267 backing_store = NULL; | 269 backing_store = NULL; |
268 if (s.IsCorruption()) | 270 if (s.IsCorruption()) |
269 HandleBackingStoreCorruption(origin_url, error); | 271 HandleBackingStoreCorruption(origin_url, error); |
270 return; | 272 return; |
271 } | 273 } |
272 if (!ContainsValue(names, name)) { | 274 if (!ContainsValue(names, name)) { |
273 const int64 version = 0; | 275 const int64_t version = 0; |
274 callbacks->OnSuccess(version); | 276 callbacks->OnSuccess(version); |
275 backing_store = NULL; | 277 backing_store = NULL; |
276 ReleaseBackingStore(origin_url, false /* immediate */); | 278 ReleaseBackingStore(origin_url, false /* immediate */); |
277 return; | 279 return; |
278 } | 280 } |
279 | 281 |
280 scoped_refptr<IndexedDBDatabase> database = IndexedDBDatabase::Create( | 282 scoped_refptr<IndexedDBDatabase> database = IndexedDBDatabase::Create( |
281 name, backing_store.get(), this, unique_identifier, &s); | 283 name, backing_store.get(), this, unique_identifier, &s); |
282 if (!database.get()) { | 284 if (!database.get()) { |
283 IndexedDBDatabaseError error( | 285 IndexedDBDatabaseError error( |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 size_t count(0); | 516 size_t count(0); |
515 | 517 |
516 OriginDBs range = GetOpenDatabasesForOrigin(origin_url); | 518 OriginDBs range = GetOpenDatabasesForOrigin(origin_url); |
517 for (OriginDBMapIterator it = range.first; it != range.second; ++it) | 519 for (OriginDBMapIterator it = range.first; it != range.second; ++it) |
518 count += it->second->ConnectionCount(); | 520 count += it->second->ConnectionCount(); |
519 | 521 |
520 return count; | 522 return count; |
521 } | 523 } |
522 | 524 |
523 } // namespace content | 525 } // namespace content |
OLD | NEW |