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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h

Issue 888713002: DataReductionProxyStatisticsPrefs should support WeakPtr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Webview fix Created 5 years, 10 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/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h
index 2eecb6a80eaf6da9895812d4cac8617620ff07a1..ecbb0f065980ac03b43b56c8d8d55ee6b14e2cef 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h
@@ -6,6 +6,7 @@
#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_IO_DATA_H_
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "base/prefs/pref_member.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_auth_request_handler.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate.h"
@@ -52,11 +53,11 @@ class DataReductionProxyIOData {
// Destroys the statistics preferences.
void ShutdownOnUIThread();
- // Constructs statistics prefs. This is not necessary if a valid statistics
- // prefs is passed into the constructor.
- void EnableCompressionStatisticsLogging(
- PrefService* prefs,
- const base::TimeDelta& commit_delay);
+ void SetDataReductionProxyStatisticsPrefs(
+ base::WeakPtr<DataReductionProxyStatisticsPrefs> statistics_prefs);
+
+ // Passes ownership of |statistics_prefs_|.
+ scoped_ptr<DataReductionProxyStatisticsPrefs> PassStatisticsPrefs();
// Creates an interceptor suitable for following the Data Reduction Proxy
// bypass protocol.
@@ -81,10 +82,6 @@ class DataReductionProxyIOData {
return event_store_.get();
}
- DataReductionProxyStatisticsPrefs* statistics_prefs() const {
- return statistics_prefs_.get();
- }
-
DataReductionProxyAuthRequestHandler* auth_request_handler() const {
return auth_request_handler_.get();
}
@@ -110,7 +107,10 @@ class DataReductionProxyIOData {
scoped_ptr<DataReductionProxyParams> params_;
// Tracker of compression statistics to be displayed to the user.
- scoped_ptr<DataReductionProxyStatisticsPrefs> statistics_prefs_;
+ base::WeakPtr<DataReductionProxyStatisticsPrefs> statistics_prefs_;
+ // |temporary_statistics_prefs_| is used only until DataReductionProxySettings
+ // initialization and is dead after.
+ scoped_ptr<DataReductionProxyStatisticsPrefs> temporary_statistics_prefs_;
// Tracker of Data Reduction Proxy-related events, e.g., for logging.
scoped_ptr<DataReductionProxyEventStore> event_store_;

Powered by Google App Engine
This is Rietveld 408576698