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/time/time.h" | 11 #include "base/time/time.h" |
12 #include "components/domain_reliability/beacon.h" | 12 #include "components/domain_reliability/beacon.h" |
13 #include "components/domain_reliability/config.h" | 13 #include "components/domain_reliability/config.h" |
14 #include "components/domain_reliability/context.h" | 14 #include "components/domain_reliability/context.h" |
15 #include "components/domain_reliability/dispatcher.h" | 15 #include "components/domain_reliability/dispatcher.h" |
16 #include "components/domain_reliability/domain_reliability_export.h" | 16 #include "components/domain_reliability/domain_reliability_export.h" |
17 #include "components/domain_reliability/scheduler.h" | 17 #include "components/domain_reliability/scheduler.h" |
18 #include "components/domain_reliability/uploader.h" | 18 #include "components/domain_reliability/uploader.h" |
19 #include "components/domain_reliability/util.h" | 19 #include "components/domain_reliability/util.h" |
20 #include "net/base/host_port_pair.h" | |
21 #include "net/base/load_timing_info.h" | 20 #include "net/base/load_timing_info.h" |
| 21 #include "net/http/http_response_info.h" |
22 #include "net/url_request/url_request_status.h" | 22 #include "net/url_request/url_request_status.h" |
23 | 23 |
24 namespace net { | 24 namespace net { |
25 class URLRequest; | 25 class URLRequest; |
26 class URLRequestContext; | 26 class URLRequestContext; |
27 class URLRequestContextGetter; | 27 class URLRequestContextGetter; |
28 } | 28 } |
29 | 29 |
30 namespace domain_reliability { | 30 namespace domain_reliability { |
31 | 31 |
(...skipping 30 matching lines...) Expand all Loading... |
62 private: | 62 private: |
63 friend class DomainReliabilityMonitorTest; | 63 friend class DomainReliabilityMonitorTest; |
64 | 64 |
65 typedef std::map<std::string, DomainReliabilityContext*> ContextMap; | 65 typedef std::map<std::string, DomainReliabilityContext*> ContextMap; |
66 | 66 |
67 struct DOMAIN_RELIABILITY_EXPORT RequestInfo { | 67 struct DOMAIN_RELIABILITY_EXPORT RequestInfo { |
68 RequestInfo(); | 68 RequestInfo(); |
69 explicit RequestInfo(const net::URLRequest& request); | 69 explicit RequestInfo(const net::URLRequest& request); |
70 ~RequestInfo(); | 70 ~RequestInfo(); |
71 | 71 |
72 bool DefinitelyReachedNetwork() const; | 72 bool AccessedNetwork() const; |
73 | 73 |
74 GURL url; | 74 GURL url; |
75 net::URLRequestStatus status; | 75 net::URLRequestStatus status; |
76 int response_code; | 76 net::HttpResponseInfo response_info; |
77 net::HostPortPair socket_address; | 77 int load_flags; |
78 net::LoadTimingInfo load_timing_info; | 78 net::LoadTimingInfo load_timing_info; |
79 bool was_cached; | |
80 int load_flags; | |
81 bool is_upload; | 79 bool is_upload; |
82 }; | 80 }; |
83 | 81 |
84 // Creates a context, adds it to the monitor, and returns a pointer to it. | 82 // Creates a context, adds it to the monitor, and returns a pointer to it. |
85 // (The pointer is only valid until the Monitor is destroyed.) | 83 // (The pointer is only valid until the Monitor is destroyed.) |
86 DomainReliabilityContext* AddContext( | 84 DomainReliabilityContext* AddContext( |
87 scoped_ptr<const DomainReliabilityConfig> config); | 85 scoped_ptr<const DomainReliabilityConfig> config); |
88 void OnRequestLegComplete(const RequestInfo& info); | 86 void OnRequestLegComplete(const RequestInfo& info); |
89 | 87 |
90 scoped_ptr<MockableTime> time_; | 88 scoped_ptr<MockableTime> time_; |
91 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 89 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
92 const std::string upload_reporter_string_; | 90 const std::string upload_reporter_string_; |
93 DomainReliabilityScheduler::Params scheduler_params_; | 91 DomainReliabilityScheduler::Params scheduler_params_; |
94 DomainReliabilityDispatcher dispatcher_; | 92 DomainReliabilityDispatcher dispatcher_; |
95 scoped_ptr<DomainReliabilityUploader> uploader_; | 93 scoped_ptr<DomainReliabilityUploader> uploader_; |
96 ContextMap contexts_; | 94 ContextMap contexts_; |
97 | 95 |
98 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityMonitor); | 96 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityMonitor); |
99 }; | 97 }; |
100 | 98 |
101 } // namespace domain_reliability | 99 } // namespace domain_reliability |
102 | 100 |
103 #endif // COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ | 101 #endif // COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ |
OLD | NEW |