Commit 2c88abe9 authored by Maggie Cai's avatar Maggie Cai Committed by Commit Bot

Revert "Use ServiceWorkerStorageControl::GetNewRegistrationId()"

This reverts commit 8400e57d.

Reason for revert: There are service worker tests failures on multiple builders, and this CL is the only one that is related to service worker, revert to see if this is the cause.
first failure on failed builders:
https://ci.chromium.org/p/chromium/builders/ci/Linux%20ASan%20Tests%20%28sandboxed%29/67399
https://ci.chromium.org/p/chromium/builders/ci/Linux%20ASan%20LSan%20Tests%20%281%29/77750
https://ci.chromium.org/p/chromium/builders/ci/win-asan/12523

Original change's description:
> Use ServiceWorkerStorageControl::GetNewRegistrationId()
> 
> This CL replaces ServiceWorkerStorage::GetNewRegistrationId() call
> with the corresponding mojo method as a preparation for the Storage
> Service migration.
> 
> This CL increases the android binary sizes by ~30kb. Most of the
> increase (~29kb) comes from mojo generated code and there isn't much we
> can do to reduce them. Introducing the mojo interface is necessary for
> migrating ServiceWorkerStroage to the storage service. See the design
> doc [1] for the motivation of the migration and plans.
> 
> [1] https://docs.google.com/document/d/1hO0WEuoEOgEBlf5nDE3fDjuQY2bV_d5hLtk25iBo0LM/edit?usp=sharing
> 
> Bug: 1055677
> Binary-Size: Size increase is unavoidable (see above)
> Change-Id: I33e1e72b1da94ae02dfbe2a929895fc36e216e66
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2217935
> Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
> Reviewed-by: Matt Falkenhagen <falken@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#774947}

TBR=falken@chromium.org,rockot@google.com,bashi@chromium.org

Change-Id: I00de43c78d0e16b6031d4b766d156df6b4352370
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1055677
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2230378Reviewed-by: default avatarMaggie Cai <mxcai@chromium.org>
Commit-Queue: Maggie Cai <mxcai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#775000}
parent f68e4323
...@@ -154,8 +154,7 @@ void ServiceWorkerRegistry::CreateNewRegistration( ...@@ -154,8 +154,7 @@ void ServiceWorkerRegistry::CreateNewRegistration(
blink::mojom::ServiceWorkerRegistrationOptions options, blink::mojom::ServiceWorkerRegistrationOptions options,
NewRegistrationCallback callback) { NewRegistrationCallback callback) {
DCHECK_CURRENTLY_ON(ServiceWorkerContext::GetCoreThreadId()); DCHECK_CURRENTLY_ON(ServiceWorkerContext::GetCoreThreadId());
BindRemoteStorageControlIfNeeded(); storage()->GetNewRegistrationId(base::BindOnce(
remote_storage_control_->GetNewRegistrationId(base::BindOnce(
&ServiceWorkerRegistry::DidGetNewRegistrationId, &ServiceWorkerRegistry::DidGetNewRegistrationId,
weak_factory_.GetWeakPtr(), std::move(options), std::move(callback))); weak_factory_.GetWeakPtr(), std::move(options), std::move(callback)));
} }
...@@ -1384,15 +1383,4 @@ bool ServiceWorkerRegistry::ShouldPurgeOnShutdown(const url::Origin& origin) { ...@@ -1384,15 +1383,4 @@ bool ServiceWorkerRegistry::ShouldPurgeOnShutdown(const url::Origin& origin) {
!special_storage_policy_->IsStorageProtected(origin.GetURL()); !special_storage_policy_->IsStorageProtected(origin.GetURL());
} }
void ServiceWorkerRegistry::BindRemoteStorageControlIfNeeded() {
DCHECK(!(remote_storage_control_.is_bound() &&
!remote_storage_control_.is_connected()))
<< "Rebinding is not supported yet.";
if (remote_storage_control_.is_bound())
return;
storage_control_->Bind(remote_storage_control_.BindNewPipeAndPassReceiver());
}
} // namespace content } // namespace content
...@@ -349,8 +349,6 @@ class CONTENT_EXPORT ServiceWorkerRegistry { ...@@ -349,8 +349,6 @@ class CONTENT_EXPORT ServiceWorkerRegistry {
void OnStoragePolicyChanged(); void OnStoragePolicyChanged();
bool ShouldPurgeOnShutdown(const url::Origin& origin); bool ShouldPurgeOnShutdown(const url::Origin& origin);
void BindRemoteStorageControlIfNeeded();
// The ServiceWorkerContextCore object must outlive this. // The ServiceWorkerContextCore object must outlive this.
ServiceWorkerContextCore* const context_; ServiceWorkerContextCore* const context_;
......
...@@ -413,17 +413,7 @@ scoped_refptr<ServiceWorkerRegistration> CreateNewServiceWorkerRegistration( ...@@ -413,17 +413,7 @@ scoped_refptr<ServiceWorkerRegistration> CreateNewServiceWorkerRegistration(
ServiceWorkerRegistry* registry, ServiceWorkerRegistry* registry,
const blink::mojom::ServiceWorkerRegistrationOptions& options) { const blink::mojom::ServiceWorkerRegistrationOptions& options) {
scoped_refptr<ServiceWorkerRegistration> registration; scoped_refptr<ServiceWorkerRegistration> registration;
// Using nestable run loop because: base::RunLoop run_loop;
// * 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 sent mojo message to be dispatched to the receiver.
// * 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( registry->CreateNewRegistration(
options, options,
base::BindLambdaForTesting( 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