ServiceWorker: Consolidate version manipulation functions in SWProviderContext
commit7c76e32b639e3e8c89d1d3c9aa5de96cb1f0d1ff
authornhiroki <nhiroki@chromium.org>
Fri, 16 Jan 2015 02:32:33 +0000 (15 18:32 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 16 Jan 2015 02:33:17 +0000 (16 02:33 +0000)
treee78faaa86da4c5788d00059c7bf9a06109841357
parent29238392c715eb7314551fd39abbafb415f12ab5
ServiceWorker: Consolidate version manipulation functions in SWProviderContext

This is a preparation patch for exposing SWRegistration object into
SWGlobalScope.

According to the design doc[1], we're going to make SWProviderContext
thread-safe using the lock mechanism so that the worker thread can also
use the context.

But, in the current implementation, functions to manipulate versions
(eg. OnSetInstallingServiceWorker()) are fine-grained and they can be
interleaved from multiple threads if we naively use the lock on a per
function basis. To avoid the situation, this CL consolidates those
functions as SetVersionAttributes() and makes it easier to protect by lock.

[1] https://docs.google.com/document/d/1qDGbMlwKOXxCRBlw9IirK8Qmna3JqvnO3Aogkfu9UJQ/edit?usp=sharing

BUG=437677
TEST=run-webkit-tests http/tests/serviceworker/

Review URL: https://codereview.chromium.org/849203002

Cr-Commit-Position: refs/heads/master@{#311822}
content/child/service_worker/service_worker_dispatcher.cc
content/child/service_worker/service_worker_dispatcher.h
content/child/service_worker/service_worker_provider_context.cc
content/child/service_worker/service_worker_provider_context.h