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

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

Issue 845313004: Service Worker: Improve error messages from register(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git-cl format 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_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 20 matching lines...) Expand all
31 // - firing the 'install' event at the ServiceWorkerVersion 31 // - firing the 'install' event at the ServiceWorkerVersion
32 // - firing the 'activate' event at the ServiceWorkerVersion 32 // - firing the 'activate' event at the ServiceWorkerVersion
33 // - waiting for older ServiceWorkerVersions to deactivate 33 // - waiting for older ServiceWorkerVersions to deactivate
34 // - designating the new version to be the 'active' version 34 // - designating the new version to be the 'active' version
35 // - updating storage 35 // - updating storage
36 class ServiceWorkerRegisterJob : public ServiceWorkerRegisterJobBase, 36 class ServiceWorkerRegisterJob : public ServiceWorkerRegisterJobBase,
37 public EmbeddedWorkerInstance::Listener, 37 public EmbeddedWorkerInstance::Listener,
38 public ServiceWorkerRegistration::Listener { 38 public ServiceWorkerRegistration::Listener {
39 public: 39 public:
40 typedef base::Callback<void(ServiceWorkerStatusCode status, 40 typedef base::Callback<void(ServiceWorkerStatusCode status,
41 const std::string& status_message,
41 ServiceWorkerRegistration* registration)> 42 ServiceWorkerRegistration* registration)>
42 RegistrationCallback; 43 RegistrationCallback;
43 44
44 // For registration jobs. 45 // For registration jobs.
45 CONTENT_EXPORT ServiceWorkerRegisterJob( 46 CONTENT_EXPORT ServiceWorkerRegisterJob(
46 base::WeakPtr<ServiceWorkerContextCore> context, 47 base::WeakPtr<ServiceWorkerContextCore> context,
47 const GURL& pattern, 48 const GURL& pattern,
48 const GURL& script_url); 49 const GURL& script_url);
49 50
50 // For update jobs. 51 // For update jobs.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 const scoped_refptr<ServiceWorkerRegistration>& existing_registration, 125 const scoped_refptr<ServiceWorkerRegistration>& existing_registration,
125 ServiceWorkerStatusCode status); 126 ServiceWorkerStatusCode status);
126 void UpdateAndContinue(); 127 void UpdateAndContinue();
127 void OnStartWorkerFinished(ServiceWorkerStatusCode status); 128 void OnStartWorkerFinished(ServiceWorkerStatusCode status);
128 void OnStoreRegistrationComplete(ServiceWorkerStatusCode status); 129 void OnStoreRegistrationComplete(ServiceWorkerStatusCode status);
129 void InstallAndContinue(); 130 void InstallAndContinue();
130 void OnInstallFinished(ServiceWorkerStatusCode status); 131 void OnInstallFinished(ServiceWorkerStatusCode status);
131 void ActivateAndContinue(); 132 void ActivateAndContinue();
132 void OnActivateFinished(ServiceWorkerStatusCode status); 133 void OnActivateFinished(ServiceWorkerStatusCode status);
133 void Complete(ServiceWorkerStatusCode status); 134 void Complete(ServiceWorkerStatusCode status);
134 void CompleteInternal(ServiceWorkerStatusCode status); 135 void Complete(ServiceWorkerStatusCode status,
136 const std::string& status_message);
137 void CompleteInternal(ServiceWorkerStatusCode status,
138 const std::string& status_message);
135 void ResolvePromise(ServiceWorkerStatusCode status, 139 void ResolvePromise(ServiceWorkerStatusCode status,
140 const std::string& status_message,
136 ServiceWorkerRegistration* registration); 141 ServiceWorkerRegistration* registration);
137 142
138 // EmbeddedWorkerInstance::Listener override of OnPausedAfterDownload. 143 // EmbeddedWorkerInstance::Listener override of OnPausedAfterDownload.
139 void OnPausedAfterDownload() override; 144 void OnPausedAfterDownload() override;
140 bool OnMessageReceived(const IPC::Message& message) override; 145 bool OnMessageReceived(const IPC::Message& message) override;
141 146
142 // ServiceWorkerRegistration::Listener overrides 147 // ServiceWorkerRegistration::Listener overrides
143 void OnRegistrationFinishedUninstalling( 148 void OnRegistrationFinishedUninstalling(
144 ServiceWorkerRegistration* registration) override; 149 ServiceWorkerRegistration* registration) override;
145 150
146 void OnCompareScriptResourcesComplete( 151 void OnCompareScriptResourcesComplete(
147 ServiceWorkerStatusCode status, 152 ServiceWorkerStatusCode status,
148 bool are_equal); 153 bool are_equal);
149 154
150 void AssociateProviderHostsToRegistration( 155 void AssociateProviderHostsToRegistration(
151 ServiceWorkerRegistration* registration); 156 ServiceWorkerRegistration* registration);
152 157
153 // The ServiceWorkerContextCore object should always outlive this. 158 // The ServiceWorkerContextCore object should always outlive this.
154 base::WeakPtr<ServiceWorkerContextCore> context_; 159 base::WeakPtr<ServiceWorkerContextCore> context_;
155 160
156 RegistrationJobType job_type_; 161 RegistrationJobType job_type_;
157 const GURL pattern_; 162 const GURL pattern_;
158 const GURL script_url_; 163 const GURL script_url_;
159 std::vector<RegistrationCallback> callbacks_; 164 std::vector<RegistrationCallback> callbacks_;
160 Phase phase_; 165 Phase phase_;
161 Internal internal_; 166 Internal internal_;
162 bool doom_installing_worker_; 167 bool doom_installing_worker_;
163 bool is_promise_resolved_; 168 bool is_promise_resolved_;
164 ServiceWorkerStatusCode promise_resolved_status_; 169 ServiceWorkerStatusCode promise_resolved_status_;
170 std::string promise_resolved_status_message_;
165 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; 171 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_;
166 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; 172 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_;
167 173
168 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); 174 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob);
169 }; 175 };
170 176
171 } // namespace content 177 } // namespace content
172 178
173 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ 179 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698