| 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_internals_ui.h" | 5 #include "content/browser/indexed_db/indexed_db_internals_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 BrowserContext::StoragePartitionCallback cb = | 97 BrowserContext::StoragePartitionCallback cb = |
| 98 base::Bind(&IndexedDBInternalsUI::AddContextFromStoragePartition, | 98 base::Bind(&IndexedDBInternalsUI::AddContextFromStoragePartition, |
| 99 base::Unretained(this)); | 99 base::Unretained(this)); |
| 100 BrowserContext::ForEachStoragePartition(browser_context, cb); | 100 BrowserContext::ForEachStoragePartition(browser_context, cb); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void IndexedDBInternalsUI::GetAllOriginsOnIndexedDBThread( | 103 void IndexedDBInternalsUI::GetAllOriginsOnIndexedDBThread( |
| 104 scoped_refptr<IndexedDBContext> context, | 104 scoped_refptr<IndexedDBContext> context, |
| 105 const base::FilePath& context_path) { | 105 const base::FilePath& context_path) { |
| 106 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); | 106 DCHECK(context->TaskRunner()->RunsTasksInCurrentSequence()); |
| 107 | 107 |
| 108 IndexedDBContextImpl* context_impl = | 108 IndexedDBContextImpl* context_impl = |
| 109 static_cast<IndexedDBContextImpl*>(context.get()); | 109 static_cast<IndexedDBContextImpl*>(context.get()); |
| 110 | 110 |
| 111 std::unique_ptr<base::ListValue> info_list( | 111 std::unique_ptr<base::ListValue> info_list( |
| 112 context_impl->GetAllOriginsDetails()); | 112 context_impl->GetAllOriginsDetails()); |
| 113 bool is_incognito = context_impl->is_incognito(); | 113 bool is_incognito = context_impl->is_incognito(); |
| 114 | 114 |
| 115 BrowserThread::PostTask( | 115 BrowserThread::PostTask( |
| 116 BrowserThread::UI, | 116 BrowserThread::UI, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 context->TaskRunner()->PostTask( | 206 context->TaskRunner()->PostTask( |
| 207 FROM_HERE, | 207 FROM_HERE, |
| 208 base::Bind(&IndexedDBInternalsUI::ForceCloseOriginOnIndexedDBThread, | 208 base::Bind(&IndexedDBInternalsUI::ForceCloseOriginOnIndexedDBThread, |
| 209 base::Unretained(this), partition_path, context, origin)); | 209 base::Unretained(this), partition_path, context, origin)); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void IndexedDBInternalsUI::DownloadOriginDataOnIndexedDBThread( | 212 void IndexedDBInternalsUI::DownloadOriginDataOnIndexedDBThread( |
| 213 const base::FilePath& partition_path, | 213 const base::FilePath& partition_path, |
| 214 const scoped_refptr<IndexedDBContextImpl> context, | 214 const scoped_refptr<IndexedDBContextImpl> context, |
| 215 const Origin& origin) { | 215 const Origin& origin) { |
| 216 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); | 216 DCHECK(context->TaskRunner()->RunsTasksInCurrentSequence()); |
| 217 // This runs on the IndexedDB task runner to prevent script from reopening | 217 // This runs on the IndexedDB task runner to prevent script from reopening |
| 218 // the origin while we are zipping. | 218 // the origin while we are zipping. |
| 219 | 219 |
| 220 // Make sure the database hasn't been deleted since the page was loaded. | 220 // Make sure the database hasn't been deleted since the page was loaded. |
| 221 if (!context->HasOrigin(origin)) | 221 if (!context->HasOrigin(origin)) |
| 222 return; | 222 return; |
| 223 | 223 |
| 224 context->ForceClose(origin, IndexedDBContextImpl::FORCE_CLOSE_INTERNALS_PAGE); | 224 context->ForceClose(origin, IndexedDBContextImpl::FORCE_CLOSE_INTERNALS_PAGE); |
| 225 size_t connection_count = context->GetConnectionCount(origin); | 225 size_t connection_count = context->GetConnectionCount(origin); |
| 226 | 226 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 244 BrowserThread::UI, FROM_HERE, | 244 BrowserThread::UI, FROM_HERE, |
| 245 base::Bind(&IndexedDBInternalsUI::OnDownloadDataReady, | 245 base::Bind(&IndexedDBInternalsUI::OnDownloadDataReady, |
| 246 base::Unretained(this), partition_path, origin, temp_path, | 246 base::Unretained(this), partition_path, origin, temp_path, |
| 247 zip_path, connection_count)); | 247 zip_path, connection_count)); |
| 248 } | 248 } |
| 249 | 249 |
| 250 void IndexedDBInternalsUI::ForceCloseOriginOnIndexedDBThread( | 250 void IndexedDBInternalsUI::ForceCloseOriginOnIndexedDBThread( |
| 251 const base::FilePath& partition_path, | 251 const base::FilePath& partition_path, |
| 252 const scoped_refptr<IndexedDBContextImpl> context, | 252 const scoped_refptr<IndexedDBContextImpl> context, |
| 253 const Origin& origin) { | 253 const Origin& origin) { |
| 254 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); | 254 DCHECK(context->TaskRunner()->RunsTasksInCurrentSequence()); |
| 255 | 255 |
| 256 // Make sure the database hasn't been deleted since the page was loaded. | 256 // Make sure the database hasn't been deleted since the page was loaded. |
| 257 if (!context->HasOrigin(origin)) | 257 if (!context->HasOrigin(origin)) |
| 258 return; | 258 return; |
| 259 | 259 |
| 260 context->ForceClose(origin, IndexedDBContextImpl::FORCE_CLOSE_INTERNALS_PAGE); | 260 context->ForceClose(origin, IndexedDBContextImpl::FORCE_CLOSE_INTERNALS_PAGE); |
| 261 size_t connection_count = context->GetConnectionCount(origin); | 261 size_t connection_count = context->GetConnectionCount(origin); |
| 262 | 262 |
| 263 BrowserThread::PostTask( | 263 BrowserThread::PostTask( |
| 264 BrowserThread::UI, FROM_HERE, | 264 BrowserThread::UI, FROM_HERE, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 357 } |
| 358 | 358 |
| 359 item->AddObserver(new FileDeleter(temp_path)); | 359 item->AddObserver(new FileDeleter(temp_path)); |
| 360 web_ui()->CallJavascriptFunctionUnsafe( | 360 web_ui()->CallJavascriptFunctionUnsafe( |
| 361 "indexeddb.onOriginDownloadReady", base::Value(partition_path.value()), | 361 "indexeddb.onOriginDownloadReady", base::Value(partition_path.value()), |
| 362 base::Value(origin.Serialize()), | 362 base::Value(origin.Serialize()), |
| 363 base::Value(static_cast<double>(connection_count))); | 363 base::Value(static_cast<double>(connection_count))); |
| 364 } | 364 } |
| 365 | 365 |
| 366 } // namespace content | 366 } // namespace content |
| OLD | NEW |