Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Unified Diff: content/browser/service_worker/service_worker_dispatcher_host.cc

Issue 440403002: Don't share ServiceWorkerHandle between provider hosts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_dispatcher_host.cc
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc
index 0d006e8be07bddfad722537ee91f84372f017c19..2c68c82a3ef598b0c94388ea3e0f3f08943f3bcb 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -208,6 +208,7 @@ void ServiceWorkerDispatcherHost::OnRegisterServiceWorker(
base::Bind(&ServiceWorkerDispatcherHost::RegistrationComplete,
this,
thread_id,
+ provider_id,
request_id));
}
@@ -315,22 +316,24 @@ void ServiceWorkerDispatcherHost::OnSetHostedVersionId(
BadMessageReceived();
}
-ServiceWorkerHandle* ServiceWorkerDispatcherHost::FindHandle(int thread_id,
+ServiceWorkerHandle* ServiceWorkerDispatcherHost::FindHandle(int provider_id,
int64 version_id) {
for (IDMap<ServiceWorkerHandle, IDMapOwnPointer>::iterator iter(&handles_);
!iter.IsAtEnd();
iter.Advance()) {
ServiceWorkerHandle* handle = iter.GetCurrentValue();
DCHECK(handle);
- if (handle->thread_id() == thread_id && handle->version() &&
- handle->version()->version_id() == version_id)
+ if (handle->provider_id() == provider_id && handle->version() &&
+ handle->version()->version_id() == version_id) {
return handle;
+ }
}
return NULL;
}
void ServiceWorkerDispatcherHost::RegistrationComplete(
int thread_id,
+ int provider_id,
int request_id,
ServiceWorkerStatusCode status,
int64 registration_id,
@@ -347,13 +350,14 @@ void ServiceWorkerDispatcherHost::RegistrationComplete(
DCHECK(version);
DCHECK_EQ(registration_id, version->registration_id());
ServiceWorkerObjectInfo info;
- ServiceWorkerHandle* handle = FindHandle(thread_id, version_id);
+ ServiceWorkerHandle* handle = FindHandle(provider_id, version_id);
if (handle) {
+ DCHECK_EQ(thread_id, handle->thread_id());
info = handle->GetObjectInfo();
handle->IncrementRefCount();
} else {
scoped_ptr<ServiceWorkerHandle> new_handle = ServiceWorkerHandle::Create(
- GetContext()->AsWeakPtr(), this, thread_id, version);
+ GetContext()->AsWeakPtr(), this, thread_id, provider_id, version);
info = new_handle->GetObjectInfo();
RegisterServiceWorkerHandle(new_handle.Pass());
}

Powered by Google App Engine
This is Rietveld 408576698