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

Unified Diff: content/child/service_worker/service_worker_dispatcher.h

Issue 1307133003: ServiceWorker: Make APIs that return ServiceWorkerRegistration coin a new JS object (2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split CreateRegistration() Created 5 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/child/service_worker/service_worker_dispatcher.h
diff --git a/content/child/service_worker/service_worker_dispatcher.h b/content/child/service_worker/service_worker_dispatcher.h
index 5c4c7ad5308ee21cb9cae6951f686eaeb7ab67b9..f44db134d7f95340ec163e153a8b6d14244ccad0 100644
--- a/content/child/service_worker/service_worker_dispatcher.h
+++ b/content/child/service_worker/service_worker_dispatcher.h
@@ -37,6 +37,7 @@ namespace content {
class ServiceWorkerMessageFilter;
class ServiceWorkerProviderContext;
+class ServiceWorkerRegistrationHandleReference;
class ThreadSafeSender;
class WebServiceWorkerImpl;
class WebServiceWorkerRegistrationImpl;
@@ -134,13 +135,13 @@ class CONTENT_EXPORT ServiceWorkerDispatcher
const ServiceWorkerObjectInfo& info,
bool adopt_handle);
- // Creates a WebServiceWorkerRegistrationImpl for the specified registration
- // and transfers its ownership to the caller. If |adopt_handle| is true, a
- // ServiceWorkerRegistrationHandleReference will be adopted for the
- // registration.
- WebServiceWorkerRegistrationImpl* CreateServiceWorkerRegistration(
+ // Returns a new registration filled in with version attributes.
+ scoped_ptr<WebServiceWorkerRegistrationImpl> CreateRegistration(
const ServiceWorkerRegistrationObjectInfo& info,
- bool adopt_handle);
+ const ServiceWorkerVersionAttributes& attrs);
+ scoped_ptr<WebServiceWorkerRegistrationImpl> AdoptRegistration(
+ const ServiceWorkerRegistrationObjectInfo& info,
+ const ServiceWorkerVersionAttributes& attrs);
static ServiceWorkerDispatcher* GetOrCreateThreadSpecificInstance(
ThreadSafeSender* thread_safe_sender,
@@ -265,14 +266,10 @@ class CONTENT_EXPORT ServiceWorkerDispatcher
void RemoveServiceWorkerRegistration(
int registration_handle_id);
- // Returns an existing registration or new one filled in with version
- // attributes. This function assumes given |info| and |attrs| retain handle
- // references and always adopts them.
- // TODO(nhiroki): This assumption seems to impair readability. We could
- // explictly pass ServiceWorker(Registration)HandleReference instead.
- WebServiceWorkerRegistrationImpl* FindOrCreateRegistration(
- const ServiceWorkerRegistrationObjectInfo& info,
- const ServiceWorkerVersionAttributes& attrs);
+ scoped_ptr<WebServiceWorkerRegistrationImpl> CreateRegistrationInternal(
+ scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref,
+ const ServiceWorkerVersionAttributes& attrs,
+ bool adopt_handle);
RegistrationCallbackMap pending_registration_callbacks_;
UpdateCallbackMap pending_update_callbacks_;

Powered by Google App Engine
This is Rietveld 408576698