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

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

Issue 2336043007: Domain Reliability: Don't crash on shutdown with uploads pending (Closed)
Patch Set: No, really. Created 4 years 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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // Initializes the Monitor's URLRequestContextGetter. 81 // Initializes the Monitor's URLRequestContextGetter.
82 // 82 //
83 // Must be called on the network thread, after |MoveToNetworkThread|. 83 // Must be called on the network thread, after |MoveToNetworkThread|.
84 void InitURLRequestContext(net::URLRequestContext* url_request_context); 84 void InitURLRequestContext(net::URLRequestContext* url_request_context);
85 85
86 // Same, but for unittests where the Getter is readily available. 86 // Same, but for unittests where the Getter is readily available.
87 void InitURLRequestContext( 87 void InitURLRequestContext(
88 const scoped_refptr<net::URLRequestContextGetter>& 88 const scoped_refptr<net::URLRequestContextGetter>&
89 url_request_context_getter); 89 url_request_context_getter);
90 90
91 void Shutdown();
mmenke 2016/12/14 19:12:17 Needs description
Julia Tuttle 2016/12/15 21:53:00 Done.
92
91 // Populates the monitor with contexts that were configured at compile time. 93 // Populates the monitor with contexts that were configured at compile time.
92 void AddBakedInConfigs(); 94 void AddBakedInConfigs();
93 95
94 // Sets whether the uploader will discard uploads. Must be called after 96 // Sets whether the uploader will discard uploads. Must be called after
95 // |InitURLRequestContext|. 97 // |InitURLRequestContext|.
96 void SetDiscardUploads(bool discard_uploads); 98 void SetDiscardUploads(bool discard_uploads);
97 99
98 // Should be called when |request| is about to follow a redirect. Will 100 // Should be called when |request| is about to follow a redirect. Will
99 // examine and possibly log the redirect request. Must be called after 101 // examine and possibly log the redirect request. Must be called after
100 // |SetDiscardUploads|. 102 // |SetDiscardUploads|.
(...skipping 22 matching lines...) Expand all
123 // debugging purposes. 125 // debugging purposes.
124 std::unique_ptr<base::Value> GetWebUIData() const; 126 std::unique_ptr<base::Value> GetWebUIData() const;
125 127
126 DomainReliabilityContext* AddContextForTesting( 128 DomainReliabilityContext* AddContextForTesting(
127 std::unique_ptr<const DomainReliabilityConfig> config); 129 std::unique_ptr<const DomainReliabilityConfig> config);
128 130
129 size_t contexts_size_for_testing() const { 131 size_t contexts_size_for_testing() const {
130 return context_manager_.contexts_size_for_testing(); 132 return context_manager_.contexts_size_for_testing();
131 } 133 }
132 134
135 void ForceUploadsForTesting();
mmenke 2016/12/14 19:12:17 Maybe add a comment?
Julia Tuttle 2016/12/15 21:53:00 Done.
136
133 // DomainReliabilityContext::Factory implementation: 137 // DomainReliabilityContext::Factory implementation:
134 std::unique_ptr<DomainReliabilityContext> CreateContextForConfig( 138 std::unique_ptr<DomainReliabilityContext> CreateContextForConfig(
135 std::unique_ptr<const DomainReliabilityConfig> config) override; 139 std::unique_ptr<const DomainReliabilityConfig> config) override;
136 140
137 private: 141 private:
138 friend class DomainReliabilityMonitorTest; 142 friend class DomainReliabilityMonitorTest;
139 // Allow the Service to call |MakeWeakPtr|. 143 // Allow the Service to call |MakeWeakPtr|.
140 friend class DomainReliabilityServiceImpl; 144 friend class DomainReliabilityServiceImpl;
141 145
142 typedef std::map<std::string, DomainReliabilityContext*> ContextMap; 146 typedef std::map<std::string, DomainReliabilityContext*> ContextMap;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 bool discard_uploads_set_; 192 bool discard_uploads_set_;
189 193
190 base::WeakPtrFactory<DomainReliabilityMonitor> weak_factory_; 194 base::WeakPtrFactory<DomainReliabilityMonitor> weak_factory_;
191 195
192 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityMonitor); 196 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityMonitor);
193 }; 197 };
194 198
195 } // namespace domain_reliability 199 } // namespace domain_reliability
196 200
197 #endif // COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_ 201 #endif // COMPONENTS_DOMAIN_RELIABILITY_MONITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698