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

Unified Diff: components/domain_reliability/monitor.h

Issue 615313006: Domain Reliability: Get correct reporting pref once, on startup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ordering on SetDiscardUploads Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: components/domain_reliability/monitor.h
diff --git a/components/domain_reliability/monitor.h b/components/domain_reliability/monitor.h
index a429c935acf82f9f205c1f75a5569ebb04d3db67..d1126cb799b39d0100c509fa02e7ea5bec5dc64d 100644
--- a/components/domain_reliability/monitor.h
+++ b/components/domain_reliability/monitor.h
@@ -10,7 +10,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/prefs/pref_member.h"
+#include "base/single_thread_task_runner.h"
#include "base/time/time.h"
#include "components/domain_reliability/beacon.h"
#include "components/domain_reliability/clear_mode.h"
@@ -25,10 +25,7 @@
#include "net/http/http_response_info.h"
#include "net/url_request/url_request_status.h"
-class PrefService;
-
namespace base {
-class SingleThreadTaskRunner;
class ThreadChecker;
class Value;
} // namespace base
@@ -51,17 +48,13 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityMonitor {
DomainReliabilityMonitor(
const std::string& upload_reporter_string,
scoped_refptr<base::SingleThreadTaskRunner> pref_thread,
- scoped_refptr<base::SingleThreadTaskRunner> network_thread,
- PrefService* local_state_pref_service,
- const char* reporting_pref_name);
+ scoped_refptr<base::SingleThreadTaskRunner> network_thread);
// Same, but specifies a mock interface for time functions for testing.
DomainReliabilityMonitor(
const std::string& upload_reporter_string,
scoped_refptr<base::SingleThreadTaskRunner> pref_thread,
scoped_refptr<base::SingleThreadTaskRunner> network_thread,
- PrefService* local_state_pref_service,
- const char* reporting_pref_name,
scoped_ptr<MockableTime> time);
// Must be called from the pref thread if |MoveToNetworkThread| was not
@@ -73,11 +66,8 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityMonitor {
// thread passed in the constructor.
void MoveToNetworkThread();
- // Must be called from the pref thread before the Monitor is destructed if
- // |MoveToNetworkThread| was called.
- void DestroyReportingPref();
-
- // All public methods below this point must be called on the network thread:
+ // All public methods below this point must be called on the network thread
+ // after |MoveToNetworkThread| is called on the pref thread.
// Initializes the Monitor's URLRequestContextGetter.
//
@@ -91,6 +81,10 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityMonitor {
// Populates the monitor with contexts that were configured at compile time.
void AddBakedInConfigs();
+ // Sets whether the uploader will discard uploads. Must be called after
+ // |InitURLRequestContext|.
davidben 2014/10/03 00:12:25 It also must be called before OnBeforeRedirect and
Deprecated (see juliatuttle) 2014/10/03 00:42:08 Done.
+ void SetDiscardUploads(bool discard_uploads);
+
// Should be called when |request| is about to follow a redirect. Will
// examine and possibly log the redirect request.
void OnBeforeRedirect(net::URLRequest* request);
@@ -146,11 +140,6 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityMonitor {
DomainReliabilityContext* GetContextForHost(const std::string& host) const;
- void InitReportingPref(
- PrefService* local_state_pref_service,
- const char* reporting_pref_name);
- void OnReportingPrefChanged();
-
bool OnPrefThread() const {
return pref_task_runner_->BelongsToCurrentThread();
}
@@ -170,8 +159,8 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityMonitor {
scoped_refptr<base::SingleThreadTaskRunner> pref_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
- BooleanPrefMember reporting_pref_;
bool moved_to_network_thread_;
+ bool discard_uploads_set_;
base::WeakPtrFactory<DomainReliabilityMonitor> weak_factory_;

Powered by Google App Engine
This is Rietveld 408576698