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

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

Issue 309793006: Call Start() from NetMetricsLogUploader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "components/metrics/net/net_metrics_log_uploader.h" 5 #include "components/metrics/net/net_metrics_log_uploader.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "components/metrics/net/compression_utils.h" 8 #include "components/metrics/net/compression_utils.h"
9 #include "net/base/load_flags.h" 9 #include "net/base/load_flags.h"
10 #include "net/url_request/url_fetcher.h" 10 #include "net/url_request/url_fetcher.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // Tell the server that we're uploading gzipped protobufs. 48 // Tell the server that we're uploading gzipped protobufs.
49 current_fetch_->SetExtraRequestHeaders("content-encoding: gzip"); 49 current_fetch_->SetExtraRequestHeaders("content-encoding: gzip");
50 50
51 DCHECK(!log_hash.empty()); 51 DCHECK(!log_hash.empty());
52 current_fetch_->AddExtraRequestHeader("X-Chrome-UMA-Log-SHA1: " + log_hash); 52 current_fetch_->AddExtraRequestHeader("X-Chrome-UMA-Log-SHA1: " + log_hash);
53 53
54 // We already drop cookies server-side, but we might as well strip them out 54 // We already drop cookies server-side, but we might as well strip them out
55 // client-side as well. 55 // client-side as well.
56 current_fetch_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | 56 current_fetch_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
57 net::LOAD_DO_NOT_SEND_COOKIES); 57 net::LOAD_DO_NOT_SEND_COOKIES);
58 current_fetch_->Start();
58 return true; 59 return true;
59 } 60 }
60 61
61 void NetMetricsLogUploader::OnURLFetchComplete(const net::URLFetcher* source) { 62 void NetMetricsLogUploader::OnURLFetchComplete(const net::URLFetcher* source) {
62 // We're not allowed to re-use the existing |URLFetcher|s, so free them here. 63 // We're not allowed to re-use the existing |URLFetcher|s, so free them here.
63 // Note however that |source| is aliased to the fetcher, so we should be 64 // Note however that |source| is aliased to the fetcher, so we should be
64 // careful not to delete it too early. 65 // careful not to delete it too early.
65 DCHECK_EQ(current_fetch_.get(), source); 66 DCHECK_EQ(current_fetch_.get(), source);
66 67
67 int response_code = source->GetResponseCode(); 68 int response_code = source->GetResponseCode();
68 if (response_code == net::URLFetcher::RESPONSE_CODE_INVALID) 69 if (response_code == net::URLFetcher::RESPONSE_CODE_INVALID)
69 response_code = -1; 70 response_code = -1;
70 on_upload_complete_.Run(response_code); 71 on_upload_complete_.Run(response_code);
71 current_fetch_.reset(); 72 current_fetch_.reset();
72 } 73 }
73 74
74 } // namespace metrics 75 } // namespace metrics
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698