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

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

Issue 93873017: IndexedDBFactory now ForceCloses databases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed {} and ran git cl format. 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_context_impl.h" 5 #include "content/browser/indexed_db/indexed_db_context_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 origin_size_map_.erase(origin_url); 328 origin_size_map_.erase(origin_url);
329 space_available_map_.erase(origin_url); 329 space_available_map_.erase(origin_url);
330 } 330 }
331 } 331 }
332 332
333 void IndexedDBContextImpl::ForceClose(const GURL origin_url) { 333 void IndexedDBContextImpl::ForceClose(const GURL origin_url) {
334 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); 334 DCHECK(TaskRunner()->RunsTasksOnCurrentThread());
335 if (data_path_.empty() || !IsInOriginSet(origin_url)) 335 if (data_path_.empty() || !IsInOriginSet(origin_url))
336 return; 336 return;
337 337
338 if (connections_.find(origin_url) != connections_.end()) {
339 ConnectionSet& connections = connections_[origin_url];
340 ConnectionSet::iterator it = connections.begin();
341 while (it != connections.end()) {
342 // Remove before closing so callbacks don't double-erase
343 IndexedDBConnection* connection = *it;
344 DCHECK(connection->IsConnected());
345 connections.erase(it++);
346 connection->ForceClose();
347 }
348 DCHECK_EQ(connections_[origin_url].size(), 0UL);
jsbell 2013/12/20 00:24:42 Maybe replace this with DCHECK_EQ(0UL, GetConnecti
cmumford 2013/12/20 18:09:26 You mean to take that DCHECK_EQ and move it to aft
jsbell 2013/12/20 18:22:56 Yep, that's what I was thinking.
349 connections_.erase(origin_url);
350 }
351 if (factory_) 338 if (factory_)
352 factory_->ForceClose(origin_url); 339 factory_->ForceClose(origin_url);
353 } 340 }
354 341
355 size_t IndexedDBContextImpl::GetConnectionCount(const GURL& origin_url) { 342 size_t IndexedDBContextImpl::GetConnectionCount(const GURL& origin_url) {
356 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); 343 DCHECK(TaskRunner()->RunsTasksOnCurrentThread());
357 if (data_path_.empty() || !IsInOriginSet(origin_url)) 344 if (data_path_.empty() || !IsInOriginSet(origin_url))
358 return 0; 345 return 0;
359 346
360 if (connections_.find(origin_url) == connections_.end()) 347 if (connections_.find(origin_url) == connections_.end())
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 origin_set_.reset(); 568 origin_set_.reset();
582 origin_size_map_.clear(); 569 origin_size_map_.clear();
583 space_available_map_.clear(); 570 space_available_map_.clear();
584 } 571 }
585 572
586 base::TaskRunner* IndexedDBContextImpl::TaskRunner() const { 573 base::TaskRunner* IndexedDBContextImpl::TaskRunner() const {
587 return task_runner_; 574 return task_runner_;
588 } 575 }
589 576
590 } // namespace content 577 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/indexed_db/indexed_db_database.h » ('j') | content/browser/indexed_db/indexed_db_database.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698