| OLD | NEW |
| 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 "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" | 5 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" |
| 6 | 6 |
| 7 #include <tuple> | 7 #include <tuple> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 41 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 42 indexed_db_context_->TaskRunner()->PostTask( | 42 indexed_db_context_->TaskRunner()->PostTask( |
| 43 FROM_HERE, | 43 FROM_HERE, |
| 44 base::BindOnce( | 44 base::BindOnce( |
| 45 &BrowsingDataIndexedDBHelper::DeleteIndexedDBInIndexedDBThread, this, | 45 &BrowsingDataIndexedDBHelper::DeleteIndexedDBInIndexedDBThread, this, |
| 46 origin)); | 46 origin)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void BrowsingDataIndexedDBHelper::FetchIndexedDBInfoInIndexedDBThread( | 49 void BrowsingDataIndexedDBHelper::FetchIndexedDBInfoInIndexedDBThread( |
| 50 const FetchCallback& callback) { | 50 const FetchCallback& callback) { |
| 51 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 51 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksInCurrentSequence()); |
| 52 DCHECK(!callback.is_null()); | 52 DCHECK(!callback.is_null()); |
| 53 std::vector<IndexedDBInfo> origins = indexed_db_context_->GetAllOriginsInfo(); | 53 std::vector<IndexedDBInfo> origins = indexed_db_context_->GetAllOriginsInfo(); |
| 54 std::list<content::IndexedDBInfo> result; | 54 std::list<content::IndexedDBInfo> result; |
| 55 for (const IndexedDBInfo& origin : origins) { | 55 for (const IndexedDBInfo& origin : origins) { |
| 56 if (!BrowsingDataHelper::HasWebScheme(origin.origin)) | 56 if (!BrowsingDataHelper::HasWebScheme(origin.origin)) |
| 57 continue; // Non-websafe state is not considered browsing data. | 57 continue; // Non-websafe state is not considered browsing data. |
| 58 result.push_back(origin); | 58 result.push_back(origin); |
| 59 } | 59 } |
| 60 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 60 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 61 base::BindOnce(callback, result)); | 61 base::BindOnce(callback, result)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void BrowsingDataIndexedDBHelper::DeleteIndexedDBInIndexedDBThread( | 64 void BrowsingDataIndexedDBHelper::DeleteIndexedDBInIndexedDBThread( |
| 65 const GURL& origin) { | 65 const GURL& origin) { |
| 66 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 66 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksInCurrentSequence()); |
| 67 indexed_db_context_->DeleteForOrigin(origin); | 67 indexed_db_context_->DeleteForOrigin(origin); |
| 68 } | 68 } |
| 69 | 69 |
| 70 CannedBrowsingDataIndexedDBHelper:: | 70 CannedBrowsingDataIndexedDBHelper:: |
| 71 PendingIndexedDBInfo::PendingIndexedDBInfo(const GURL& origin, | 71 PendingIndexedDBInfo::PendingIndexedDBInfo(const GURL& origin, |
| 72 const base::string16& name) | 72 const base::string16& name) |
| 73 : origin(origin), | 73 : origin(origin), |
| 74 name(name) { | 74 name(name) { |
| 75 } | 75 } |
| 76 | 76 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 for (std::set<PendingIndexedDBInfo>::iterator it = | 135 for (std::set<PendingIndexedDBInfo>::iterator it = |
| 136 pending_indexed_db_info_.begin(); | 136 pending_indexed_db_info_.begin(); |
| 137 it != pending_indexed_db_info_.end(); ) { | 137 it != pending_indexed_db_info_.end(); ) { |
| 138 if (it->origin == origin) | 138 if (it->origin == origin) |
| 139 pending_indexed_db_info_.erase(it++); | 139 pending_indexed_db_info_.erase(it++); |
| 140 else | 140 else |
| 141 ++it; | 141 ++it; |
| 142 } | 142 } |
| 143 BrowsingDataIndexedDBHelper::DeleteIndexedDB(origin); | 143 BrowsingDataIndexedDBHelper::DeleteIndexedDB(origin); |
| 144 } | 144 } |
| OLD | NEW |