Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: components/domain_reliability/monitor.h

Issue 252613002: Domain Reliability: More security review. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 13 matching lines...) Expand all
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
32 // The top-level per-profile object that measures requests and hands off the 32 // The top-level per-profile object that measures requests and hands off the
33 // measurements to the proper |DomainReliabilityContext|. Referenced by the 33 // measurements to the proper |DomainReliabilityContext|. Referenced by the
34 // |ChromeNetworkDelegate|, which calls the On* methods. 34 // |ChromeNetworkDelegate|, which calls the On* methods.
Ryan Sleevi 2014/04/26 02:37:39 You're a component now, you don't get to talk abou
Deprecated (see juliatuttle) 2014/04/28 22:01:13 Done.
35 class DOMAIN_RELIABILITY_EXPORT DomainReliabilityMonitor { 35 class DOMAIN_RELIABILITY_EXPORT DomainReliabilityMonitor {
36 public: 36 public:
37 // NB: We don't take a URLRequestContextGetter because we already live on the 37 // NB: We don't take a URLRequestContextGetter because we already live on the
38 // I/O thread. 38 // I/O thread.
Ryan Sleevi 2014/04/26 02:37:39 NB: Pronouns in comments considered harmful :) ht
Deprecated (see juliatuttle) 2014/04/28 22:01:13 Done.
39 explicit DomainReliabilityMonitor( 39 explicit DomainReliabilityMonitor(
40 net::URLRequestContext* url_request_context); 40 net::URLRequestContext* url_request_context);
41 DomainReliabilityMonitor( 41 DomainReliabilityMonitor(net::URLRequestContext* url_request_context,
42 net::URLRequestContext* url_request_context, 42 scoped_ptr<MockableTime> time);
43 scoped_ptr<MockableTime> time);
44 ~DomainReliabilityMonitor(); 43 ~DomainReliabilityMonitor();
45 44
46 // Adds the "baked-in" configuration(s) for Google sites. 45 // Adds the "baked-in" configuration(s) for Google sites.
Ryan Sleevi 2014/04/26 02:37:39 // Add in configurations that have been configured
Deprecated (see juliatuttle) 2014/04/28 22:01:13 Done.
47 void AddBakedInConfigs(); 46 void AddBakedInConfigs();
48 47
49 // Should be called from the profile's NetworkDelegate on the corresponding 48 // Should be called from the profile's NetworkDelegate on the corresponding
50 // events: 49 // events:
Ryan Sleevi 2014/04/26 02:37:39 Components don't get to talk about profiles either
Deprecated (see juliatuttle) 2014/04/28 22:01:13 Done.
51 void OnBeforeRedirect(net::URLRequest* request); 50 void OnBeforeRedirect(net::URLRequest* request);
52 void OnCompleted(net::URLRequest* request, bool started); 51 void OnCompleted(net::URLRequest* request, bool started);
53 52
54 DomainReliabilityContext* AddContextForTesting( 53 DomainReliabilityContext* AddContextForTesting(
55 scoped_ptr<const DomainReliabilityConfig> config); 54 scoped_ptr<const DomainReliabilityConfig> config);
56 55
57 size_t contexts_size_for_testing() const { return contexts_.size(); } 56 size_t contexts_size_for_testing() const { return contexts_.size(); }
58 57
59 private: 58 private:
60 friend class DomainReliabilityMonitorTest; 59 friend class DomainReliabilityMonitorTest;
61 60
62 typedef std::map<std::string, DomainReliabilityContext*> ContextMap; 61 typedef std::map<std::string, DomainReliabilityContext*> ContextMap;
63 62
64 struct DOMAIN_RELIABILITY_EXPORT RequestInfo { 63 struct DOMAIN_RELIABILITY_EXPORT RequestInfo {
65 RequestInfo(); 64 RequestInfo();
66 RequestInfo(const net::URLRequest& request); 65 RequestInfo(const net::URLRequest& request);
Ryan Sleevi 2014/04/26 02:37:39 style: explicit
Deprecated (see juliatuttle) 2014/04/28 22:01:13 Done.
67 ~RequestInfo(); 66 ~RequestInfo();
68 67
69 bool DefinitelyReachedNetwork() const; 68 bool DefinitelyReachedNetwork() const;
70 69
71 GURL url; 70 GURL url;
72 net::URLRequestStatus status; 71 net::URLRequestStatus status;
73 int response_code; 72 int response_code;
74 net::HostPortPair socket_address; 73 net::HostPortPair socket_address;
75 net::LoadTimingInfo load_timing_info; 74 net::LoadTimingInfo load_timing_info;
76 bool was_cached; 75 bool was_cached;
77 int load_flags; 76 int load_flags;
78 }; 77 };
79 78
80 // Creates a context, adds it to the monitor, and returns a pointer to it. 79 // Creates a context, adds it to the monitor, and returns a pointer to it.
81 // (The pointer is only valid until the Monitor is destroyed.) 80 // (The pointer is only valid until the Monitor is destroyed.)
82 DomainReliabilityContext* AddContext( 81 DomainReliabilityContext* AddContext(
83 scoped_ptr<const DomainReliabilityConfig> config); 82 scoped_ptr<const DomainReliabilityConfig> config);
84 void OnRequestLegComplete(const RequestInfo& info); 83 void OnRequestLegComplete(const RequestInfo& info);
85 84
86 scoped_ptr<MockableTime> time_; 85 scoped_ptr<MockableTime> time_;
87 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 86 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
Ryan Sleevi 2014/04/26 02:37:39 You don't take one (because of threading), but you
Deprecated (see juliatuttle) 2014/04/28 22:01:13 URLFetcher requires a URLRequestContextGetter, sin
88 DomainReliabilityScheduler::Params scheduler_params_; 87 DomainReliabilityScheduler::Params scheduler_params_;
89 DomainReliabilityDispatcher dispatcher_; 88 DomainReliabilityDispatcher dispatcher_;
90 scoped_ptr<DomainReliabilityUploader> uploader_; 89 scoped_ptr<DomainReliabilityUploader> uploader_;
91 ContextMap contexts_; 90 ContextMap contexts_;
92 91
93 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityMonitor); 92 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityMonitor);
94 }; 93 };
95 94
96 } // namespace domain_reliability 95 } // namespace domain_reliability
97 96
98 #endif // COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ 97 #endif // COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698