Commit ef7878b4 authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Commit Bot

service worker: Use mojo version of GetNewRegistrationId()

Bug: 1055677
Change-Id: I8509d0becc206a5017a23b3dbda3461ef9699b43
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2321910
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792616}
parent a7ab6685
......@@ -154,7 +154,7 @@ void ServiceWorkerRegistry::CreateNewRegistration(
blink::mojom::ServiceWorkerRegistrationOptions options,
NewRegistrationCallback callback) {
DCHECK_CURRENTLY_ON(ServiceWorkerContext::GetCoreThreadId());
storage()->GetNewRegistrationId(base::BindOnce(
GetRemoteStorageControl()->GetNewRegistrationId(base::BindOnce(
&ServiceWorkerRegistry::DidGetNewRegistrationId,
weak_factory_.GetWeakPtr(), std::move(options), std::move(callback)));
}
......
......@@ -407,7 +407,17 @@ scoped_refptr<ServiceWorkerRegistration> CreateNewServiceWorkerRegistration(
ServiceWorkerRegistry* registry,
const blink::mojom::ServiceWorkerRegistrationOptions& options) {
scoped_refptr<ServiceWorkerRegistration> registration;
base::RunLoop run_loop;
// Using nestable run loop because:
// * The CreateNewRegistration() internally uses a mojo remote and the
// receiver of the remote lives in the same process/sequence in tests.
// * When the receiver lives in the same process, a nested task is posted so
// that a mojo message sent to the receiver can be dispatched.
// * Default run loop doesn't execute nested tasks. Tests will hang when
// default run loop is used.
// TODO(bashi): Figure out a way to avoid using nested loop as it's
// problematic especially on the IO thread. This function is called on the IO
// thread when ServiceWorkerOnUI is disabled.
base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed);
registry->CreateNewRegistration(
options,
base::BindLambdaForTesting(
......
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