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

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

Issue 93873017: IndexedDBFactory now ForceCloses databases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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
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.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
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);
94 std::vector<IndexedDBDatabase*>::iterator i;
95 for (i = dbs.begin(); i != dbs.end(); ++i) {
jsbell 2013/12/19 22:35:34 Nit: no need for braces with single-line loop body
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698