| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 ServiceWorkerVersion* version, | 45 ServiceWorkerVersion* version, |
| 46 ResourceType resource_type, | 46 ResourceType resource_type, |
| 47 const base::Optional<base::TimeDelta>& timeout, | 47 const base::Optional<base::TimeDelta>& timeout, |
| 48 const net::NetLogWithSource& net_log, | 48 const net::NetLogWithSource& net_log, |
| 49 const base::Closure& prepare_callback, | 49 const base::Closure& prepare_callback, |
| 50 const FetchCallback& fetch_callback); | 50 const FetchCallback& fetch_callback); |
| 51 ~ServiceWorkerFetchDispatcher(); | 51 ~ServiceWorkerFetchDispatcher(); |
| 52 | 52 |
| 53 // If appropriate, starts the navigation preload request and creates | 53 // If appropriate, starts the navigation preload request and creates |
| 54 // |preload_handle_|. Returns true if it started navigation preload. | 54 // |preload_handle_|. Returns true if it started navigation preload. |
| 55 bool MaybeStartNavigationPreload(net::URLRequest* original_request); | 55 // |on_response| is invoked in OnReceiveResponse(). |
| 56 bool MaybeStartNavigationPreload(net::URLRequest* original_request, |
| 57 base::OnceClosure on_response); |
| 56 | 58 |
| 57 // Dispatches a fetch event to the |version| given in ctor, and fires | 59 // Dispatches a fetch event to the |version| given in ctor, and fires |
| 58 // |fetch_callback| (also given in ctor) when finishes. It runs | 60 // |fetch_callback| (also given in ctor) when finishes. It runs |
| 59 // |prepare_callback| as an intermediate step once the version is activated | 61 // |prepare_callback| as an intermediate step once the version is activated |
| 60 // and running. | 62 // and running. |
| 61 void Run(); | 63 void Run(); |
| 62 | 64 |
| 63 private: | 65 private: |
| 64 class ResponseCallback; | 66 class ResponseCallback; |
| 65 class URLLoaderAssets; | 67 class URLLoaderAssets; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 mojom::FetchEventPreloadHandlePtr preload_handle_; | 103 mojom::FetchEventPreloadHandlePtr preload_handle_; |
| 102 | 104 |
| 103 base::WeakPtrFactory<ServiceWorkerFetchDispatcher> weak_factory_; | 105 base::WeakPtrFactory<ServiceWorkerFetchDispatcher> weak_factory_; |
| 104 | 106 |
| 105 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerFetchDispatcher); | 107 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerFetchDispatcher); |
| 106 }; | 108 }; |
| 107 | 109 |
| 108 } // namespace content | 110 } // namespace content |
| 109 | 111 |
| 110 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_DISPATCHER_H_ | 112 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_DISPATCHER_H_ |
| OLD | NEW |