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_VERSION_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 void DispatchActivateEvent(const StatusCallback& callback); | 143 void DispatchActivateEvent(const StatusCallback& callback); |
144 | 144 |
145 // Sends fetch event to the associated embedded worker and calls | 145 // Sends fetch event to the associated embedded worker and calls |
146 // |callback| with the response from the worker. | 146 // |callback| with the response from the worker. |
147 // | 147 // |
148 // This must be called when the status() is ACTIVE. Calling this in other | 148 // This must be called when the status() is ACTIVE. Calling this in other |
149 // statuses will result in an error SERVICE_WORKER_ERROR_FAILED. | 149 // statuses will result in an error SERVICE_WORKER_ERROR_FAILED. |
150 void DispatchFetchEvent(const ServiceWorkerFetchRequest& request, | 150 void DispatchFetchEvent(const ServiceWorkerFetchRequest& request, |
151 const FetchCallback& callback); | 151 const FetchCallback& callback); |
152 | 152 |
| 153 // Sends sync event to the associated embedded worker and asynchronously calls |
| 154 // |callback| when it errors out or it gets response from the worker to notify |
| 155 // completion. |
| 156 // |
| 157 // This must be called when the status() is ACTIVE. |
| 158 void DispatchSyncEvent(const StatusCallback& callback); |
| 159 |
153 // These are expected to be called when a renderer process host for the | 160 // These are expected to be called when a renderer process host for the |
154 // same-origin as for this ServiceWorkerVersion is created. The added | 161 // same-origin as for this ServiceWorkerVersion is created. The added |
155 // processes are used to run an in-renderer embedded worker. | 162 // processes are used to run an in-renderer embedded worker. |
156 void AddProcessToWorker(int process_id); | 163 void AddProcessToWorker(int process_id); |
157 void RemoveProcessToWorker(int process_id); | 164 void RemoveProcessToWorker(int process_id); |
158 | 165 |
159 EmbeddedWorkerInstance* embedded_worker() { return embedded_worker_.get(); } | 166 EmbeddedWorkerInstance* embedded_worker() { return embedded_worker_.get(); } |
160 | 167 |
161 // EmbeddedWorkerInstance::Observer overrides: | 168 // EmbeddedWorkerInstance::Observer overrides: |
162 virtual void OnStarted() OVERRIDE; | 169 virtual void OnStarted() OVERRIDE; |
(...skipping 24 matching lines...) Expand all Loading... |
187 IDMap<MessageCallback, IDMapOwnPointer> message_callbacks_; | 194 IDMap<MessageCallback, IDMapOwnPointer> message_callbacks_; |
188 | 195 |
189 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 196 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
190 | 197 |
191 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 198 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
192 }; | 199 }; |
193 | 200 |
194 } // namespace content | 201 } // namespace content |
195 | 202 |
196 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 203 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
OLD | NEW |