Commit 6b19ece3 authored by Austin Sullivan's avatar Austin Sullivan Committed by Chromium LUCI CQ

Remove GetDatabaseNames callpath

GetDatabaseNames is no longer used as of https://crrev.com/c/2557571
This change removes the entire callpath, as well as IndexedDBCallbacks
and WebIDBCallbacks specific to GetDatabaseNames.

The change allows for the future removal of IDBAny::kDOMStringListType.

Bug: 992958
Change-Id: Ide725ff2ba9143cc6a1d13123b7d9a624ac4a1cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2563872Reviewed-by: default avatarDaniel Murphy <dmurph@chromium.org>
Reviewed-by: default avatarEmily Stark <estark@chromium.org>
Commit-Queue: Austin Sullivan <asully@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834817}
parent cd353942
......@@ -138,20 +138,6 @@ void IndexedDBCallbacks::OnSuccess(
complete_ = true;
}
void IndexedDBCallbacks::OnSuccess(const std::vector<base::string16>& value) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!complete_);
if (!callbacks_)
return;
if (!dispatcher_host_) {
OnConnectionError();
return;
}
callbacks_->SuccessStringList(value);
complete_ = true;
}
void IndexedDBCallbacks::OnBlocked(int64_t existing_version) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!complete_);
......
......@@ -54,9 +54,6 @@ class CONTENT_EXPORT IndexedDBCallbacks
virtual void OnSuccess(
std::vector<blink::mojom::IDBNameAndVersionPtr> names_and_versions);
// IndexedDBFactory::GetDatabaseNames
virtual void OnSuccess(const std::vector<base::string16>& string);
// IndexedDBFactory::Open / DeleteDatabase
virtual void OnBlocked(int64_t existing_version);
......
......@@ -278,20 +278,6 @@ void IndexedDBDispatcherHost::GetDatabaseInfo(
std::move(callbacks), origin, indexed_db_path);
}
void IndexedDBDispatcherHost::GetDatabaseNames(
mojo::PendingAssociatedRemote<blink::mojom::IDBCallbacks>
pending_callbacks) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
const auto& origin = receivers_.current_context();
scoped_refptr<IndexedDBCallbacks> callbacks(
new IndexedDBCallbacks(this->AsWeakPtr(), origin,
std::move(pending_callbacks), IDBTaskRunner()));
base::FilePath indexed_db_path = indexed_db_context_->data_path();
indexed_db_context_->GetIDBFactory()->GetDatabaseNames(
std::move(callbacks), origin, indexed_db_path);
}
void IndexedDBDispatcherHost::Open(
mojo::PendingAssociatedRemote<blink::mojom::IDBCallbacks> pending_callbacks,
mojo::PendingAssociatedRemote<blink::mojom::IDBDatabaseCallbacks>
......
......@@ -101,9 +101,6 @@ class CONTENT_EXPORT IndexedDBDispatcherHost : public blink::mojom::IDBFactory {
// blink::mojom::IDBFactory implementation:
void GetDatabaseInfo(mojo::PendingAssociatedRemote<blink::mojom::IDBCallbacks>
pending_callbacks) override;
void GetDatabaseNames(
mojo::PendingAssociatedRemote<blink::mojom::IDBCallbacks>
pending_callbacks) override;
void Open(mojo::PendingAssociatedRemote<blink::mojom::IDBCallbacks>
pending_callbacks,
mojo::PendingAssociatedRemote<blink::mojom::IDBDatabaseCallbacks>
......
......@@ -41,9 +41,6 @@ class CONTENT_EXPORT IndexedDBFactory {
virtual void GetDatabaseInfo(scoped_refptr<IndexedDBCallbacks> callbacks,
const url::Origin& origin,
const base::FilePath& data_directory) = 0;
virtual void GetDatabaseNames(scoped_refptr<IndexedDBCallbacks> callbacks,
const url::Origin& origin,
const base::FilePath& data_directory) = 0;
virtual void Open(
const base::string16& name,
std::unique_ptr<IndexedDBPendingConnection> connection,
......
......@@ -227,49 +227,6 @@ void IndexedDBFactoryImpl::GetDatabaseInfo(
callbacks->OnSuccess(std::move(names_and_versions));
}
void IndexedDBFactoryImpl::GetDatabaseNames(
scoped_refptr<IndexedDBCallbacks> callbacks,
const Origin& origin,
const base::FilePath& data_directory) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
IDB_TRACE("IndexedDBFactoryImpl::GetDatabaseInfo");
IndexedDBOriginStateHandle origin_state_handle;
leveldb::Status s;
IndexedDBDatabaseError error;
// Note: Any data loss information here is not piped up to the renderer, and
// will be lost.
std::tie(origin_state_handle, s, error, std::ignore, std::ignore) =
GetOrOpenOriginFactory(origin, data_directory,
/*create_if_missing=*/false);
if (!origin_state_handle.IsHeld() || !origin_state_handle.origin_state()) {
if (s.IsNotFound()) {
callbacks->OnSuccess(std::vector<base::string16>());
} else {
callbacks->OnError(error);
}
if (s.IsCorruption())
HandleBackingStoreCorruption(origin, error);
return;
}
IndexedDBOriginState* factory = origin_state_handle.origin_state();
IndexedDBMetadataCoding metadata_coding;
std::vector<base::string16> names;
s = metadata_coding.ReadDatabaseNames(
factory->backing_store_->db(),
factory->backing_store_->origin_identifier(), &names);
if (!s.ok()) {
error = IndexedDBDatabaseError(blink::mojom::IDBException::kUnknownError,
"Internal error opening backing store for "
"indexedDB.webkitGetDatabaseNames.");
callbacks->OnError(error);
if (s.IsCorruption())
HandleBackingStoreCorruption(origin, error);
return;
}
callbacks->OnSuccess(names);
}
void IndexedDBFactoryImpl::Open(
const base::string16& name,
std::unique_ptr<IndexedDBPendingConnection> connection,
......
......@@ -64,9 +64,6 @@ class CONTENT_EXPORT IndexedDBFactoryImpl
void GetDatabaseInfo(scoped_refptr<IndexedDBCallbacks> callbacks,
const url::Origin& origin,
const base::FilePath& data_directory) override;
void GetDatabaseNames(scoped_refptr<IndexedDBCallbacks> callbacks,
const url::Origin& origin,
const base::FilePath& data_directory) override;
void Open(const base::string16& name,
std::unique_ptr<IndexedDBPendingConnection> connection,
const url::Origin& origin,
......
......@@ -218,7 +218,6 @@ class ForceCloseDBCallbacks : public IndexedDBCallbacks {
origin_(origin) {}
void OnSuccess() override {}
void OnSuccess(const std::vector<base::string16>&) override {}
void OnSuccess(std::unique_ptr<IndexedDBConnection> connection,
const IndexedDBDatabaseMetadata& metadata) override {
connection_ = std::move(connection);
......
......@@ -38,7 +38,6 @@ void MockIndexedDBCallbacks::OnSuccess() {}
void MockIndexedDBCallbacks::OnSuccess(int64_t result) {}
void MockIndexedDBCallbacks::OnSuccess(const std::vector<base::string16>&) {}
void MockIndexedDBCallbacks::OnSuccess(
std::vector<blink::mojom::IDBNameAndVersionPtr> names_and_versions) {
info_called_ = true;
......
......@@ -30,7 +30,6 @@ class MockIndexedDBCallbacks : public IndexedDBCallbacks {
void OnSuccess() override;
void OnSuccess(int64_t result) override;
void OnSuccess(const std::vector<base::string16>& result) override;
void OnSuccess(std::vector<blink::mojom::IDBNameAndVersionPtr>
names_and_versions) override;
void OnSuccess(std::unique_ptr<IndexedDBConnection> connection,
......
......@@ -263,9 +263,6 @@ interface IDBCallbacks {
// Factory::GetDatabaseInfo
SuccessNamesAndVersionsList(array<IDBNameAndVersion> value);
// Factory::GetDatabaseNames
SuccessStringList(array<mojo_base.mojom.String16> value);
// Factory::Open / DeleteDatabase
Blocked(int64 existing_version);
......@@ -484,10 +481,6 @@ interface IDBFactory {
// origin. Posts results to |pending_callbacks|.
GetDatabaseInfo(pending_associated_remote<IDBCallbacks> pending_callbacks);
// Gets a list of database names that exist in the frame's
// origin. Posts results to |pending_callbacks|.
GetDatabaseNames(pending_associated_remote<IDBCallbacks> pending_callbacks);
// Opens a database |name| in the frame's origin at version |version|.
// |version_change_transaction_receiver| will have version change
// transaction operations posted to it. |transaction_id| corresponds
......
......@@ -137,8 +137,6 @@ class WebIDBGetDBNamesCallbacksImpl : public WebIDBCallbacks {
// completed in the destructor.
}
void SuccessStringList(const Vector<String>&) override { NOTREACHED(); }
void SuccessCursor(
mojo::PendingAssociatedRemote<mojom::blink::IDBCursor> cursor_info,
std::unique_ptr<IDBKey> key,
......
......@@ -70,7 +70,6 @@ class MODULES_EXPORT IDBFactory final : public ScriptWrappable {
ExceptionState&);
// These are not exposed to the web applications and only used by DevTools.
IDBRequest* GetDatabaseNames(ScriptState*, ExceptionState&);
IDBOpenDBRequest* CloseConnectionsAndDeleteDatabase(ScriptState*,
const String& name,
ExceptionState&);
......
......@@ -91,12 +91,6 @@ class BackendFactoryWithMockedDatabaseInfo : public mojom::blink::IDBFactory {
NOTREACHED();
}
void GetDatabaseNames(
mojo::PendingAssociatedRemote<mojom::blink::IDBCallbacks>
pending_callbacks) override {
NOTREACHED();
}
void GetDatabaseInfo(mojo::PendingAssociatedRemote<mojom::blink::IDBCallbacks>
pending_callbacks) override {
callbacks_ptr_->Bind(std::move(pending_callbacks));
......
......@@ -437,19 +437,6 @@ void IDBRequest::EnqueueResponse(DOMException* error) {
EnqueueEvent(Event::CreateCancelableBubble(event_type_names::kError));
}
void IDBRequest::EnqueueResponse(const Vector<String>& string_list) {
IDB_TRACE("IDBRequest::onSuccess(StringList)");
if (!ShouldEnqueueEvent()) {
metrics_.RecordAndReset();
return;
}
auto* dom_string_list = MakeGarbageCollected<DOMStringList>();
for (const auto& item : string_list)
dom_string_list->Append(item);
EnqueueResultInternal(MakeGarbageCollected<IDBAny>(dom_string_list));
}
void IDBRequest::EnqueueResponse(std::unique_ptr<WebIDBCursor> backend,
std::unique_ptr<IDBKey> key,
std::unique_ptr<IDBKey> primary_key,
......
......@@ -233,7 +233,6 @@ void EnsureIDBCallbacksDontThrow(IDBRequest* request,
request->HandleResponse();
request->HandleResponse(IDBKey::CreateInvalid(), IDBKey::CreateInvalid(),
CreateNullIDBValueForTesting(scope.GetIsolate()));
request->EnqueueResponse(Vector<String>());
EXPECT_TRUE(!exception_state.HadException());
}
......
......@@ -129,8 +129,6 @@ class GetDatabaseNamesCallback final : public mojom::blink::IDBCallbacks {
request_callback_->sendSuccess(std::move(database_names));
}
void SuccessStringList(const Vector<String>&) override { NOTREACHED(); }
void SuccessDatabase(
mojo::PendingAssociatedRemote<mojom::blink::IDBDatabase> pending_backend,
const IDBDatabaseMetadata& metadata) override {
......
......@@ -40,8 +40,6 @@ class MockWebIDBCallbacks : public WebIDBCallbacks {
MOCK_METHOD1(SuccessNamesAndVersionsList,
void(Vector<mojom::blink::IDBNameAndVersionPtr>));
MOCK_METHOD1(SuccessStringList, void(const Vector<String>&));
void SuccessCursor(
mojo::PendingAssociatedRemote<mojom::blink::IDBCursor> cursor_info,
std::unique_ptr<IDBKey> key,
......
......@@ -116,20 +116,6 @@ void WebIDBCallbacksImpl::SuccessNamesAndVersionsList(
NOTREACHED();
}
void WebIDBCallbacksImpl::SuccessStringList(const Vector<String>& string_list) {
if (!request_)
return;
probe::AsyncTask async_task(request_->GetExecutionContext(), &async_task_id_,
"success");
#if DCHECK_IS_ON()
DCHECK(!request_->TransactionHasQueuedResults());
#endif // DCHECK_IS_ON()
IDBRequest* request = request_.Get();
Detach();
request->EnqueueResponse(std::move(string_list));
}
void WebIDBCallbacksImpl::SuccessCursor(
mojo::PendingAssociatedRemote<mojom::blink::IDBCursor> cursor_info,
std::unique_ptr<IDBKey> key,
......
......@@ -66,7 +66,6 @@ class WebIDBCallbacksImpl final : public WebIDBCallbacks {
void Error(mojom::blink::IDBException code, const String& message) override;
void SuccessNamesAndVersionsList(
Vector<mojom::blink::IDBNameAndVersionPtr>) override;
void SuccessStringList(const Vector<String>&) override;
void SuccessCursor(
mojo::PendingAssociatedRemote<mojom::blink::IDBCursor> cursor_info,
std::unique_ptr<IDBKey> key,
......
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