| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "net/url_request/report_sender.h" | 5 #include "net/url_request/report_sender.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "net/base/elements_upload_data_stream.h" | 9 #include "net/base/elements_upload_data_stream.h" |
| 10 #include "net/base/load_flags.h" | 10 #include "net/base/load_flags.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 void ReportSender::OnResponseStarted(URLRequest* request, int net_error) { | 85 void ReportSender::OnResponseStarted(URLRequest* request, int net_error) { |
| 86 DCHECK_NE(ERR_IO_PENDING, net_error); | 86 DCHECK_NE(ERR_IO_PENDING, net_error); |
| 87 | 87 |
| 88 CallbackInfo* callback_info = | 88 CallbackInfo* callback_info = |
| 89 static_cast<CallbackInfo*>(request->GetUserData(&kUserDataKey)); | 89 static_cast<CallbackInfo*>(request->GetUserData(&kUserDataKey)); |
| 90 DCHECK(callback_info); | 90 DCHECK(callback_info); |
| 91 if (net_error != OK) { | 91 if (net_error != OK) { |
| 92 DVLOG(1) << "Failed to send report for " << request->url().host(); | 92 DVLOG(1) << "Failed to send report for " << request->url().host(); |
| 93 if (!callback_info->error_callback().is_null()) | 93 if (!callback_info->error_callback().is_null()) |
| 94 callback_info->error_callback().Run(request->url(), net_error); | 94 callback_info->error_callback().Run(request->url(), net_error, |
| 95 request->GetResponseCode()); |
| 95 } else if (!callback_info->success_callback().is_null()) { | 96 } else if (!callback_info->success_callback().is_null()) { |
| 96 callback_info->success_callback().Run(); | 97 callback_info->success_callback().Run(request->GetResponseCode()); |
| 97 } | 98 } |
| 98 | 99 |
| 99 CHECK_GT(inflight_requests_.erase(request), 0u); | 100 CHECK_GT(inflight_requests_.erase(request), 0u); |
| 100 } | 101 } |
| 101 | 102 |
| 102 void ReportSender::OnReadCompleted(URLRequest* request, int bytes_read) { | 103 void ReportSender::OnReadCompleted(URLRequest* request, int bytes_read) { |
| 103 NOTREACHED(); | 104 NOTREACHED(); |
| 104 } | 105 } |
| 105 | 106 |
| 106 } // namespace net | 107 } // namespace net |
| OLD | NEW |