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

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

Issue 825383004: ServiceWorker: Send state change events via SWProviderHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unnecessary error handling Created 5 years, 11 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
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // the request doesn't require special handling. 108 // the request doesn't require special handling.
109 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler( 109 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler(
110 FetchRequestMode request_mode, 110 FetchRequestMode request_mode,
111 FetchCredentialsMode credentials_mode, 111 FetchCredentialsMode credentials_mode,
112 ResourceType resource_type, 112 ResourceType resource_type,
113 RequestContextType request_context_type, 113 RequestContextType request_context_type,
114 RequestContextFrameType frame_type, 114 RequestContextFrameType frame_type,
115 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, 115 base::WeakPtr<storage::BlobStorageContext> blob_storage_context,
116 scoped_refptr<ResourceRequestBody> body); 116 scoped_refptr<ResourceRequestBody> body);
117 117
118 // Creates a ServiceWorkerHandle to retain |version| and returns a
119 // ServiceWorkerInfo with a newly created handle ID. The handle is held in
120 // the dispatcher host until its ref-count becomes zero via
121 // OnDecrementServiceWorkerRefCount.
kinuko 2015/01/22 06:30:52 nit: 'via OnDecrementServiceWorkerRefCount' part c
nhiroki 2015/01/22 07:05:58 Done.
122 ServiceWorkerObjectInfo CreateAndRegisterServiceWorkerHandle(
123 ServiceWorkerVersion* version);
124
118 // Returns true if |registration| can be associated with this provider. 125 // Returns true if |registration| can be associated with this provider.
119 bool CanAssociateRegistration(ServiceWorkerRegistration* registration); 126 bool CanAssociateRegistration(ServiceWorkerRegistration* registration);
120 127
121 // For use by the ServiceWorkerControlleeRequestHandler to disallow 128 // For use by the ServiceWorkerControlleeRequestHandler to disallow
122 // new registration association while a navigation is occurring and 129 // new registration association while a navigation is occurring and
123 // an existing registration is being looked for. 130 // an existing registration is being looked for.
124 void SetAllowAssociation(bool allow) { allow_association_ = allow; } 131 void SetAllowAssociation(bool allow) { allow_association_ = allow; }
125 132
126 // Returns true if the context referred to by this host (i.e. |context_|) is 133 // Returns true if the context referred to by this host (i.e. |context_|) is
127 // still alive. 134 // still alive.
(...skipping 20 matching lines...) Expand all
148 void PrepareForCrossSiteTransfer(); 155 void PrepareForCrossSiteTransfer();
149 void CompleteCrossSiteTransfer( 156 void CompleteCrossSiteTransfer(
150 int new_process_id, 157 int new_process_id,
151 int new_frame_id, 158 int new_frame_id,
152 int new_provider_id, 159 int new_provider_id,
153 ServiceWorkerDispatcherHost* dispatcher_host); 160 ServiceWorkerDispatcherHost* dispatcher_host);
154 ServiceWorkerDispatcherHost* dispatcher_host() const { 161 ServiceWorkerDispatcherHost* dispatcher_host() const {
155 return dispatcher_host_; 162 return dispatcher_host_;
156 } 163 }
157 164
165 // Called from ServiceWorkerRegistrationHandle.
166 void SendUpdateFoundMessage(
167 const ServiceWorkerRegistrationObjectInfo& object_info);
168 void SendSetVersionAttributesMessage(
169 int registration_handle_id,
170 ChangedVersionAttributesMask changed_mask,
171 ServiceWorkerVersion* installing_version,
172 ServiceWorkerVersion* waiting_version,
173 ServiceWorkerVersion* active_version);
174
175 // Called from ServiceWorkerHandle.
176 void SendServiceWorkerStateChangedMessage(
177 int worker_handle_id,
178 blink::WebServiceWorkerState state);
179
158 private: 180 private:
159 friend class ServiceWorkerProviderHostTest; 181 friend class ServiceWorkerProviderHostTest;
160 friend class ServiceWorkerWriteToCacheJobTest; 182 friend class ServiceWorkerWriteToCacheJobTest;
161 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, 183 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest,
162 UpdateBefore24Hours); 184 UpdateBefore24Hours);
163 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, 185 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest,
164 UpdateAfter24Hours); 186 UpdateAfter24Hours);
165 187
166 // ServiceWorkerRegistration::Listener overrides. 188 // ServiceWorkerRegistration::Listener overrides.
167 void OnRegistrationFailed(ServiceWorkerRegistration* registration) override; 189 void OnRegistrationFailed(ServiceWorkerRegistration* registration) override;
(...skipping 23 matching lines...) Expand all
191 base::WeakPtr<ServiceWorkerContextCore> context_; 213 base::WeakPtr<ServiceWorkerContextCore> context_;
192 ServiceWorkerDispatcherHost* dispatcher_host_; 214 ServiceWorkerDispatcherHost* dispatcher_host_;
193 bool allow_association_; 215 bool allow_association_;
194 216
195 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); 217 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost);
196 }; 218 };
197 219
198 } // namespace content 220 } // namespace content
199 221
200 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ 222 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698