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 14 matching lines...) Expand all Loading... |
25 typedef base::Callback<void(ServiceWorkerStatusCode, | 25 typedef base::Callback<void(ServiceWorkerStatusCode, |
26 ServiceWorkerFetchEventResult, | 26 ServiceWorkerFetchEventResult, |
27 const ServiceWorkerResponse&, | 27 const ServiceWorkerResponse&, |
28 const scoped_refptr<ServiceWorkerVersion>&)> | 28 const scoped_refptr<ServiceWorkerVersion>&)> |
29 FetchCallback; | 29 FetchCallback; |
30 | 30 |
31 ServiceWorkerFetchDispatcher( | 31 ServiceWorkerFetchDispatcher( |
32 std::unique_ptr<ServiceWorkerFetchRequest> request, | 32 std::unique_ptr<ServiceWorkerFetchRequest> request, |
33 ServiceWorkerVersion* version, | 33 ServiceWorkerVersion* version, |
34 ResourceType resource_type, | 34 ResourceType resource_type, |
35 const net::BoundNetLog& net_log, | 35 const net::NetLogWithSource& net_log, |
36 const base::Closure& prepare_callback, | 36 const base::Closure& prepare_callback, |
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 |
(...skipping 10 matching lines...) Expand all Loading... |
56 void DidFinish(int request_id, | 56 void DidFinish(int request_id, |
57 ServiceWorkerFetchEventResult fetch_result, | 57 ServiceWorkerFetchEventResult fetch_result, |
58 const ServiceWorkerResponse& response); | 58 const ServiceWorkerResponse& response); |
59 void Complete(ServiceWorkerStatusCode status, | 59 void Complete(ServiceWorkerStatusCode status, |
60 ServiceWorkerFetchEventResult fetch_result, | 60 ServiceWorkerFetchEventResult fetch_result, |
61 const ServiceWorkerResponse& response); | 61 const ServiceWorkerResponse& response); |
62 | 62 |
63 ServiceWorkerMetrics::EventType GetEventType() const; | 63 ServiceWorkerMetrics::EventType GetEventType() const; |
64 | 64 |
65 scoped_refptr<ServiceWorkerVersion> version_; | 65 scoped_refptr<ServiceWorkerVersion> version_; |
66 net::BoundNetLog net_log_; | 66 net::NetLogWithSource net_log_; |
67 base::Closure prepare_callback_; | 67 base::Closure prepare_callback_; |
68 FetchCallback fetch_callback_; | 68 FetchCallback fetch_callback_; |
69 std::unique_ptr<ServiceWorkerFetchRequest> request_; | 69 std::unique_ptr<ServiceWorkerFetchRequest> request_; |
70 ResourceType resource_type_; | 70 ResourceType resource_type_; |
71 bool did_complete_; | 71 bool did_complete_; |
72 base::WeakPtrFactory<ServiceWorkerFetchDispatcher> weak_factory_; | 72 base::WeakPtrFactory<ServiceWorkerFetchDispatcher> weak_factory_; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerFetchDispatcher); | 74 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerFetchDispatcher); |
75 }; | 75 }; |
76 | 76 |
77 } // namespace content | 77 } // namespace content |
78 | 78 |
79 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_DISPATCHER_H_ | 79 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_FETCH_DISPATCHER_H_ |
OLD | NEW |