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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 state_ = GET_BACKEND_COMPLETE; | 319 state_ = GET_BACKEND_COMPLETE; |
320 return http_cache_->GetBackend(&data_shim_->backend, io_callback_); | 320 return http_cache_->GetBackend(&data_shim_->backend, io_callback_); |
321 } | 321 } |
322 | 322 |
323 int DiskCacheBasedQuicServerInfo::DoOpen() { | 323 int DiskCacheBasedQuicServerInfo::DoOpen() { |
324 state_ = OPEN_COMPLETE; | 324 state_ = OPEN_COMPLETE; |
325 return backend_->OpenEntry(key(), &data_shim_->entry, io_callback_); | 325 return backend_->OpenEntry(key(), &data_shim_->entry, io_callback_); |
326 } | 326 } |
327 | 327 |
328 int DiskCacheBasedQuicServerInfo::DoRead() { | 328 int DiskCacheBasedQuicServerInfo::DoRead() { |
329 const int32 size = entry_->GetDataSize(0 /* index */); | 329 const int32_t size = entry_->GetDataSize(0 /* index */); |
330 if (!size) { | 330 if (!size) { |
331 state_ = WAIT_FOR_DATA_READY_DONE; | 331 state_ = WAIT_FOR_DATA_READY_DONE; |
332 return OK; | 332 return OK; |
333 } | 333 } |
334 | 334 |
335 read_buffer_ = new IOBuffer(size); | 335 read_buffer_ = new IOBuffer(size); |
336 state_ = READ_COMPLETE; | 336 state_ = READ_COMPLETE; |
337 return entry_->ReadData( | 337 return entry_->ReadData( |
338 0 /* index */, 0 /* offset */, read_buffer_.get(), size, io_callback_); | 338 0 /* index */, 0 /* offset */, read_buffer_.get(), size, io_callback_); |
339 } | 339 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 } else if (backend_->GetCacheType() == MEMORY_CACHE) { | 428 } else if (backend_->GetCacheType() == MEMORY_CACHE) { |
429 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.MemoryCache", | 429 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.MemoryCache", |
430 failure, NUM_OF_FAILURES); | 430 failure, NUM_OF_FAILURES); |
431 } else { | 431 } else { |
432 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.DiskCache", | 432 UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.DiskCache", |
433 failure, NUM_OF_FAILURES); | 433 failure, NUM_OF_FAILURES); |
434 } | 434 } |
435 } | 435 } |
436 | 436 |
437 } // namespace net | 437 } // namespace net |
OLD | NEW |