| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_FETCH_DISPATCHER_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_DISPATCHER_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_DISPATCHER_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 const FetchCallback& fetch_callback); | 37 const FetchCallback& fetch_callback); |
| 38 ~ServiceWorkerFetchDispatcher(); | 38 ~ServiceWorkerFetchDispatcher(); |
| 39 | 39 |
| 40 // Dispatches a fetch event to the |version| given in ctor, and fires | 40 // Dispatches a fetch event to the |version| given in ctor, and fires |
| 41 // |fetch_callback| (also given in ctor) when finishes. It runs | 41 // |fetch_callback| (also given in ctor) when finishes. It runs |
| 42 // |prepare_callback| as an intermediate step once the version is activated | 42 // |prepare_callback| as an intermediate step once the version is activated |
| 43 // and running. | 43 // and running. |
| 44 void Run(); | 44 void Run(); |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 class ResponseCallback; |
| 48 |
| 47 void DidWaitForActivation(); | 49 void DidWaitForActivation(); |
| 48 void StartWorker(); | 50 void StartWorker(); |
| 49 void DidStartWorker(); | 51 void DidStartWorker(); |
| 50 void DidFailToStartWorker(ServiceWorkerStatusCode status); | 52 void DidFailToStartWorker(ServiceWorkerStatusCode status); |
| 51 void DispatchFetchEvent(); | 53 void DispatchFetchEvent(); |
| 52 void DidFailToDispatch(ServiceWorkerStatusCode status); | 54 void DidFailToDispatch(ServiceWorkerStatusCode status); |
| 53 void DidFail(ServiceWorkerStatusCode status); | 55 void DidFail(ServiceWorkerStatusCode status); |
| 54 void DidFinish(int request_id, | 56 void DidFinish(int request_id, |
| 55 ServiceWorkerFetchEventResult fetch_result, | 57 ServiceWorkerFetchEventResult fetch_result, |
| 56 const ServiceWorkerResponse& response); | 58 const ServiceWorkerResponse& response); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 68 ResourceType resource_type_; | 70 ResourceType resource_type_; |
| 69 bool did_complete_; | 71 bool did_complete_; |
| 70 base::WeakPtrFactory<ServiceWorkerFetchDispatcher> weak_factory_; | 72 base::WeakPtrFactory<ServiceWorkerFetchDispatcher> weak_factory_; |
| 71 | 73 |
| 72 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerFetchDispatcher); | 74 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerFetchDispatcher); |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 } // namespace content | 77 } // namespace content |
| 76 | 78 |
| 77 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_DISPATCHER_H_ | 79 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_DISPATCHER_H_ |
| OLD | NEW |