OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/location.h" | 6 #include "base/location.h" |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/task_runner.h" | 8 #include "base/task_runner.h" |
9 #include "content/browser/indexed_db/indexed_db_active_blob_registry.h" | 9 #include "content/browser/indexed_db/indexed_db_active_blob_registry.h" |
10 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 10 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
11 #include "content/browser/indexed_db/indexed_db_factory.h" | 11 #include "content/browser/indexed_db/indexed_db_factory.h" |
12 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" | 12 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 IndexedDBActiveBlobRegistry::IndexedDBActiveBlobRegistry( | 16 IndexedDBActiveBlobRegistry::IndexedDBActiveBlobRegistry( |
17 IndexedDBBackingStore* backing_store) | 17 IndexedDBBackingStore* backing_store) |
18 : backing_store_(backing_store), weak_factory_(this) {} | 18 : backing_store_(backing_store), weak_factory_(this) {} |
19 | 19 |
20 IndexedDBActiveBlobRegistry::~IndexedDBActiveBlobRegistry() { | 20 IndexedDBActiveBlobRegistry::~IndexedDBActiveBlobRegistry() { |
21 DCHECK(use_tracker_.empty()); | |
22 } | 21 } |
23 | 22 |
24 void IndexedDBActiveBlobRegistry::AddBlobRef(int64 database_id, | 23 void IndexedDBActiveBlobRegistry::AddBlobRef(int64 database_id, |
25 int64 blob_key) { | 24 int64 blob_key) { |
26 DCHECK(backing_store_); | 25 DCHECK(backing_store_); |
27 DCHECK(backing_store_->task_runner()->RunsTasksOnCurrentThread()); | 26 DCHECK(backing_store_->task_runner()->RunsTasksOnCurrentThread()); |
28 DCHECK(KeyPrefix::IsValidDatabaseId(database_id)); | 27 DCHECK(KeyPrefix::IsValidDatabaseId(database_id)); |
29 DCHECK(DatabaseMetaDataKey::IsValidBlobKey(blob_key)); | 28 DCHECK(DatabaseMetaDataKey::IsValidBlobKey(blob_key)); |
30 DCHECK(!ContainsKey(deleted_dbs_, database_id)); | 29 DCHECK(!ContainsKey(deleted_dbs_, database_id)); |
31 bool need_ref = use_tracker_.empty(); | 30 bool need_ref = use_tracker_.empty(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 blob_key); | 138 blob_key); |
140 } | 139 } |
141 | 140 |
142 void IndexedDBActiveBlobRegistry::ForceShutdown() { | 141 void IndexedDBActiveBlobRegistry::ForceShutdown() { |
143 weak_factory_.InvalidateWeakPtrs(); | 142 weak_factory_.InvalidateWeakPtrs(); |
144 use_tracker_.clear(); | 143 use_tracker_.clear(); |
145 backing_store_ = NULL; | 144 backing_store_ = NULL; |
146 } | 145 } |
147 | 146 |
148 } // namespace content | 147 } // namespace content |
OLD | NEW |