Commit 8847d90d authored by Chase Phillips's avatar Chase Phillips Committed by Commit Bot

Stop passing |io_runner| around in IDB render-side code

As a result of the recent IO thread hopping removals,
|io_runner| is no longer needed.

Bug: 717812
Change-Id: I525785fda65a2edfaf86f11bcfcc21d6c74de85b
Reviewed-on: https://chromium-review.googlesource.com/1155830
Commit-Queue: Chase Phillips <cmp@chromium.org>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarChris Mumford <cmumford@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580331}
parent ace3b16b
...@@ -110,12 +110,10 @@ IndexedDBCallbacksImpl::IndexedDBCallbacksImpl( ...@@ -110,12 +110,10 @@ IndexedDBCallbacksImpl::IndexedDBCallbacksImpl(
std::unique_ptr<WebIDBCallbacks> callbacks, std::unique_ptr<WebIDBCallbacks> callbacks,
int64_t transaction_id, int64_t transaction_id,
const base::WeakPtr<WebIDBCursorImpl>& cursor, const base::WeakPtr<WebIDBCursorImpl>& cursor,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
scoped_refptr<base::SingleThreadTaskRunner> callback_runner) scoped_refptr<base::SingleThreadTaskRunner> callback_runner)
: internal_state_(new InternalState(std::move(callbacks), : internal_state_(new InternalState(std::move(callbacks),
transaction_id, transaction_id,
cursor, cursor,
std::move(io_runner),
callback_runner)), callback_runner)),
callback_runner_(std::move(callback_runner)) {} callback_runner_(std::move(callback_runner)) {}
...@@ -237,12 +235,10 @@ IndexedDBCallbacksImpl::InternalState::InternalState( ...@@ -237,12 +235,10 @@ IndexedDBCallbacksImpl::InternalState::InternalState(
std::unique_ptr<blink::WebIDBCallbacks> callbacks, std::unique_ptr<blink::WebIDBCallbacks> callbacks,
int64_t transaction_id, int64_t transaction_id,
const base::WeakPtr<WebIDBCursorImpl>& cursor, const base::WeakPtr<WebIDBCursorImpl>& cursor,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
scoped_refptr<base::SingleThreadTaskRunner> callback_runner) scoped_refptr<base::SingleThreadTaskRunner> callback_runner)
: callbacks_(std::move(callbacks)), : callbacks_(std::move(callbacks)),
transaction_id_(transaction_id), transaction_id_(transaction_id),
cursor_(cursor), cursor_(cursor),
io_runner_(std::move(io_runner)),
callback_runner_(std::move(callback_runner)) { callback_runner_(std::move(callback_runner)) {
IndexedDBDispatcher::ThreadSpecificInstance()->RegisterMojoOwnedCallbacks( IndexedDBDispatcher::ThreadSpecificInstance()->RegisterMojoOwnedCallbacks(
this); this);
...@@ -282,8 +278,8 @@ void IndexedDBCallbacksImpl::InternalState::UpgradeNeeded( ...@@ -282,8 +278,8 @@ void IndexedDBCallbacksImpl::InternalState::UpgradeNeeded(
blink::WebIDBDataLoss data_loss, blink::WebIDBDataLoss data_loss,
const std::string& data_loss_message, const std::string& data_loss_message,
const content::IndexedDBDatabaseMetadata& metadata) { const content::IndexedDBDatabaseMetadata& metadata) {
WebIDBDatabase* database = new WebIDBDatabaseImpl( WebIDBDatabase* database =
std::move(database_info), io_runner_, callback_runner_); new WebIDBDatabaseImpl(std::move(database_info), callback_runner_);
WebIDBMetadata web_metadata; WebIDBMetadata web_metadata;
ConvertDatabaseMetadata(metadata, &web_metadata); ConvertDatabaseMetadata(metadata, &web_metadata);
callbacks_->OnUpgradeNeeded(old_version, database, web_metadata, data_loss, callbacks_->OnUpgradeNeeded(old_version, database, web_metadata, data_loss,
...@@ -296,8 +292,8 @@ void IndexedDBCallbacksImpl::InternalState::SuccessDatabase( ...@@ -296,8 +292,8 @@ void IndexedDBCallbacksImpl::InternalState::SuccessDatabase(
const content::IndexedDBDatabaseMetadata& metadata) { const content::IndexedDBDatabaseMetadata& metadata) {
WebIDBDatabase* database = nullptr; WebIDBDatabase* database = nullptr;
if (database_info.is_valid()) { if (database_info.is_valid()) {
database = new WebIDBDatabaseImpl(std::move(database_info), io_runner_, database =
callback_runner_); new WebIDBDatabaseImpl(std::move(database_info), callback_runner_);
} }
WebIDBMetadata web_metadata; WebIDBMetadata web_metadata;
...@@ -312,7 +308,7 @@ void IndexedDBCallbacksImpl::InternalState::SuccessCursor( ...@@ -312,7 +308,7 @@ void IndexedDBCallbacksImpl::InternalState::SuccessCursor(
const IndexedDBKey& primary_key, const IndexedDBKey& primary_key,
indexed_db::mojom::ValuePtr value) { indexed_db::mojom::ValuePtr value) {
WebIDBCursorImpl* cursor = new WebIDBCursorImpl( WebIDBCursorImpl* cursor = new WebIDBCursorImpl(
std::move(cursor_info), transaction_id_, io_runner_, callback_runner_); std::move(cursor_info), transaction_id_, callback_runner_);
callbacks_->OnSuccess(cursor, WebIDBKeyBuilder::Build(key), callbacks_->OnSuccess(cursor, WebIDBKeyBuilder::Build(key),
WebIDBKeyBuilder::Build(primary_key), WebIDBKeyBuilder::Build(primary_key),
ConvertValue(value)); ConvertValue(value));
......
...@@ -32,7 +32,6 @@ class IndexedDBCallbacksImpl : public indexed_db::mojom::Callbacks { ...@@ -32,7 +32,6 @@ class IndexedDBCallbacksImpl : public indexed_db::mojom::Callbacks {
InternalState(std::unique_ptr<blink::WebIDBCallbacks> callbacks, InternalState(std::unique_ptr<blink::WebIDBCallbacks> callbacks,
int64_t transaction_id, int64_t transaction_id,
const base::WeakPtr<WebIDBCursorImpl>& cursor, const base::WeakPtr<WebIDBCursorImpl>& cursor,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
scoped_refptr<base::SingleThreadTaskRunner> callback_runner); scoped_refptr<base::SingleThreadTaskRunner> callback_runner);
~InternalState(); ~InternalState();
...@@ -66,7 +65,6 @@ class IndexedDBCallbacksImpl : public indexed_db::mojom::Callbacks { ...@@ -66,7 +65,6 @@ class IndexedDBCallbacksImpl : public indexed_db::mojom::Callbacks {
std::unique_ptr<blink::WebIDBCallbacks> callbacks_; std::unique_ptr<blink::WebIDBCallbacks> callbacks_;
int64_t transaction_id_; int64_t transaction_id_;
base::WeakPtr<WebIDBCursorImpl> cursor_; base::WeakPtr<WebIDBCursorImpl> cursor_;
scoped_refptr<base::SingleThreadTaskRunner> io_runner_;
scoped_refptr<base::SingleThreadTaskRunner> callback_runner_; scoped_refptr<base::SingleThreadTaskRunner> callback_runner_;
DISALLOW_COPY_AND_ASSIGN(InternalState); DISALLOW_COPY_AND_ASSIGN(InternalState);
...@@ -79,7 +77,6 @@ class IndexedDBCallbacksImpl : public indexed_db::mojom::Callbacks { ...@@ -79,7 +77,6 @@ class IndexedDBCallbacksImpl : public indexed_db::mojom::Callbacks {
std::unique_ptr<blink::WebIDBCallbacks> callbacks, std::unique_ptr<blink::WebIDBCallbacks> callbacks,
int64_t transaction_id, int64_t transaction_id,
const base::WeakPtr<WebIDBCursorImpl>& cursor, const base::WeakPtr<WebIDBCursorImpl>& cursor,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
scoped_refptr<base::SingleThreadTaskRunner> callback_runner); scoped_refptr<base::SingleThreadTaskRunner> callback_runner);
~IndexedDBCallbacksImpl() override; ~IndexedDBCallbacksImpl() override;
......
...@@ -29,10 +29,8 @@ namespace content { ...@@ -29,10 +29,8 @@ namespace content {
WebIDBCursorImpl::WebIDBCursorImpl( WebIDBCursorImpl::WebIDBCursorImpl(
indexed_db::mojom::CursorAssociatedPtrInfo cursor_info, indexed_db::mojom::CursorAssociatedPtrInfo cursor_info,
int64_t transaction_id, int64_t transaction_id,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
scoped_refptr<base::SingleThreadTaskRunner> callback_runner) scoped_refptr<base::SingleThreadTaskRunner> callback_runner)
: transaction_id_(transaction_id), : transaction_id_(transaction_id),
io_runner_(std::move(io_runner)),
callback_runner_(std::move(callback_runner)), callback_runner_(std::move(callback_runner)),
cursor_(std::move(cursor_info)), cursor_(std::move(cursor_info)),
continue_count_(0), continue_count_(0),
...@@ -66,7 +64,7 @@ void WebIDBCursorImpl::Advance(unsigned long count, ...@@ -66,7 +64,7 @@ void WebIDBCursorImpl::Advance(unsigned long count,
auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>( auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>(
std::move(callbacks), transaction_id_, weak_factory_.GetWeakPtr(), std::move(callbacks), transaction_id_, weak_factory_.GetWeakPtr(),
io_runner_, callback_runner_); callback_runner_);
cursor_->Advance(count, GetCallbacksProxy(std::move(callbacks_impl))); cursor_->Advance(count, GetCallbacksProxy(std::move(callbacks_impl)));
} }
...@@ -92,7 +90,7 @@ void WebIDBCursorImpl::Continue(WebIDBKeyView key, ...@@ -92,7 +90,7 @@ void WebIDBCursorImpl::Continue(WebIDBKeyView key,
auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>( auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>(
std::move(callbacks), transaction_id_, weak_factory_.GetWeakPtr(), std::move(callbacks), transaction_id_, weak_factory_.GetWeakPtr(),
io_runner_, callback_runner_); callback_runner_);
cursor_->Prefetch(prefetch_amount_, cursor_->Prefetch(prefetch_amount_,
GetCallbacksProxy(std::move(callbacks_impl))); GetCallbacksProxy(std::move(callbacks_impl)));
...@@ -114,7 +112,7 @@ void WebIDBCursorImpl::Continue(WebIDBKeyView key, ...@@ -114,7 +112,7 @@ void WebIDBCursorImpl::Continue(WebIDBKeyView key,
auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>( auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>(
std::move(callbacks), transaction_id_, weak_factory_.GetWeakPtr(), std::move(callbacks), transaction_id_, weak_factory_.GetWeakPtr(),
io_runner_, callback_runner_); callback_runner_);
cursor_->Continue(IndexedDBKeyBuilder::Build(key), cursor_->Continue(IndexedDBKeyBuilder::Build(key),
IndexedDBKeyBuilder::Build(primary_key), IndexedDBKeyBuilder::Build(primary_key),
GetCallbacksProxy(std::move(callbacks_impl))); GetCallbacksProxy(std::move(callbacks_impl)));
......
...@@ -33,7 +33,6 @@ class CONTENT_EXPORT WebIDBCursorImpl : public blink::WebIDBCursor { ...@@ -33,7 +33,6 @@ class CONTENT_EXPORT WebIDBCursorImpl : public blink::WebIDBCursor {
public: public:
WebIDBCursorImpl(indexed_db::mojom::CursorAssociatedPtrInfo cursor, WebIDBCursorImpl(indexed_db::mojom::CursorAssociatedPtrInfo cursor,
int64_t transaction_id, int64_t transaction_id,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
scoped_refptr<base::SingleThreadTaskRunner> callback_runner); scoped_refptr<base::SingleThreadTaskRunner> callback_runner);
~WebIDBCursorImpl() override; ~WebIDBCursorImpl() override;
...@@ -72,7 +71,6 @@ class CONTENT_EXPORT WebIDBCursorImpl : public blink::WebIDBCursor { ...@@ -72,7 +71,6 @@ class CONTENT_EXPORT WebIDBCursorImpl : public blink::WebIDBCursor {
int64_t transaction_id_; int64_t transaction_id_;
scoped_refptr<base::SingleThreadTaskRunner> io_runner_;
scoped_refptr<base::SingleThreadTaskRunner> callback_runner_; scoped_refptr<base::SingleThreadTaskRunner> callback_runner_;
indexed_db::mojom::CursorAssociatedPtr cursor_; indexed_db::mojom::CursorAssociatedPtr cursor_;
......
...@@ -125,7 +125,6 @@ class WebIDBCursorImplTest : public testing::Test { ...@@ -125,7 +125,6 @@ class WebIDBCursorImplTest : public testing::Test {
mojo::MakeRequestAssociatedWithDedicatedPipe(&ptr)); mojo::MakeRequestAssociatedWithDedicatedPipe(&ptr));
cursor_ = std::make_unique<WebIDBCursorImpl>( cursor_ = std::make_unique<WebIDBCursorImpl>(
ptr.PassInterface(), 1, ptr.PassInterface(), 1,
blink::scheduler::GetSingleThreadTaskRunnerForTesting(),
blink::scheduler::GetSingleThreadTaskRunnerForTesting()); blink::scheduler::GetSingleThreadTaskRunnerForTesting());
} }
......
...@@ -64,10 +64,8 @@ std::vector<content::IndexedDBIndexKeys> ConvertWebIndexKeys( ...@@ -64,10 +64,8 @@ std::vector<content::IndexedDBIndexKeys> ConvertWebIndexKeys(
WebIDBDatabaseImpl::WebIDBDatabaseImpl( WebIDBDatabaseImpl::WebIDBDatabaseImpl(
DatabaseAssociatedPtrInfo database_info, DatabaseAssociatedPtrInfo database_info,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
scoped_refptr<base::SingleThreadTaskRunner> callback_runner) scoped_refptr<base::SingleThreadTaskRunner> callback_runner)
: io_runner_(std::move(io_runner)), : callback_runner_(std::move(callback_runner)),
callback_runner_(std::move(callback_runner)),
database_(std::move(database_info)) {} database_(std::move(database_info)) {}
WebIDBDatabaseImpl::~WebIDBDatabaseImpl() = default; WebIDBDatabaseImpl::~WebIDBDatabaseImpl() = default;
...@@ -143,8 +141,7 @@ void WebIDBDatabaseImpl::Get(long long transaction_id, ...@@ -143,8 +141,7 @@ void WebIDBDatabaseImpl::Get(long long transaction_id,
transaction_id, nullptr); transaction_id, nullptr);
auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>( auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>(
base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_, base::WrapUnique(callbacks), transaction_id, nullptr, callback_runner_);
callback_runner_);
database_->Get(transaction_id, object_store_id, index_id, database_->Get(transaction_id, object_store_id, index_id,
IndexedDBKeyRangeBuilder::Build(key_range), key_only, IndexedDBKeyRangeBuilder::Build(key_range), key_only,
GetCallbacksProxy(std::move(callbacks_impl))); GetCallbacksProxy(std::move(callbacks_impl)));
...@@ -161,8 +158,7 @@ void WebIDBDatabaseImpl::GetAll(long long transaction_id, ...@@ -161,8 +158,7 @@ void WebIDBDatabaseImpl::GetAll(long long transaction_id,
transaction_id, nullptr); transaction_id, nullptr);
auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>( auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>(
base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_, base::WrapUnique(callbacks), transaction_id, nullptr, callback_runner_);
callback_runner_);
database_->GetAll(transaction_id, object_store_id, index_id, database_->GetAll(transaction_id, object_store_id, index_id,
IndexedDBKeyRangeBuilder::Build(key_range), key_only, IndexedDBKeyRangeBuilder::Build(key_range), key_only,
max_count, GetCallbacksProxy(std::move(callbacks_impl))); max_count, GetCallbacksProxy(std::move(callbacks_impl)));
...@@ -220,8 +216,7 @@ void WebIDBDatabaseImpl::Put(long long transaction_id, ...@@ -220,8 +216,7 @@ void WebIDBDatabaseImpl::Put(long long transaction_id,
} }
auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>( auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>(
base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_, base::WrapUnique(callbacks), transaction_id, nullptr, callback_runner_);
callback_runner_);
database_->Put(transaction_id, object_store_id, std::move(mojo_value), key, database_->Put(transaction_id, object_store_id, std::move(mojo_value), key,
put_mode, ConvertWebIndexKeys(index_ids, index_keys), put_mode, ConvertWebIndexKeys(index_ids, index_keys),
GetCallbacksProxy(std::move(callbacks_impl))); GetCallbacksProxy(std::move(callbacks_impl)));
...@@ -260,8 +255,7 @@ void WebIDBDatabaseImpl::OpenCursor(long long transaction_id, ...@@ -260,8 +255,7 @@ void WebIDBDatabaseImpl::OpenCursor(long long transaction_id,
transaction_id, nullptr); transaction_id, nullptr);
auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>( auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>(
base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_, base::WrapUnique(callbacks), transaction_id, nullptr, callback_runner_);
callback_runner_);
database_->OpenCursor(transaction_id, object_store_id, index_id, database_->OpenCursor(transaction_id, object_store_id, index_id,
IndexedDBKeyRangeBuilder::Build(key_range), direction, IndexedDBKeyRangeBuilder::Build(key_range), direction,
key_only, task_type, key_only, task_type,
...@@ -277,8 +271,7 @@ void WebIDBDatabaseImpl::Count(long long transaction_id, ...@@ -277,8 +271,7 @@ void WebIDBDatabaseImpl::Count(long long transaction_id,
transaction_id, nullptr); transaction_id, nullptr);
auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>( auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>(
base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_, base::WrapUnique(callbacks), transaction_id, nullptr, callback_runner_);
callback_runner_);
database_->Count(transaction_id, object_store_id, index_id, database_->Count(transaction_id, object_store_id, index_id,
IndexedDBKeyRangeBuilder::Build(key_range), IndexedDBKeyRangeBuilder::Build(key_range),
GetCallbacksProxy(std::move(callbacks_impl))); GetCallbacksProxy(std::move(callbacks_impl)));
...@@ -292,8 +285,7 @@ void WebIDBDatabaseImpl::Delete(long long transaction_id, ...@@ -292,8 +285,7 @@ void WebIDBDatabaseImpl::Delete(long long transaction_id,
transaction_id, nullptr); transaction_id, nullptr);
auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>( auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>(
base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_, base::WrapUnique(callbacks), transaction_id, nullptr, callback_runner_);
callback_runner_);
database_->DeleteRange(transaction_id, object_store_id, database_->DeleteRange(transaction_id, object_store_id,
IndexedDBKeyRangeBuilder::Build(primary_key), IndexedDBKeyRangeBuilder::Build(primary_key),
GetCallbacksProxy(std::move(callbacks_impl))); GetCallbacksProxy(std::move(callbacks_impl)));
...@@ -307,8 +299,7 @@ void WebIDBDatabaseImpl::DeleteRange(long long transaction_id, ...@@ -307,8 +299,7 @@ void WebIDBDatabaseImpl::DeleteRange(long long transaction_id,
transaction_id, nullptr); transaction_id, nullptr);
auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>( auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>(
base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_, base::WrapUnique(callbacks), transaction_id, nullptr, callback_runner_);
callback_runner_);
database_->DeleteRange(transaction_id, object_store_id, database_->DeleteRange(transaction_id, object_store_id,
IndexedDBKeyRangeBuilder::Build(key_range), IndexedDBKeyRangeBuilder::Build(key_range),
GetCallbacksProxy(std::move(callbacks_impl))); GetCallbacksProxy(std::move(callbacks_impl)));
...@@ -321,8 +312,7 @@ void WebIDBDatabaseImpl::Clear(long long transaction_id, ...@@ -321,8 +312,7 @@ void WebIDBDatabaseImpl::Clear(long long transaction_id,
transaction_id, nullptr); transaction_id, nullptr);
auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>( auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>(
base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_, base::WrapUnique(callbacks), transaction_id, nullptr, callback_runner_);
callback_runner_);
database_->Clear(transaction_id, object_store_id, database_->Clear(transaction_id, object_store_id,
GetCallbacksProxy(std::move(callbacks_impl))); GetCallbacksProxy(std::move(callbacks_impl)));
} }
......
...@@ -32,7 +32,6 @@ class CONTENT_EXPORT WebIDBDatabaseImpl : public blink::WebIDBDatabase { ...@@ -32,7 +32,6 @@ class CONTENT_EXPORT WebIDBDatabaseImpl : public blink::WebIDBDatabase {
public: public:
WebIDBDatabaseImpl( WebIDBDatabaseImpl(
indexed_db::mojom::DatabaseAssociatedPtrInfo database, indexed_db::mojom::DatabaseAssociatedPtrInfo database,
scoped_refptr<base::SingleThreadTaskRunner> io_runner,
scoped_refptr<base::SingleThreadTaskRunner> callback_runner); scoped_refptr<base::SingleThreadTaskRunner> callback_runner);
~WebIDBDatabaseImpl() override; ~WebIDBDatabaseImpl() override;
...@@ -149,7 +148,6 @@ class CONTENT_EXPORT WebIDBDatabaseImpl : public blink::WebIDBDatabase { ...@@ -149,7 +148,6 @@ class CONTENT_EXPORT WebIDBDatabaseImpl : public blink::WebIDBDatabase {
size_t max_put_value_size_ = kMaxIDBMessageSizeInBytes; size_t max_put_value_size_ = kMaxIDBMessageSizeInBytes;
std::set<int32_t> observer_ids_; std::set<int32_t> observer_ids_;
scoped_refptr<base::SingleThreadTaskRunner> io_runner_;
scoped_refptr<base::SingleThreadTaskRunner> callback_runner_; scoped_refptr<base::SingleThreadTaskRunner> callback_runner_;
indexed_db::mojom::DatabaseAssociatedPtr database_; indexed_db::mojom::DatabaseAssociatedPtr database_;
}; };
......
...@@ -60,8 +60,7 @@ TEST_F(WebIDBDatabaseImplTest, ValueSizeTest) { ...@@ -60,8 +60,7 @@ TEST_F(WebIDBDatabaseImplTest, ValueSizeTest) {
EXPECT_CALL(callbacks, OnError(_)).Times(1); EXPECT_CALL(callbacks, OnError(_)).Times(1);
WebIDBDatabaseImpl database_impl( WebIDBDatabaseImpl database_impl(
nullptr, blink::scheduler::GetSingleThreadTaskRunnerForTesting(), nullptr, blink::scheduler::GetSingleThreadTaskRunnerForTesting());
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
database_impl.max_put_value_size_ = kMaxValueSizeForTesting; database_impl.max_put_value_size_ = kMaxValueSizeForTesting;
const WebIDBKey idb_key = WebIDBKey::CreateNumber(0); const WebIDBKey idb_key = WebIDBKey::CreateNumber(0);
database_impl.Put(transaction_id, object_store_id, value, web_blob_info, database_impl.Put(transaction_id, object_store_id, value, web_blob_info,
...@@ -89,8 +88,7 @@ TEST_F(WebIDBDatabaseImplTest, KeyAndValueSizeTest) { ...@@ -89,8 +88,7 @@ TEST_F(WebIDBDatabaseImplTest, KeyAndValueSizeTest) {
EXPECT_CALL(callbacks, OnError(_)).Times(1); EXPECT_CALL(callbacks, OnError(_)).Times(1);
WebIDBDatabaseImpl database_impl( WebIDBDatabaseImpl database_impl(
nullptr, blink::scheduler::GetSingleThreadTaskRunnerForTesting(), nullptr, blink::scheduler::GetSingleThreadTaskRunnerForTesting());
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
database_impl.max_put_value_size_ = kMaxValueSizeForTesting; database_impl.max_put_value_size_ = kMaxValueSizeForTesting;
database_impl.Put(transaction_id, object_store_id, value, web_blob_info, database_impl.Put(transaction_id, object_store_id, value, web_blob_info,
key.View(), blink::kWebIDBPutModeAddOrUpdate, &callbacks, key.View(), blink::kWebIDBPutModeAddOrUpdate, &callbacks,
......
...@@ -25,10 +25,8 @@ using indexed_db::mojom::FactoryPtrInfo; ...@@ -25,10 +25,8 @@ using indexed_db::mojom::FactoryPtrInfo;
namespace content { namespace content {
WebIDBFactoryImpl::WebIDBFactoryImpl( WebIDBFactoryImpl::WebIDBFactoryImpl(FactoryPtrInfo factory_info)
FactoryPtrInfo factory_info, : factory_(std::move(factory_info)) {}
scoped_refptr<base::SingleThreadTaskRunner> io_runner)
: io_runner_(std::move(io_runner)), factory_(std::move(factory_info)) {}
WebIDBFactoryImpl::~WebIDBFactoryImpl() = default; WebIDBFactoryImpl::~WebIDBFactoryImpl() = default;
...@@ -38,7 +36,7 @@ void WebIDBFactoryImpl::GetDatabaseNames( ...@@ -38,7 +36,7 @@ void WebIDBFactoryImpl::GetDatabaseNames(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>( auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>(
base::WrapUnique(callbacks), IndexedDBCallbacksImpl::kNoTransaction, base::WrapUnique(callbacks), IndexedDBCallbacksImpl::kNoTransaction,
nullptr, io_runner_, std::move(task_runner)); nullptr, std::move(task_runner));
factory_->GetDatabaseNames(GetCallbacksProxy(std::move(callbacks_impl)), factory_->GetDatabaseNames(GetCallbacksProxy(std::move(callbacks_impl)),
url::Origin(origin)); url::Origin(origin));
} }
...@@ -52,8 +50,7 @@ void WebIDBFactoryImpl::Open( ...@@ -52,8 +50,7 @@ void WebIDBFactoryImpl::Open(
const WebSecurityOrigin& origin, const WebSecurityOrigin& origin,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>( auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>(
base::WrapUnique(callbacks), transaction_id, nullptr, io_runner_, base::WrapUnique(callbacks), transaction_id, nullptr, task_runner);
task_runner);
auto database_callbacks_impl = auto database_callbacks_impl =
std::make_unique<IndexedDBDatabaseCallbacksImpl>( std::make_unique<IndexedDBDatabaseCallbacksImpl>(
base::WrapUnique(database_callbacks), std::move(task_runner)); base::WrapUnique(database_callbacks), std::move(task_runner));
...@@ -70,7 +67,7 @@ void WebIDBFactoryImpl::DeleteDatabase( ...@@ -70,7 +67,7 @@ void WebIDBFactoryImpl::DeleteDatabase(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>( auto callbacks_impl = std::make_unique<IndexedDBCallbacksImpl>(
base::WrapUnique(callbacks), IndexedDBCallbacksImpl::kNoTransaction, base::WrapUnique(callbacks), IndexedDBCallbacksImpl::kNoTransaction,
nullptr, io_runner_, std::move(task_runner)); nullptr, std::move(task_runner));
factory_->DeleteDatabase(GetCallbacksProxy(std::move(callbacks_impl)), factory_->DeleteDatabase(GetCallbacksProxy(std::move(callbacks_impl)),
url::Origin(origin), name.Utf16(), force_close); url::Origin(origin), name.Utf16(), force_close);
} }
......
...@@ -23,8 +23,7 @@ namespace content { ...@@ -23,8 +23,7 @@ namespace content {
class WebIDBFactoryImpl : public blink::WebIDBFactory { class WebIDBFactoryImpl : public blink::WebIDBFactory {
public: public:
WebIDBFactoryImpl(indexed_db::mojom::FactoryPtrInfo factory_info, explicit WebIDBFactoryImpl(indexed_db::mojom::FactoryPtrInfo factory_info);
scoped_refptr<base::SingleThreadTaskRunner> io_runner);
~WebIDBFactoryImpl() override; ~WebIDBFactoryImpl() override;
// See WebIDBFactory.h for documentation on these functions. // See WebIDBFactory.h for documentation on these functions.
...@@ -53,7 +52,6 @@ class WebIDBFactoryImpl : public blink::WebIDBFactory { ...@@ -53,7 +52,6 @@ class WebIDBFactoryImpl : public blink::WebIDBFactory {
GetDatabaseCallbacksProxy( GetDatabaseCallbacksProxy(
std::unique_ptr<IndexedDBDatabaseCallbacksImpl> callbacks); std::unique_ptr<IndexedDBDatabaseCallbacksImpl> callbacks);
scoped_refptr<base::SingleThreadTaskRunner> io_runner_;
indexed_db::mojom::FactoryPtr factory_; indexed_db::mojom::FactoryPtr factory_;
}; };
......
...@@ -566,16 +566,11 @@ void RendererBlinkPlatformImpl::CloneSessionStorageNamespace( ...@@ -566,16 +566,11 @@ void RendererBlinkPlatformImpl::CloneSessionStorageNamespace(
std::unique_ptr<blink::WebIDBFactory> std::unique_ptr<blink::WebIDBFactory>
RendererBlinkPlatformImpl::CreateIdbFactory() { RendererBlinkPlatformImpl::CreateIdbFactory() {
// If running in a test context, RenderThread may not exist on init, which
// would lead to |io_runner_| being null.
if (!io_runner_)
return nullptr;
indexed_db::mojom::FactoryPtrInfo web_idb_factory_host_info; indexed_db::mojom::FactoryPtrInfo web_idb_factory_host_info;
GetInterfaceProvider()->GetInterface( GetInterfaceProvider()->GetInterface(
mojo::MakeRequest(&web_idb_factory_host_info)); mojo::MakeRequest(&web_idb_factory_host_info));
return std::make_unique<WebIDBFactoryImpl>( return std::make_unique<WebIDBFactoryImpl>(
std::move(web_idb_factory_host_info), std::move(web_idb_factory_host_info));
io_runner_);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment