Index: content/browser/indexed_db/database_impl.cc |
diff --git a/content/browser/indexed_db/database_impl.cc b/content/browser/indexed_db/database_impl.cc |
index 922feabba842b04e0821e401a99b482e556f8bad..0c2a812c1c0bfa11e0f24eaf4d04f5c23c3eb9f7 100644 |
--- a/content/browser/indexed_db/database_impl.cc |
+++ b/content/browser/indexed_db/database_impl.cc |
@@ -30,7 +30,7 @@ class DatabaseImpl::IDBThreadHelper { |
public: |
IDBThreadHelper(std::unique_ptr<IndexedDBConnection> connection, |
const url::Origin& origin, |
- scoped_refptr<IndexedDBDispatcherHost> dispatcher_host); |
+ scoped_refptr<IndexedDBContextImpl> indexed_db_context); |
~IDBThreadHelper(); |
void CreateObjectStore(int64_t transaction_id, |
@@ -126,21 +126,20 @@ class DatabaseImpl::IDBThreadHelper { |
void AckReceivedBlobs(const std::vector<std::string>& uuids); |
private: |
- scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; |
+ scoped_refptr<IndexedDBContextImpl> indexed_db_context_; |
std::unique_ptr<IndexedDBConnection> connection_; |
const url::Origin origin_; |
base::WeakPtrFactory<IDBThreadHelper> weak_factory_; |
}; |
-DatabaseImpl::DatabaseImpl( |
- std::unique_ptr<IndexedDBConnection> connection, |
- const url::Origin& origin, |
- scoped_refptr<IndexedDBDispatcherHost> dispatcher_host) |
+DatabaseImpl::DatabaseImpl(std::unique_ptr<IndexedDBConnection> connection, |
+ const url::Origin& origin, |
+ IndexedDBDispatcherHost* dispatcher_host) |
: dispatcher_host_(dispatcher_host), |
origin_(origin), |
idb_runner_(base::ThreadTaskRunnerHandle::Get()) { |
helper_ = new IDBThreadHelper(std::move(connection), origin, |
- std::move(dispatcher_host)); |
+ dispatcher_host->context()); |
} |
DatabaseImpl::~DatabaseImpl() { |
@@ -223,7 +222,7 @@ void DatabaseImpl::Get( |
bool key_only, |
::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) { |
scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( |
- dispatcher_host_.get(), origin_, std::move(callbacks_info))); |
+ dispatcher_host_, origin_, std::move(callbacks_info))); |
idb_runner_->PostTask( |
FROM_HERE, base::Bind(&IDBThreadHelper::Get, base::Unretained(helper_), |
transaction_id, object_store_id, index_id, |
@@ -239,7 +238,7 @@ void DatabaseImpl::GetAll( |
int64_t max_count, |
::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) { |
scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( |
- dispatcher_host_.get(), origin_, std::move(callbacks_info))); |
+ dispatcher_host_, origin_, std::move(callbacks_info))); |
idb_runner_->PostTask( |
FROM_HERE, |
base::Bind(&IDBThreadHelper::GetAll, base::Unretained(helper_), |
@@ -292,7 +291,7 @@ void DatabaseImpl::Put( |
} |
scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( |
- dispatcher_host_.get(), origin_, std::move(callbacks_info))); |
+ dispatcher_host_, origin_, std::move(callbacks_info))); |
idb_runner_->PostTask( |
FROM_HERE, |
@@ -332,7 +331,7 @@ void DatabaseImpl::OpenCursor( |
blink::WebIDBTaskType task_type, |
::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) { |
scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( |
- dispatcher_host_.get(), origin_, std::move(callbacks_info))); |
+ dispatcher_host_, origin_, std::move(callbacks_info))); |
idb_runner_->PostTask( |
FROM_HERE, |
base::Bind(&IDBThreadHelper::OpenCursor, base::Unretained(helper_), |
@@ -347,7 +346,7 @@ void DatabaseImpl::Count( |
const IndexedDBKeyRange& key_range, |
::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) { |
scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( |
- dispatcher_host_.get(), origin_, std::move(callbacks_info))); |
+ dispatcher_host_, origin_, std::move(callbacks_info))); |
idb_runner_->PostTask( |
FROM_HERE, base::Bind(&IDBThreadHelper::Count, base::Unretained(helper_), |
transaction_id, object_store_id, index_id, |
@@ -360,7 +359,7 @@ void DatabaseImpl::DeleteRange( |
const IndexedDBKeyRange& key_range, |
::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) { |
scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( |
- dispatcher_host_.get(), origin_, std::move(callbacks_info))); |
+ dispatcher_host_, origin_, std::move(callbacks_info))); |
idb_runner_->PostTask( |
FROM_HERE, |
base::Bind(&IDBThreadHelper::DeleteRange, base::Unretained(helper_), |
@@ -373,7 +372,7 @@ void DatabaseImpl::Clear( |
int64_t object_store_id, |
::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) { |
scoped_refptr<IndexedDBCallbacks> callbacks(new IndexedDBCallbacks( |
- dispatcher_host_.get(), origin_, std::move(callbacks_info))); |
+ dispatcher_host_, origin_, std::move(callbacks_info))); |
idb_runner_->PostTask( |
FROM_HERE, |
base::Bind(&IDBThreadHelper::Clear, base::Unretained(helper_), |
@@ -433,18 +432,18 @@ void DatabaseImpl::AckReceivedBlobs(const std::vector<std::string>& uuids) { |
DatabaseImpl::IDBThreadHelper::IDBThreadHelper( |
std::unique_ptr<IndexedDBConnection> connection, |
const url::Origin& origin, |
- scoped_refptr<IndexedDBDispatcherHost> dispatcher_host) |
- : dispatcher_host_(std::move(dispatcher_host)), |
+ scoped_refptr<IndexedDBContextImpl> indexed_db_context) |
+ : indexed_db_context_(indexed_db_context), |
connection_(std::move(connection)), |
origin_(origin), |
weak_factory_(this) { |
- dispatcher_host_->context()->ConnectionOpened(origin_, connection.get()); |
+ indexed_db_context_->ConnectionOpened(origin_, connection.get()); |
} |
DatabaseImpl::IDBThreadHelper::~IDBThreadHelper() { |
if (connection_->IsConnected()) |
connection_->Close(); |
- dispatcher_host_->context()->ConnectionClosed(origin_, connection_.get()); |
+ indexed_db_context_->ConnectionClosed(origin_, connection_.get()); |
} |
void DatabaseImpl::IDBThreadHelper::CreateObjectStore( |
@@ -807,8 +806,8 @@ void DatabaseImpl::IDBThreadHelper::Commit(int64_t transaction_id) { |
return; |
} |
- dispatcher_host_->context()->quota_manager_proxy()->GetUsageAndQuota( |
- dispatcher_host_->context()->TaskRunner(), origin_.GetURL(), |
+ indexed_db_context_->quota_manager_proxy()->GetUsageAndQuota( |
+ indexed_db_context_->TaskRunner(), origin_.GetURL(), |
storage::kStorageTypeTemporary, |
base::Bind(&IDBThreadHelper::OnGotUsageAndQuotaForCommit, |
weak_factory_.GetWeakPtr(), transaction_id)); |