| 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 "net/http/disk_cache_based_quic_server_info.h" | 5 #include "net/http/disk_cache_based_quic_server_info.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/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 | 282 |
| 283 return OK; | 283 return OK; |
| 284 } | 284 } |
| 285 | 285 |
| 286 int DiskCacheBasedQuicServerInfo::DoReadComplete(int rv) { | 286 int DiskCacheBasedQuicServerInfo::DoReadComplete(int rv) { |
| 287 if (rv > 0) | 287 if (rv > 0) |
| 288 data_.assign(read_buffer_->data(), rv); | 288 data_.assign(read_buffer_->data(), rv); |
| 289 else if (rv < 0) | 289 else if (rv < 0) |
| 290 RecordQuicServerInfoFailure(READ_FAILURE); | 290 RecordQuicServerInfoFailure(READ_FAILURE); |
| 291 | 291 |
| 292 read_buffer_ = nullptr; |
| 292 state_ = WAIT_FOR_DATA_READY_DONE; | 293 state_ = WAIT_FOR_DATA_READY_DONE; |
| 293 return OK; | 294 return OK; |
| 294 } | 295 } |
| 295 | 296 |
| 296 int DiskCacheBasedQuicServerInfo::DoWriteComplete(int rv) { | 297 int DiskCacheBasedQuicServerInfo::DoWriteComplete(int rv) { |
| 297 if (rv < 0) | 298 if (rv < 0) |
| 298 RecordQuicServerInfoFailure(WRITE_FAILURE); | 299 RecordQuicServerInfoFailure(WRITE_FAILURE); |
| 300 write_buffer_ = nullptr; |
| 299 state_ = SET_DONE; | 301 state_ = SET_DONE; |
| 300 return OK; | 302 return OK; |
| 301 } | 303 } |
| 302 | 304 |
| 303 int DiskCacheBasedQuicServerInfo::DoCreateOrOpenComplete(int rv) { | 305 int DiskCacheBasedQuicServerInfo::DoCreateOrOpenComplete(int rv) { |
| 304 if (rv != OK) { | 306 if (rv != OK) { |
| 305 RecordQuicServerInfoFailure(CREATE_OR_OPEN_FAILURE); | 307 RecordQuicServerInfoFailure(CREATE_OR_OPEN_FAILURE); |
| 306 state_ = SET_DONE; | 308 state_ = SET_DONE; |
| 307 } else { | 309 } else { |
| 308 if (!entry_) { | 310 if (!entry_) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 } else if (backend_->GetCacheType() == MEMORY_CACHE) { | 430 } else if (backend_->GetCacheType() == MEMORY_CACHE) { |
| 429 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.MemoryCache", | 431 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.MemoryCache", |
| 430 failure, NUM_OF_FAILURES); | 432 failure, NUM_OF_FAILURES); |
| 431 } else { | 433 } else { |
| 432 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.DiskCache", | 434 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.DiskCache", |
| 433 failure, NUM_OF_FAILURES); | 435 failure, NUM_OF_FAILURES); |
| 434 } | 436 } |
| 435 } | 437 } |
| 436 | 438 |
| 437 } // namespace net | 439 } // namespace net |
| OLD | NEW |