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.h" | 5 #include "content/browser/indexed_db/indexed_db_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 10 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 // Scope so that the implicit scoped_refptr<> is freed. | 83 // Scope so that the implicit scoped_refptr<> is freed. |
84 IndexedDBBackingStoreMap::const_iterator it = | 84 IndexedDBBackingStoreMap::const_iterator it = |
85 backing_store_map_.find(origin_url); | 85 backing_store_map_.find(origin_url); |
86 DCHECK(it != backing_store_map_.end()); | 86 DCHECK(it != backing_store_map_.end()); |
87 ptr = it->second.get(); | 87 ptr = it->second.get(); |
88 } | 88 } |
89 return ptr->HasOneRef(); | 89 return ptr->HasOneRef(); |
90 } | 90 } |
91 | 91 |
92 void IndexedDBFactory::ForceClose(const GURL& origin_url) { | 92 void IndexedDBFactory::ForceClose(const GURL& origin_url) { |
93 std::vector<IndexedDBDatabase*> dbs = GetOpenDatabasesForOrigin(origin_url); | |
jsbell
2013/12/20 00:24:42
GetOpenDatabasesForOrigin is documented in the hea
cmumford
2013/12/20 18:09:26
I've got the multimap code written in another bran
jsbell
2013/12/20 18:22:56
You're probably right that our numbers are typical
| |
94 std::vector<IndexedDBDatabase*>::iterator i; | |
jsbell
2013/12/20 00:24:42
Nit: change i to it or iter
cmumford
2013/12/20 18:09:26
Done.
| |
95 for (i = dbs.begin(); i != dbs.end(); ++i) { | |
jsbell
2013/12/20 00:24:42
Nit: No need for braces. The iterator initializati
cmumford
2013/12/20 18:09:26
Done.
| |
96 (*i)->ForceClose(); | |
97 } | |
98 | |
93 if (backing_store_map_.find(origin_url) != backing_store_map_.end()) | 99 if (backing_store_map_.find(origin_url) != backing_store_map_.end()) |
94 ReleaseBackingStore(origin_url, true /* immediate */); | 100 ReleaseBackingStore(origin_url, true /* immediate */); |
95 } | 101 } |
96 | 102 |
97 void IndexedDBFactory::ContextDestroyed() { | 103 void IndexedDBFactory::ContextDestroyed() { |
98 // Timers on backing stores hold a reference to this factory. When the | 104 // Timers on backing stores hold a reference to this factory. When the |
99 // context (which nominally owns this factory) is destroyed during thread | 105 // context (which nominally owns this factory) is destroyed during thread |
100 // termination the timers must be stopped so that this factory and the | 106 // termination the timers must be stopped so that this factory and the |
101 // stores can be disposed of. | 107 // stores can be disposed of. |
102 for (IndexedDBBackingStoreMap::iterator it = backing_store_map_.begin(); | 108 for (IndexedDBBackingStoreMap::iterator it = backing_store_map_.begin(); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
333 for (IndexedDBDatabaseMap::const_iterator it = database_map_.begin(); | 339 for (IndexedDBDatabaseMap::const_iterator it = database_map_.begin(); |
334 it != database_map_.end(); | 340 it != database_map_.end(); |
335 ++it) { | 341 ++it) { |
336 if (it->first.first == origin_url) | 342 if (it->first.first == origin_url) |
337 result.push_back(it->second); | 343 result.push_back(it->second); |
338 } | 344 } |
339 return result; | 345 return result; |
340 } | 346 } |
341 | 347 |
342 } // namespace content | 348 } // namespace content |
OLD | NEW |