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

service worker: Use mojofied ServiceWorkerStorage::UpdateToActiveState()

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 ServiceWorkerStorage 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
Change-Id: I0e24b45a412220619197b4da03166670295be567
Binary-Size: Size increase is unavoidable (see above)
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2245160Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779631}
parent cb72ebc6
...@@ -456,7 +456,7 @@ void ServiceWorkerRegistry::UpdateToActiveState(int64_t registration_id, ...@@ -456,7 +456,7 @@ void ServiceWorkerRegistry::UpdateToActiveState(int64_t registration_id,
const GURL& origin, const GURL& origin,
StatusCallback callback) { StatusCallback callback) {
DCHECK_CURRENTLY_ON(ServiceWorkerContext::GetCoreThreadId()); DCHECK_CURRENTLY_ON(ServiceWorkerContext::GetCoreThreadId());
storage()->UpdateToActiveState( GetRemoteStorageControl()->UpdateToActiveState(
registration_id, origin, registration_id, origin,
base::BindOnce(&ServiceWorkerRegistry::DidUpdateToActiveState, base::BindOnce(&ServiceWorkerRegistry::DidUpdateToActiveState,
weak_factory_.GetWeakPtr(), origin, std::move(callback))); weak_factory_.GetWeakPtr(), origin, std::move(callback)));
...@@ -1383,4 +1383,18 @@ bool ServiceWorkerRegistry::ShouldPurgeOnShutdown(const url::Origin& origin) { ...@@ -1383,4 +1383,18 @@ bool ServiceWorkerRegistry::ShouldPurgeOnShutdown(const url::Origin& origin) {
!special_storage_policy_->IsStorageProtected(origin.GetURL()); !special_storage_policy_->IsStorageProtected(origin.GetURL());
} }
mojo::Remote<storage::mojom::ServiceWorkerStorageControl>&
ServiceWorkerRegistry::GetRemoteStorageControl() {
DCHECK(!(remote_storage_control_.is_bound() &&
!remote_storage_control_.is_connected()))
<< "Rebinding is not supported yet.";
if (!remote_storage_control_.is_bound()) {
storage_control_->Bind(
remote_storage_control_.BindNewPipeAndPassReceiver());
}
return remote_storage_control_;
}
} // namespace content } // namespace content
...@@ -349,6 +349,9 @@ class CONTENT_EXPORT ServiceWorkerRegistry { ...@@ -349,6 +349,9 @@ class CONTENT_EXPORT ServiceWorkerRegistry {
void OnStoragePolicyChanged(); void OnStoragePolicyChanged();
bool ShouldPurgeOnShutdown(const url::Origin& origin); bool ShouldPurgeOnShutdown(const url::Origin& origin);
mojo::Remote<storage::mojom::ServiceWorkerStorageControl>&
GetRemoteStorageControl();
// The ServiceWorkerContextCore object must outlive this. // The ServiceWorkerContextCore object must outlive this.
ServiceWorkerContextCore* const context_; ServiceWorkerContextCore* const context_;
......
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