| 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 "content/browser/indexed_db/indexed_db_dispatcher_host.h" | 5 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/guid.h" | 9 #include "base/guid.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 230 |
| 231 void IndexedDBDispatcherHost::InvalidateWeakPtrsAndClearBindings() { | 231 void IndexedDBDispatcherHost::InvalidateWeakPtrsAndClearBindings() { |
| 232 weak_factory_.InvalidateWeakPtrs(); | 232 weak_factory_.InvalidateWeakPtrs(); |
| 233 cursor_bindings_.CloseAllBindings(); | 233 cursor_bindings_.CloseAllBindings(); |
| 234 database_bindings_.CloseAllBindings(); | 234 database_bindings_.CloseAllBindings(); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void IndexedDBDispatcherHost::IDBThreadHelper::GetDatabaseNamesOnIDBThread( | 237 void IndexedDBDispatcherHost::IDBThreadHelper::GetDatabaseNamesOnIDBThread( |
| 238 scoped_refptr<IndexedDBCallbacks> callbacks, | 238 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 239 const url::Origin& origin) { | 239 const url::Origin& origin) { |
| 240 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 240 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksInCurrentSequence()); |
| 241 | 241 |
| 242 base::FilePath indexed_db_path = indexed_db_context_->data_path(); | 242 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
| 243 indexed_db_context_->GetIDBFactory()->GetDatabaseNames( | 243 indexed_db_context_->GetIDBFactory()->GetDatabaseNames( |
| 244 callbacks, origin, indexed_db_path, request_context_getter_); | 244 callbacks, origin, indexed_db_path, request_context_getter_); |
| 245 } | 245 } |
| 246 | 246 |
| 247 void IndexedDBDispatcherHost::IDBThreadHelper::OpenOnIDBThread( | 247 void IndexedDBDispatcherHost::IDBThreadHelper::OpenOnIDBThread( |
| 248 scoped_refptr<IndexedDBCallbacks> callbacks, | 248 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 249 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, | 249 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, |
| 250 const url::Origin& origin, | 250 const url::Origin& origin, |
| 251 const base::string16& name, | 251 const base::string16& name, |
| 252 int64_t version, | 252 int64_t version, |
| 253 int64_t transaction_id) { | 253 int64_t transaction_id) { |
| 254 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 254 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksInCurrentSequence()); |
| 255 | 255 |
| 256 base::TimeTicks begin_time = base::TimeTicks::Now(); | 256 base::TimeTicks begin_time = base::TimeTicks::Now(); |
| 257 base::FilePath indexed_db_path = indexed_db_context_->data_path(); | 257 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
| 258 | 258 |
| 259 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore | 259 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore |
| 260 // created) if this origin is already over quota. | 260 // created) if this origin is already over quota. |
| 261 callbacks->SetConnectionOpenStartTime(begin_time); | 261 callbacks->SetConnectionOpenStartTime(begin_time); |
| 262 std::unique_ptr<IndexedDBPendingConnection> connection = | 262 std::unique_ptr<IndexedDBPendingConnection> connection = |
| 263 base::MakeUnique<IndexedDBPendingConnection>( | 263 base::MakeUnique<IndexedDBPendingConnection>( |
| 264 callbacks, database_callbacks, ipc_process_id_, transaction_id, | 264 callbacks, database_callbacks, ipc_process_id_, transaction_id, |
| 265 version); | 265 version); |
| 266 DCHECK(request_context_getter_); | 266 DCHECK(request_context_getter_); |
| 267 indexed_db_context_->GetIDBFactory()->Open(name, std::move(connection), | 267 indexed_db_context_->GetIDBFactory()->Open(name, std::move(connection), |
| 268 request_context_getter_, origin, | 268 request_context_getter_, origin, |
| 269 indexed_db_path); | 269 indexed_db_path); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void IndexedDBDispatcherHost::IDBThreadHelper::DeleteDatabaseOnIDBThread( | 272 void IndexedDBDispatcherHost::IDBThreadHelper::DeleteDatabaseOnIDBThread( |
| 273 scoped_refptr<IndexedDBCallbacks> callbacks, | 273 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 274 const url::Origin& origin, | 274 const url::Origin& origin, |
| 275 const base::string16& name, | 275 const base::string16& name, |
| 276 bool force_close) { | 276 bool force_close) { |
| 277 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 277 DCHECK(indexed_db_context_->TaskRunner()->RunsTasksInCurrentSequence()); |
| 278 | 278 |
| 279 base::FilePath indexed_db_path = indexed_db_context_->data_path(); | 279 base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
| 280 DCHECK(request_context_getter_); | 280 DCHECK(request_context_getter_); |
| 281 indexed_db_context_->GetIDBFactory()->DeleteDatabase( | 281 indexed_db_context_->GetIDBFactory()->DeleteDatabase( |
| 282 name, request_context_getter_, callbacks, origin, indexed_db_path, | 282 name, request_context_getter_, callbacks, origin, indexed_db_path, |
| 283 force_close); | 283 force_close); |
| 284 } | 284 } |
| 285 | 285 |
| 286 } // namespace content | 286 } // namespace content |
| OLD | NEW |