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

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

Issue 345583002: ServiceWorker: Add a function to abort all pending jobs in SWJobCoordinator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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_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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 // Registers a callback to be called when the promise would resolve (whether 47 // Registers a callback to be called when the promise would resolve (whether
48 // successfully or not). Multiple callbacks may be registered. If |process_id| 48 // successfully or not). Multiple callbacks may be registered. If |process_id|
49 // is not -1, it's added to the existing clients when deciding in which 49 // is not -1, it's added to the existing clients when deciding in which
50 // process to create the Service Worker instance. If there are no existing 50 // process to create the Service Worker instance. If there are no existing
51 // clients, a new RenderProcessHost will be created. 51 // clients, a new RenderProcessHost will be created.
52 void AddCallback(const RegistrationCallback& callback, int process_id); 52 void AddCallback(const RegistrationCallback& callback, int process_id);
53 53
54 // ServiceWorkerRegisterJobBase implementation: 54 // ServiceWorkerRegisterJobBase implementation:
55 virtual void Start() OVERRIDE; 55 virtual void Start() OVERRIDE;
56 virtual void Abort() OVERRIDE;
56 virtual bool Equals(ServiceWorkerRegisterJobBase* job) OVERRIDE; 57 virtual bool Equals(ServiceWorkerRegisterJobBase* job) OVERRIDE;
57 virtual RegistrationJobType GetType() OVERRIDE; 58 virtual RegistrationJobType GetType() OVERRIDE;
58 59
59 private: 60 private:
60 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProviderHostWaitingVersionTest, 61 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProviderHostWaitingVersionTest,
61 AssociateWaitingVersionToDocuments); 62 AssociateWaitingVersionToDocuments);
62 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProviderHostWaitingVersionTest, 63 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerProviderHostWaitingVersionTest,
63 DisassociateWaitingVersionFromDocuments); 64 DisassociateWaitingVersionFromDocuments);
64 65
65 enum Phase { 66 enum Phase {
66 INITIAL, 67 INITIAL,
67 START, 68 START,
68 REGISTER, 69 REGISTER,
69 UPDATE, 70 UPDATE,
70 INSTALL, 71 INSTALL,
71 STORE, 72 STORE,
72 ACTIVATE, 73 ACTIVATE,
73 COMPLETE 74 COMPLETE,
75 ABORT,
74 }; 76 };
75 77
76 // Holds internal state of ServiceWorkerRegistrationJob, to compel use of the 78 // Holds internal state of ServiceWorkerRegistrationJob, to compel use of the
77 // getter/setter functions. 79 // getter/setter functions.
78 struct Internal { 80 struct Internal {
79 Internal(); 81 Internal();
80 ~Internal(); 82 ~Internal();
81 scoped_refptr<ServiceWorkerRegistration> registration; 83 scoped_refptr<ServiceWorkerRegistration> registration;
82 84
83 // Holds 'installing' or 'waiting' version depending on the phase. 85 // Holds 'installing' or 'waiting' version depending on the phase.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_; 135 scoped_refptr<ServiceWorkerRegistration> promise_resolved_registration_;
134 scoped_refptr<ServiceWorkerVersion> promise_resolved_version_; 136 scoped_refptr<ServiceWorkerVersion> promise_resolved_version_;
135 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_; 137 base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_;
136 138
137 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob); 139 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob);
138 }; 140 };
139 141
140 } // namespace content 142 } // namespace content
141 143
142 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_ 144 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698