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 COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ | 5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ |
6 #define COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ | 6 #define COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "components/domain_reliability/beacon.h" | 15 #include "components/domain_reliability/beacon.h" |
16 #include "components/domain_reliability/clear_mode.h" | 16 #include "components/domain_reliability/clear_mode.h" |
17 #include "components/domain_reliability/config.h" | 17 #include "components/domain_reliability/config.h" |
18 #include "components/domain_reliability/context.h" | 18 #include "components/domain_reliability/context.h" |
19 #include "components/domain_reliability/context_manager.h" | 19 #include "components/domain_reliability/context_manager.h" |
20 #include "components/domain_reliability/dispatcher.h" | 20 #include "components/domain_reliability/dispatcher.h" |
21 #include "components/domain_reliability/domain_reliability_export.h" | 21 #include "components/domain_reliability/domain_reliability_export.h" |
22 #include "components/domain_reliability/scheduler.h" | 22 #include "components/domain_reliability/scheduler.h" |
23 #include "components/domain_reliability/uploader.h" | 23 #include "components/domain_reliability/uploader.h" |
24 #include "components/domain_reliability/util.h" | 24 #include "components/domain_reliability/util.h" |
25 #include "net/base/load_timing_info.h" | 25 #include "net/base/load_timing_info.h" |
26 #include "net/base/network_change_notifier.h" | 26 #include "net/base/network_change_notifier.h" |
27 #include "net/http/http_response_info.h" | 27 #include "net/http/http_response_info.h" |
| 28 #include "net/socket/connection_attempts.h" |
28 #include "net/url_request/url_request_status.h" | 29 #include "net/url_request/url_request_status.h" |
29 | 30 |
30 namespace base { | 31 namespace base { |
31 class ThreadChecker; | 32 class ThreadChecker; |
32 class Value; | 33 class Value; |
33 } // namespace base | 34 } // namespace base |
34 | 35 |
35 namespace net { | 36 namespace net { |
36 class URLRequest; | 37 class URLRequest; |
37 class URLRequestContext; | 38 class URLRequestContext; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // Allow the Service to call |MakeWeakPtr|. | 131 // Allow the Service to call |MakeWeakPtr|. |
131 friend class DomainReliabilityServiceImpl; | 132 friend class DomainReliabilityServiceImpl; |
132 | 133 |
133 typedef std::map<std::string, DomainReliabilityContext*> ContextMap; | 134 typedef std::map<std::string, DomainReliabilityContext*> ContextMap; |
134 | 135 |
135 struct DOMAIN_RELIABILITY_EXPORT RequestInfo { | 136 struct DOMAIN_RELIABILITY_EXPORT RequestInfo { |
136 RequestInfo(); | 137 RequestInfo(); |
137 explicit RequestInfo(const net::URLRequest& request); | 138 explicit RequestInfo(const net::URLRequest& request); |
138 ~RequestInfo(); | 139 ~RequestInfo(); |
139 | 140 |
140 bool AccessedNetwork() const; | 141 static bool ShouldReportRequest(const RequestInfo& request); |
141 | 142 |
142 GURL url; | 143 GURL url; |
143 net::URLRequestStatus status; | 144 net::URLRequestStatus status; |
144 net::HttpResponseInfo response_info; | 145 net::HttpResponseInfo response_info; |
145 int load_flags; | 146 int load_flags; |
146 net::LoadTimingInfo load_timing_info; | 147 net::LoadTimingInfo load_timing_info; |
| 148 net::ConnectionAttempts connection_attempts; |
147 bool is_upload; | 149 bool is_upload; |
148 }; | 150 }; |
149 | 151 |
150 void OnRequestLegComplete(const RequestInfo& info); | 152 void OnRequestLegComplete(const RequestInfo& info); |
151 | 153 |
152 bool OnPrefThread() const { | 154 bool OnPrefThread() const { |
153 return pref_task_runner_->BelongsToCurrentThread(); | 155 return pref_task_runner_->BelongsToCurrentThread(); |
154 } | 156 } |
155 bool OnNetworkThread() const { | 157 bool OnNetworkThread() const { |
156 return network_task_runner_->BelongsToCurrentThread(); | 158 return network_task_runner_->BelongsToCurrentThread(); |
(...skipping 16 matching lines...) Expand all Loading... |
173 bool discard_uploads_set_; | 175 bool discard_uploads_set_; |
174 | 176 |
175 base::WeakPtrFactory<DomainReliabilityMonitor> weak_factory_; | 177 base::WeakPtrFactory<DomainReliabilityMonitor> weak_factory_; |
176 | 178 |
177 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityMonitor); | 179 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityMonitor); |
178 }; | 180 }; |
179 | 181 |
180 } // namespace domain_reliability | 182 } // namespace domain_reliability |
181 | 183 |
182 #endif // COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ | 184 #endif // COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ |
OLD | NEW |