OLD | NEW |
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 #include "components/domain_reliability/uploader.h" | 5 #include "components/domain_reliability/uploader.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 DomainReliabilityUploaderImpl( | 55 DomainReliabilityUploaderImpl( |
56 MockableTime* time, | 56 MockableTime* time, |
57 const scoped_refptr< | 57 const scoped_refptr< |
58 net::URLRequestContextGetter>& url_request_context_getter) | 58 net::URLRequestContextGetter>& url_request_context_getter) |
59 : time_(time), | 59 : time_(time), |
60 url_request_context_getter_(url_request_context_getter), | 60 url_request_context_getter_(url_request_context_getter), |
61 discard_uploads_(true) {} | 61 discard_uploads_(true) {} |
62 | 62 |
63 ~DomainReliabilityUploaderImpl() override { | 63 ~DomainReliabilityUploaderImpl() override { |
64 // Delete any in-flight URLFetchers. | 64 // Delete any in-flight URLFetchers. |
65 STLDeleteContainerPairFirstPointers( | 65 base::STLDeleteContainerPairFirstPointers(upload_callbacks_.begin(), |
66 upload_callbacks_.begin(), upload_callbacks_.end()); | 66 upload_callbacks_.end()); |
67 } | 67 } |
68 | 68 |
69 // DomainReliabilityUploader implementation: | 69 // DomainReliabilityUploader implementation: |
70 void UploadReport( | 70 void UploadReport( |
71 const std::string& report_json, | 71 const std::string& report_json, |
72 int max_upload_depth, | 72 int max_upload_depth, |
73 const GURL& upload_url, | 73 const GURL& upload_url, |
74 const DomainReliabilityUploader::UploadCallback& callback) override { | 74 const DomainReliabilityUploader::UploadCallback& callback) override { |
75 VLOG(1) << "Uploading report to " << upload_url; | 75 VLOG(1) << "Uploading report to " << upload_url; |
76 VLOG(2) << "Report JSON: " << report_json; | 76 VLOG(2) << "Report JSON: " << report_json; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 int DomainReliabilityUploader::GetURLRequestUploadDepth( | 176 int DomainReliabilityUploader::GetURLRequestUploadDepth( |
177 const net::URLRequest& request) { | 177 const net::URLRequest& request) { |
178 UploadUserData* data = static_cast<UploadUserData*>( | 178 UploadUserData* data = static_cast<UploadUserData*>( |
179 request.GetUserData(UploadUserData::kUserDataKey)); | 179 request.GetUserData(UploadUserData::kUserDataKey)); |
180 if (!data) | 180 if (!data) |
181 return 0; | 181 return 0; |
182 return data->depth(); | 182 return data->depth(); |
183 } | 183 } |
184 | 184 |
185 } // namespace domain_reliability | 185 } // namespace domain_reliability |
OLD | NEW |