| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/ukm/ukm_service.h" | 5 #include "components/ukm/ukm_service.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 bool discard_log = false; | 401 bool discard_log = false; |
| 402 const size_t log_size_bytes = persisted_logs_.staged_log().length(); | 402 const size_t log_size_bytes = persisted_logs_.staged_log().length(); |
| 403 if (upload_succeeded) { | 403 if (upload_succeeded) { |
| 404 UMA_HISTOGRAM_COUNTS_10000("UKM.LogSize.OnSuccess", log_size_bytes / 1024); | 404 UMA_HISTOGRAM_COUNTS_10000("UKM.LogSize.OnSuccess", log_size_bytes / 1024); |
| 405 } else if (response_code == 400) { | 405 } else if (response_code == 400) { |
| 406 // Bad syntax. Retransmission won't work. | 406 // Bad syntax. Retransmission won't work. |
| 407 discard_log = true; | 407 discard_log = true; |
| 408 } | 408 } |
| 409 | 409 |
| 410 if (upload_succeeded || discard_log) { | 410 if (upload_succeeded || discard_log) { |
| 411 persisted_logs_.DiscardStagedLog(); | 411 // TODO(holte): The if below is a temporary fix for a crash bug. We should |
| 412 // revisit the logic and update it with a more correct fix. crbug.com/698819 |
| 413 if (persisted_logs_.has_staged_log()) |
| 414 persisted_logs_.DiscardStagedLog(); |
| 412 // Store the updated list to disk now that the removed log is uploaded. | 415 // Store the updated list to disk now that the removed log is uploaded. |
| 413 persisted_logs_.PersistUnsentLogs(); | 416 persisted_logs_.PersistUnsentLogs(); |
| 414 } | 417 } |
| 415 | 418 |
| 416 // Error 400 indicates a problem with the log, not with the server, so | 419 // Error 400 indicates a problem with the log, not with the server, so |
| 417 // don't consider that a sign that the server is in trouble. | 420 // don't consider that a sign that the server is in trouble. |
| 418 bool server_is_healthy = upload_succeeded || response_code == 400; | 421 bool server_is_healthy = upload_succeeded || response_code == 400; |
| 419 scheduler_->UploadFinished(server_is_healthy, | 422 scheduler_->UploadFinished(server_is_healthy, |
| 420 persisted_logs_.has_unsent_logs()); | 423 persisted_logs_.has_unsent_logs()); |
| 421 } | 424 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 } | 490 } |
| 488 if (entries_.size() >= GetMaxEntries()) { | 491 if (entries_.size() >= GetMaxEntries()) { |
| 489 RecordDroppedEntry(DroppedDataReason::MAX_HIT); | 492 RecordDroppedEntry(DroppedDataReason::MAX_HIT); |
| 490 return; | 493 return; |
| 491 } | 494 } |
| 492 | 495 |
| 493 entries_.push_back(std::move(entry)); | 496 entries_.push_back(std::move(entry)); |
| 494 } | 497 } |
| 495 | 498 |
| 496 } // namespace ukm | 499 } // namespace ukm |
| OLD | NEW |