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

Side by Side Diff: components/metrics/net/net_metrics_log_uploader.h

Issue 2774503002: Track network stack error codes from UMA and UKM (Closed)
Patch Set: Rebase on 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_ 5 #ifndef COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_
6 #define COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_ 6 #define COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 13 matching lines...) Expand all
24 // Implementation of MetricsLogUploader using the Chrome network stack. 24 // Implementation of MetricsLogUploader using the Chrome network stack.
25 class NetMetricsLogUploader : public MetricsLogUploader, 25 class NetMetricsLogUploader : public MetricsLogUploader,
26 public net::URLFetcherDelegate { 26 public net::URLFetcherDelegate {
27 public: 27 public:
28 // Constructs a NetMetricsLogUploader which uploads data to |server_url| with 28 // Constructs a NetMetricsLogUploader which uploads data to |server_url| with
29 // the specified |mime_type|. The |service_type| marks which service the 29 // the specified |mime_type|. The |service_type| marks which service the
30 // data usage should be attributed to. The |on_upload_complete| callback will 30 // data usage should be attributed to. The |on_upload_complete| callback will
31 // be called with the HTTP response code of the upload or with -1 on an error. 31 // be called with the HTTP response code of the upload or with -1 on an error.
32 // The caller must ensure that |request_context_getter| remains valid for the 32 // The caller must ensure that |request_context_getter| remains valid for the
33 // lifetime of this class. 33 // lifetime of this class.
34 NetMetricsLogUploader(net::URLRequestContextGetter* request_context_getter, 34 NetMetricsLogUploader(
35 base::StringPiece server_url, 35 net::URLRequestContextGetter* request_context_getter,
36 base::StringPiece mime_type, 36 base::StringPiece server_url,
37 MetricsLogUploader::MetricServiceType service_type, 37 base::StringPiece mime_type,
38 const base::Callback<void(int)>& on_upload_complete); 38 MetricsLogUploader::MetricServiceType service_type,
39 const MetricsLogUploader::UploadCallback& on_upload_complete);
39 ~NetMetricsLogUploader() override; 40 ~NetMetricsLogUploader() override;
40 41
41 // MetricsLogUploader: 42 // MetricsLogUploader:
42 void UploadLog(const std::string& compressed_log_data, 43 void UploadLog(const std::string& compressed_log_data,
43 const std::string& log_hash) override; 44 const std::string& log_hash) override;
44 45
45 private: 46 private:
46 // net::URLFetcherDelegate: 47 // net::URLFetcherDelegate:
47 void OnURLFetchComplete(const net::URLFetcher* source) override; 48 void OnURLFetchComplete(const net::URLFetcher* source) override;
48 49
49 // The request context for fetches done using the network stack. 50 // The request context for fetches done using the network stack.
50 net::URLRequestContextGetter* const request_context_getter_; 51 net::URLRequestContextGetter* const request_context_getter_;
51 52
52 const GURL server_url_; 53 const GURL server_url_;
53 const std::string mime_type_; 54 const std::string mime_type_;
54 const MetricsLogUploader::MetricServiceType service_type_; 55 const MetricsLogUploader::MetricServiceType service_type_;
55 const base::Callback<void(int)> on_upload_complete_; 56 const MetricsLogUploader::UploadCallback on_upload_complete_;
56 57
57 // The outstanding transmission appears as a URL Fetch operation. 58 // The outstanding transmission appears as a URL Fetch operation.
58 std::unique_ptr<net::URLFetcher> current_fetch_; 59 std::unique_ptr<net::URLFetcher> current_fetch_;
59 60
60 DISALLOW_COPY_AND_ASSIGN(NetMetricsLogUploader); 61 DISALLOW_COPY_AND_ASSIGN(NetMetricsLogUploader);
61 }; 62 };
62 63
63 } // namespace metrics 64 } // namespace metrics
64 65
65 #endif // COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_ 66 #endif // COMPONENTS_METRICS_NET_NET_METRICS_LOG_UPLOADER_H_
OLDNEW
« no previous file with comments | « components/metrics/metrics_service_client.h ('k') | components/metrics/net/net_metrics_log_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698