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

Side by Side Diff: chrome/browser/io_thread.h

Issue 2517363002: Decouple Metrics Initialization from IO Thread Initialization (Closed)
Patch Set: Created 4 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_IO_THREAD_H_ 5 #ifndef CHROME_BROWSER_IO_THREAD_H_
6 #define CHROME_BROWSER_IO_THREAD_H_ 6 #define CHROME_BROWSER_IO_THREAD_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 #include <set> 13 #include <set>
14 #include <string> 14 #include <string>
15 #include <unordered_set> 15 #include <unordered_set>
16 #include <vector> 16 #include <vector>
17 17
18 #include "base/compiler_specific.h" 18 #include "base/compiler_specific.h"
19 #include "base/logging.h"
19 #include "base/macros.h" 20 #include "base/macros.h"
20 #include "base/memory/ref_counted.h" 21 #include "base/memory/ref_counted.h"
21 #include "base/memory/weak_ptr.h" 22 #include "base/memory/weak_ptr.h"
22 #include "base/strings/string_piece.h" 23 #include "base/strings/string_piece.h"
23 #include "base/time/time.h" 24 #include "base/time/time.h"
24 #include "build/build_config.h" 25 #include "build/build_config.h"
25 #include "chrome/browser/net/chrome_network_delegate.h" 26 #include "chrome/browser/net/chrome_network_delegate.h"
26 #include "chrome/common/features.h" 27 #include "chrome/common/features.h"
27 #include "components/metrics/data_use_tracker.h" 28 #include "components/metrics/data_use_tracker.h"
28 #include "components/prefs/pref_member.h" 29 #include "components/prefs/pref_member.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // visited sites on about:net-internals/#dns and about:dns pages. Must be 233 // visited sites on about:net-internals/#dns and about:dns pages. Must be
233 // called on the IO thread. If |host_filter| is not null, only hosts matched 234 // called on the IO thread. If |host_filter| is not null, only hosts matched
234 // by it are deleted from the cache. 235 // by it are deleted from the cache.
235 void ClearHostCache( 236 void ClearHostCache(
236 const base::Callback<bool(const std::string&)>& host_filter); 237 const base::Callback<bool(const std::string&)>& host_filter);
237 238
238 const net::HttpNetworkSession::Params& NetworkSessionParams() const; 239 const net::HttpNetworkSession::Params& NetworkSessionParams() const;
239 240
240 base::TimeTicks creation_time() const; 241 base::TimeTicks creation_time() const;
241 242
243 // Initializes the callback for updating data use prefs.
244 void InitMetricsDataUseForwarder();
245
242 // Returns the callback for updating data use prefs. 246 // Returns the callback for updating data use prefs.
243 const metrics::UpdateUsagePrefCallbackType& GetMetricsDataUseForwarder(); 247 const metrics::UpdateUsagePrefCallbackType& GetMetricsDataUseForwarder();
244 248
245 // Registers the |observer| for new STH notifications. 249 // Registers the |observer| for new STH notifications.
246 void RegisterSTHObserver(net::ct::STHObserver* observer); 250 void RegisterSTHObserver(net::ct::STHObserver* observer);
247 251
248 // Un-registers the |observer|. 252 // Un-registers the |observer|.
249 void UnregisterSTHObserver(net::ct::STHObserver* observer); 253 void UnregisterSTHObserver(net::ct::STHObserver* observer);
250 254
251 // Returns true if the indicated proxy resolution features are 255 // Returns true if the indicated proxy resolution features are
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 401
398 // True if HTTP/0.9 is allowed on non-default ports by policy. 402 // True if HTTP/0.9 is allowed on non-default ports by policy.
399 bool http_09_on_non_default_ports_enabled_; 403 bool http_09_on_non_default_ports_enabled_;
400 404
401 const base::TimeTicks creation_time_; 405 const base::TimeTicks creation_time_;
402 406
403 // Callback for updating data use prefs which needs to be initialized on UI 407 // Callback for updating data use prefs which needs to be initialized on UI
404 // thread and passed to |DataUseNetworkDelegate|. 408 // thread and passed to |DataUseNetworkDelegate|.
405 metrics::UpdateUsagePrefCallbackType metrics_data_use_forwarder_; 409 metrics::UpdateUsagePrefCallbackType metrics_data_use_forwarder_;
406 410
411 #if DCHECK_IS_ON()
412 // True if |metrics_data_use_forwarder_| has been set.
413 bool metrics_data_use_forwarder_set_ = false;
414 #endif
415
407 base::WeakPtrFactory<IOThread> weak_factory_; 416 base::WeakPtrFactory<IOThread> weak_factory_;
408 417
409 DISALLOW_COPY_AND_ASSIGN(IOThread); 418 DISALLOW_COPY_AND_ASSIGN(IOThread);
410 }; 419 };
411 420
412 #endif // CHROME_BROWSER_IO_THREAD_H_ 421 #endif // CHROME_BROWSER_IO_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698