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

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, 7 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 11 matching lines...) Expand all
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
32 // The top-level per-profile object that measures requests and hands off the 32 // The top-level object that measures requests and hands off the measurements
33 // measurements to the proper |DomainReliabilityContext|. Referenced by the 33 // to the proper |DomainReliabilityContext|. Lives on the I/O thread, so the
34 // |ChromeNetworkDelegate|, which calls the On* methods. 34 // constructor accepts a URLRequestContext directly instead of a
35 // URLRequestContextGetter.
35 class DOMAIN_RELIABILITY_EXPORT DomainReliabilityMonitor { 36 class DOMAIN_RELIABILITY_EXPORT DomainReliabilityMonitor {
36 public: 37 public:
37 // NB: We don't take a URLRequestContextGetter because we already live on the 38 DomainReliabilityMonitor(net::URLRequestContext* url_request_context,
38 // I/O thread. 39 const std::string& upload_reporter_string);
39 explicit DomainReliabilityMonitor( 40 DomainReliabilityMonitor(net::URLRequestContext* url_request_context,
40 net::URLRequestContext* url_request_context); 41 const std::string& upload_reporter_string,
41 DomainReliabilityMonitor( 42 scoped_ptr<MockableTime> time);
42 net::URLRequestContext* url_request_context,
43 scoped_ptr<MockableTime> time);
44 ~DomainReliabilityMonitor(); 43 ~DomainReliabilityMonitor();
45 44
46 // Adds the "baked-in" configuration(s) for Google sites. 45 // Populates the monitor with contexts that were configured at compile time.
47 void AddBakedInConfigs(); 46 void AddBakedInConfigs();
48 47
49 // Should be called from the profile's NetworkDelegate on the corresponding 48 // Should be called when |request| is about to follow a redirect. Will
50 // events: 49 // examine and possibly log the redirect request.
51 void OnBeforeRedirect(net::URLRequest* request); 50 void OnBeforeRedirect(net::URLRequest* request);
51
52 // Should be called when |request| is complete. Will examine and possibly
53 // log the (final) request. (|started| should be true if the request was
54 // actually started before it was terminated.)
52 void OnCompleted(net::URLRequest* request, bool started); 55 void OnCompleted(net::URLRequest* request, bool started);
53 56
54 DomainReliabilityContext* AddContextForTesting( 57 DomainReliabilityContext* AddContextForTesting(
55 scoped_ptr<const DomainReliabilityConfig> config); 58 scoped_ptr<const DomainReliabilityConfig> config);
56 59
57 size_t contexts_size_for_testing() const { return contexts_.size(); } 60 size_t contexts_size_for_testing() const { return contexts_.size(); }
58 61
59 private: 62 private:
60 friend class DomainReliabilityMonitorTest; 63 friend class DomainReliabilityMonitorTest;
61 64
(...skipping 17 matching lines...) Expand all
79 }; 82 };
80 83
81 // Creates a context, adds it to the monitor, and returns a pointer to it. 84 // Creates a context, adds it to the monitor, and returns a pointer to it.
82 // (The pointer is only valid until the Monitor is destroyed.) 85 // (The pointer is only valid until the Monitor is destroyed.)
83 DomainReliabilityContext* AddContext( 86 DomainReliabilityContext* AddContext(
84 scoped_ptr<const DomainReliabilityConfig> config); 87 scoped_ptr<const DomainReliabilityConfig> config);
85 void OnRequestLegComplete(const RequestInfo& info); 88 void OnRequestLegComplete(const RequestInfo& info);
86 89
87 scoped_ptr<MockableTime> time_; 90 scoped_ptr<MockableTime> time_;
88 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 91 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
92 const std::string upload_reporter_string_;
89 DomainReliabilityScheduler::Params scheduler_params_; 93 DomainReliabilityScheduler::Params scheduler_params_;
90 DomainReliabilityDispatcher dispatcher_; 94 DomainReliabilityDispatcher dispatcher_;
91 scoped_ptr<DomainReliabilityUploader> uploader_; 95 scoped_ptr<DomainReliabilityUploader> uploader_;
92 ContextMap contexts_; 96 ContextMap contexts_;
93 97
94 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityMonitor); 98 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityMonitor);
95 }; 99 };
96 100
97 } // namespace domain_reliability 101 } // namespace domain_reliability
98 102
99 #endif // COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ 103 #endif // COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_
OLDNEW
« no previous file with comments | « components/domain_reliability/domain_reliability_export.h ('k') | components/domain_reliability/monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698