| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/barrier_closure.h" | 7 #include "base/barrier_closure.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 special_storage_policy_(new MockSpecialStoragePolicy()), | 141 special_storage_policy_(new MockSpecialStoragePolicy()), |
| 142 quota_manager_(new MockQuotaManager(false, | 142 quota_manager_(new MockQuotaManager(false, |
| 143 browser_context_.GetPath(), | 143 browser_context_.GetPath(), |
| 144 io_task_runner_, | 144 io_task_runner_, |
| 145 idb_task_runner_, | 145 idb_task_runner_, |
| 146 special_storage_policy_)), | 146 special_storage_policy_)), |
| 147 quota_manager_proxy_(quota_manager_->proxy()), | 147 quota_manager_proxy_(quota_manager_->proxy()), |
| 148 context_impl_( | 148 context_impl_( |
| 149 new IndexedDBContextImpl(CreateAndReturnTempDir(&temp_dir_), | 149 new IndexedDBContextImpl(CreateAndReturnTempDir(&temp_dir_), |
| 150 special_storage_policy_.get(), | 150 special_storage_policy_.get(), |
| 151 quota_manager_proxy_.get(), | 151 quota_manager_proxy_.get())), |
| 152 idb_task_runner_.get())), | |
| 153 blob_storage_(ChromeBlobStorageContext::GetFor(&browser_context_)), | 152 blob_storage_(ChromeBlobStorageContext::GetFor(&browser_context_)), |
| 154 host_(new IndexedDBDispatcherHost(kFakeProcessId, | 153 host_(new IndexedDBDispatcherHost(kFakeProcessId, |
| 155 request_context_getter_.get(), | 154 request_context_getter_.get(), |
| 156 context_impl_.get(), | 155 context_impl_.get(), |
| 157 blob_storage_.get())) { | 156 blob_storage_.get())) { |
| 158 quota_manager_->SetQuota(GURL(kOrigin), storage::kStorageTypePersistent, | 157 quota_manager_->SetQuota(GURL(kOrigin), storage::kStorageTypePersistent, |
| 159 kTemporaryQuota); | 158 kTemporaryQuota); |
| 160 quota_manager_->SetQuota(GURL(kOrigin), storage::kStorageTypeTemporary, | 159 quota_manager_->SetQuota(GURL(kOrigin), storage::kStorageTypeTemporary, |
| 161 kPersistantQuota); | 160 kPersistantQuota); |
| 161 context_impl_->SetTaskRunnerForTesting(idb_task_runner_); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void TearDown() override { | 164 void TearDown() override { |
| 165 host_.reset(); | 165 host_.reset(); |
| 166 // In order for idb_thread_.Stop() to not cause thread/taskrunner checking | 166 // In order for idb_thread_.Stop() to not cause thread/taskrunner checking |
| 167 // errors, the handles must be deref'd before we join threads. This ensures | 167 // errors, the handles must be deref'd before we join threads. This ensures |
| 168 // classes that require destruction on the idb thread can be destructed | 168 // classes that require destruction on the idb thread can be destructed |
| 169 // correctly before scheduling on the the idb thread task runner turns into | 169 // correctly before scheduling on the the idb thread task runner turns into |
| 170 // a no-op after thread join. | 170 // a no-op after thread join. |
| 171 blob_storage_ = nullptr; | 171 blob_storage_ = nullptr; |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 content::IndexedDBKey(base::UTF8ToUTF16("hello")), | 436 content::IndexedDBKey(base::UTF8ToUTF16("hello")), |
| 437 blink::kWebIDBPutModeAddOnly, | 437 blink::kWebIDBPutModeAddOnly, |
| 438 std::vector<content::IndexedDBIndexKeys>(), | 438 std::vector<content::IndexedDBIndexKeys>(), |
| 439 put_callbacks->CreateInterfacePtrAndBind()); | 439 put_callbacks->CreateInterfacePtrAndBind()); |
| 440 connection.database->Commit(kTransactionId); | 440 connection.database->Commit(kTransactionId); |
| 441 loop.Run(); | 441 loop.Run(); |
| 442 } | 442 } |
| 443 } | 443 } |
| 444 | 444 |
| 445 } // namespace content | 445 } // namespace content |
| OLD | NEW |