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

Side by Side Diff: content/browser/service_worker/service_worker_provider_host.h

Issue 477593007: ServiceWorker: Make '.ready' return a promise to be resolved with ServiceWorkerRegistration (2/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remake more Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // Associates to |registration| to listen for its version change events. 82 // Associates to |registration| to listen for its version change events.
83 void AssociateRegistration(ServiceWorkerRegistration* registration); 83 void AssociateRegistration(ServiceWorkerRegistration* registration);
84 84
85 // Clears the associated registration and stop listening to it. 85 // Clears the associated registration and stop listening to it.
86 void UnassociateRegistration(); 86 void UnassociateRegistration();
87 87
88 // Returns false if the version is not in the expected STARTING in our 88 // Returns false if the version is not in the expected STARTING in our
89 // process state. That would be indicative of a bad IPC message. 89 // process state. That would be indicative of a bad IPC message.
90 bool SetHostedVersionId(int64 versions_id); 90 bool SetHostedVersionId(int64 versions_id);
91 91
92 // Sets the controller version field to |version| or if |version| is NULL,
93 // clears the field.
94 void SetControllerVersionAttribute(ServiceWorkerVersion* version);
95
92 // Returns a handler for a request, the handler may return NULL if 96 // Returns a handler for a request, the handler may return NULL if
93 // the request doesn't require special handling. 97 // the request doesn't require special handling.
94 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler( 98 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler(
95 ResourceType resource_type, 99 ResourceType resource_type,
96 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, 100 base::WeakPtr<storage::BlobStorageContext> blob_storage_context,
97 scoped_refptr<ResourceRequestBody> body); 101 scoped_refptr<ResourceRequestBody> body);
98 102
99 // Returns true if |registration| can be associated with this provider. 103 // Returns true if |registration| can be associated with this provider.
100 bool CanAssociateRegistration(ServiceWorkerRegistration* registration); 104 bool CanAssociateRegistration(ServiceWorkerRegistration* registration);
101 105
(...skipping 20 matching lines...) Expand all
122 virtual void OnRegistrationFailed( 126 virtual void OnRegistrationFailed(
123 ServiceWorkerRegistration* registration) OVERRIDE; 127 ServiceWorkerRegistration* registration) OVERRIDE;
124 128
125 // Adds this provider host to the potential controllee list of the given 129 // Adds this provider host to the potential controllee list of the given
126 // versions and removes it from the previous versions. 130 // versions and removes it from the previous versions.
127 void UpdatePotentialControllees( 131 void UpdatePotentialControllees(
128 ServiceWorkerVersion* installing_version, 132 ServiceWorkerVersion* installing_version,
129 ServiceWorkerVersion* waiting_version, 133 ServiceWorkerVersion* waiting_version,
130 ServiceWorkerVersion* active_version); 134 ServiceWorkerVersion* active_version);
131 135
132 // Sets the controller version field to |version| or if |version| is NULL,
133 // clears the field.
134 void SetControllerVersionAttribute(ServiceWorkerVersion* version);
135
136 // Creates a ServiceWorkerHandle to retain |version| and returns a 136 // Creates a ServiceWorkerHandle to retain |version| and returns a
137 // ServiceWorkerInfo with the handle ID to pass to the provider. The 137 // ServiceWorkerInfo with the handle ID to pass to the provider. The
138 // provider is responsible for releasing the handle. 138 // provider is responsible for releasing the handle.
139 ServiceWorkerObjectInfo CreateHandleAndPass(ServiceWorkerVersion* version); 139 ServiceWorkerObjectInfo CreateHandleAndPass(ServiceWorkerVersion* version);
140 140
141 const int process_id_; 141 const int process_id_;
142 const int provider_id_; 142 const int provider_id_;
143 GURL document_url_; 143 GURL document_url_;
144 144
145 scoped_refptr<ServiceWorkerRegistration> associated_registration_; 145 scoped_refptr<ServiceWorkerRegistration> associated_registration_;
146 146
147 scoped_refptr<ServiceWorkerVersion> controlling_version_; 147 scoped_refptr<ServiceWorkerVersion> controlling_version_;
148 scoped_refptr<ServiceWorkerVersion> active_version_; 148 scoped_refptr<ServiceWorkerVersion> active_version_;
149 scoped_refptr<ServiceWorkerVersion> waiting_version_; 149 scoped_refptr<ServiceWorkerVersion> waiting_version_;
150 scoped_refptr<ServiceWorkerVersion> installing_version_; 150 scoped_refptr<ServiceWorkerVersion> installing_version_;
151 scoped_refptr<ServiceWorkerVersion> running_hosted_version_; 151 scoped_refptr<ServiceWorkerVersion> running_hosted_version_;
152 base::WeakPtr<ServiceWorkerContextCore> context_; 152 base::WeakPtr<ServiceWorkerContextCore> context_;
153 ServiceWorkerDispatcherHost* dispatcher_host_; 153 ServiceWorkerDispatcherHost* dispatcher_host_;
154 154
155 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); 155 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost);
156 }; 156 };
157 157
158 } // namespace content 158 } // namespace content
159 159
160 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ 160 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698