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

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

Issue 2155783002: Batch pageload metrics pingbacks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tbansal comment Created 4 years, 5 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
« no previous file with comments | « no previous file | components/data_reduction_proxy/core/browser/data_reduction_proxy_pingback_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 967cae0cde4a80ecb85a86d1285e074f025c5121..a91a44cf0d9dac350922339e08c146670b768e6b 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
@@ -1,39 +1,38 @@
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#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 <list>
#include <memory>
#include <string>
#include "base/macros.h"
#include "base/threading/thread_checker.h"
+#include "components/data_reduction_proxy/proto/pageload_metrics.pb.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "url/gurl.h"
namespace base {
class Time;
}
namespace net {
class URLFetcher;
class URLRequestContextGetter;
}
namespace data_reduction_proxy {
class DataReductionProxyData;
struct DataReductionProxyPageLoadTiming;
-class RecordPageloadMetricsRequest;
// Manages pingbacks about page load timing information to the data saver proxy
// server. This class is not thread safe.
class DataReductionProxyPingbackClient : public net::URLFetcherDelegate {
public:
// The caller must ensure that |url_request_context| remains alive for the
// lifetime of the |DataReductionProxyPingbackClient| instance.
explicit DataReductionProxyPingbackClient(
net::URLRequestContextGetter* url_request_context);
~DataReductionProxyPingbackClient() override;
@@ -55,36 +54,35 @@ class DataReductionProxyPingbackClient : public net::URLFetcherDelegate {
virtual base::Time CurrentTime() const;
private:
// URLFetcherDelegate implmentation:
void OnURLFetchComplete(const net::URLFetcher* source) override;
// Whether a pingback should be sent.
bool ShouldSendPingback() const;
// Creates an URLFetcher that will POST to |secure_proxy_url_| using
- // |url_request_context_|. The max retires is set to 5.
- // The caller must ensure that request_data| is non-null. The caller owns
- // |request_data|.
- std::unique_ptr<net::URLFetcher> MaybeCreateFetcherForDataAndStart(
- RecordPageloadMetricsRequest* request_data);
+ // |url_request_context_|. The max retries is set to 5.
+ // |data_to_send_| will be used to fill the body of the Fetcher, and will be
+ // reset to an empty RecordPageloadMetricsRequest.
+ void CreateFetcherForDataAndStart();
net::URLRequestContextGetter* url_request_context_;
// The URL for the data saver proxy's ping back service.
const GURL pingback_url_;
// The currently running fetcher.
std::unique_ptr<net::URLFetcher> current_fetcher_;
// Serialized data to send to the data saver proxy server.
- std::list<std::unique_ptr<RecordPageloadMetricsRequest>> data_to_send_;
+ RecordPageloadMetricsRequest metrics_request_;
// The probability of sending a pingback to the server.
float pingback_reporting_fraction_;
base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(DataReductionProxyPingbackClient);
};
} // namespace data_reduction_proxy
« no previous file with comments | « no previous file | components/data_reduction_proxy/core/browser/data_reduction_proxy_pingback_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698