OLD | NEW |
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_REGISTER_JOB_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 const GURL& pattern, | 48 const GURL& pattern, |
49 const GURL& script_url); | 49 const GURL& script_url); |
50 | 50 |
51 // For update jobs. | 51 // For update jobs. |
52 CONTENT_EXPORT ServiceWorkerRegisterJob( | 52 CONTENT_EXPORT ServiceWorkerRegisterJob( |
53 base::WeakPtr<ServiceWorkerContextCore> context, | 53 base::WeakPtr<ServiceWorkerContextCore> context, |
54 ServiceWorkerRegistration* registration); | 54 ServiceWorkerRegistration* registration); |
55 virtual ~ServiceWorkerRegisterJob(); | 55 virtual ~ServiceWorkerRegisterJob(); |
56 | 56 |
57 // Registers a callback to be called when the promise would resolve (whether | 57 // Registers a callback to be called when the promise would resolve (whether |
58 // successfully or not). Multiple callbacks may be registered. If |process_id| | 58 // successfully or not). Multiple callbacks may be registered. |
59 // is not -1, it's added to the existing clients when deciding in which | 59 // If |provider_host| is not NULL, its process will be regarded as a candidate |
60 // process to create the Service Worker instance. If there are no existing | 60 // process to run the worker. |
61 // clients, a new RenderProcessHost will be created. | 61 void AddCallback(const RegistrationCallback& callback, |
62 void AddCallback(const RegistrationCallback& callback, int process_id); | 62 ServiceWorkerProviderHost* provider_host); |
63 | 63 |
64 // ServiceWorkerRegisterJobBase implementation: | 64 // ServiceWorkerRegisterJobBase implementation: |
65 virtual void Start() OVERRIDE; | 65 virtual void Start() OVERRIDE; |
66 virtual void Abort() OVERRIDE; | 66 virtual void Abort() OVERRIDE; |
67 virtual bool Equals(ServiceWorkerRegisterJobBase* job) OVERRIDE; | 67 virtual bool Equals(ServiceWorkerRegisterJobBase* job) OVERRIDE; |
68 virtual RegistrationJobType GetType() OVERRIDE; | 68 virtual RegistrationJobType GetType() OVERRIDE; |
69 | 69 |
70 private: | 70 private: |
71 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProviderHostWaitingVersionTest, | 71 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProviderHostWaitingVersionTest, |
72 AssociateInstallingVersionToDocuments); | 72 AssociateInstallingVersionToDocuments); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 void AssociateProviderHostsToRegistration( | 151 void AssociateProviderHostsToRegistration( |
152 ServiceWorkerRegistration* registration); | 152 ServiceWorkerRegistration* registration); |
153 | 153 |
154 // The ServiceWorkerContextCore object should always outlive this. | 154 // The ServiceWorkerContextCore object should always outlive this. |
155 base::WeakPtr<ServiceWorkerContextCore> context_; | 155 base::WeakPtr<ServiceWorkerContextCore> context_; |
156 | 156 |
157 RegistrationJobType job_type_; | 157 RegistrationJobType job_type_; |
158 const GURL pattern_; | 158 const GURL pattern_; |
159 const GURL script_url_; | 159 const GURL script_url_; |
160 std::vector<RegistrationCallback> callbacks_; | 160 std::vector<RegistrationCallback> callbacks_; |
161 std::vector<int> pending_process_ids_; | |
162 Phase phase_; | 161 Phase phase_; |
163 Internal internal_; | 162 Internal internal_; |
164 bool is_promise_resolved_; | 163 bool is_promise_resolved_; |
165 ServiceWorkerStatusCode promise_resolved_status_; | 164 ServiceWorkerStatusCode promise_resolved_status_; |
166 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; | 165 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; |
167 scoped_refptr<ServiceWorkerVersion> promise_resolved_version_; | 166 scoped_refptr<ServiceWorkerVersion> promise_resolved_version_; |
168 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; | 167 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; |
169 | 168 |
170 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); | 169 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); |
171 }; | 170 }; |
172 | 171 |
173 } // namespace content | 172 } // namespace content |
174 | 173 |
175 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ | 174 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ |
OLD | NEW |