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

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

Issue 2833523002: Adding opt out and previews type information to DRP pingback (Closed)
Patch Set: moved definition up Created 3 years, 8 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_pingback_client.h
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_pingback_client.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_pingback_client.h
index a91a44cf0d9dac350922339e08c146670b768e6b..2d296ed36b7d8ca4116b720855c99a4399f0f870 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_pingback_client.h
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_pingback_client.h
@@ -5,6 +5,8 @@
#ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_PINGBACK_CLIENT_H_
#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_PINGBACK_CLIENT_H_
+#include <stdint.h>
+
#include <memory>
#include <string>
@@ -40,12 +42,23 @@ class DataReductionProxyPingbackClient : public net::URLFetcherDelegate {
// Sends a pingback to the data saver proxy server about various timing
// information.
virtual void SendPingback(const DataReductionProxyData& data,
- const DataReductionProxyPageLoadTiming& timing);
+ const DataReductionProxyPageLoadTiming& timing,
+ const void* tab_identifier_key);
// Sets the probability of actually sending a pingback to the server for any
// call to SendPingback.
void SetPingbackReportingFraction(float pingback_reporting_fraction);
+ // Adds an opt out for |tab_identifier_key| for a data saver |page_id|.
bengr 2017/04/20 17:36:19 What's an opt out? Define somewhere.
RyanSturm 2017/04/20 20:25:45 Done.
+ void AddOptOut(const void* tab_identifier_key, uint64_t page_id);
+
+ // Removes any stored data associated with |tab_identifier_key| in a task that
+ // runs later.
+ void ClearTabKeyAsync(const void* tab_identifier_key);
+
+ // The total number of pending loads being tracked due to opt outs.
+ size_t PendingTabLoadsForTesting() const;
+
protected:
// Generates a float in the range [0, 1). Virtualized in testing.
virtual float GenerateRandomFloat() const;
@@ -66,6 +79,9 @@ class DataReductionProxyPingbackClient : public net::URLFetcherDelegate {
// reset to an empty RecordPageloadMetricsRequest.
void CreateFetcherForDataAndStart();
+ // Removes any stored data associated with |tab_identifier_key|.
+ void ClearTabKeySync(const void* tab_identifier_key);
+
net::URLRequestContextGetter* url_request_context_;
// The URL for the data saver proxy's ping back service.
@@ -80,6 +96,9 @@ class DataReductionProxyPingbackClient : public net::URLFetcherDelegate {
// The probability of sending a pingback to the server.
float pingback_reporting_fraction_;
+ // The map of tab identifier keys to page IDs.
+ std::map<const void*, uint64_t> tab_page_id_map_;
+
base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(DataReductionProxyPingbackClient);

Powered by Google App Engine
This is Rietveld 408576698