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

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

Issue 443593002: ServiceWorker: Move worker candidate process knowledge to ServiceWorkerProcessManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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_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
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, it's added to the pending provider host
60 // process to create the Service Worker instance. If there are no existing 60 // list which will provide process to create the Service Worker instance.
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 virtual void OnRegistrationFinishedUninstalling( 141 virtual void OnRegistrationFinishedUninstalling(
142 ServiceWorkerRegistration* registration) OVERRIDE; 142 ServiceWorkerRegistration* registration) OVERRIDE;
143 143
144 void OnCompareScriptResourcesComplete( 144 void OnCompareScriptResourcesComplete(
145 ServiceWorkerVersion* most_recent_version, 145 ServiceWorkerVersion* most_recent_version,
146 ServiceWorkerStatusCode status, 146 ServiceWorkerStatusCode status,
147 bool are_equal); 147 bool are_equal);
148 148
149 void AssociateProviderHostsToRegistration( 149 void AssociateProviderHostsToRegistration(
150 ServiceWorkerRegistration* registration); 150 ServiceWorkerRegistration* registration);
151 void AssociateProviderHostsToPendingRegistration(
152 ServiceWorkerRegistration* registration);
151 153
152 // The ServiceWorkerContextCore object should always outlive this. 154 // The ServiceWorkerContextCore object should always outlive this.
153 base::WeakPtr<ServiceWorkerContextCore> context_; 155 base::WeakPtr<ServiceWorkerContextCore> context_;
154 156
155 RegistrationJobType job_type_; 157 RegistrationJobType job_type_;
156 const GURL pattern_; 158 const GURL pattern_;
157 const GURL script_url_; 159 const GURL script_url_;
158 std::vector<RegistrationCallback> callbacks_; 160 std::vector<RegistrationCallback> callbacks_;
159 std::vector<int> pending_process_ids_; 161 std::vector<base::WeakPtr<ServiceWorkerProviderHost> >
162 pending_provider_hosts_;
160 Phase phase_; 163 Phase phase_;
161 Internal internal_; 164 Internal internal_;
162 bool is_promise_resolved_; 165 bool is_promise_resolved_;
163 ServiceWorkerStatusCode promise_resolved_status_; 166 ServiceWorkerStatusCode promise_resolved_status_;
164 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; 167 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_;
165 scoped_refptr<ServiceWorkerVersion> promise_resolved_version_; 168 scoped_refptr<ServiceWorkerVersion> promise_resolved_version_;
166 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; 169 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_;
167 170
168 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); 171 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob);
169 }; 172 };
170 173
171 } // namespace content 174 } // namespace content
172 175
173 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ 176 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698