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

Side by Side Diff: net/http/disk_based_cert_cache.cc

Issue 502163003: Remove implicit conversions from scoped_refptr to T* in net/http/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | net/http/disk_based_cert_cache_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_based_cert_cache.h" 5 #include "net/http/disk_based_cert_cache.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 return ERR_FAILED; 248 return ERR_FAILED;
249 249
250 buffer_ = new IOBuffer(write_data.size()); 250 buffer_ = new IOBuffer(write_data.size());
251 io_buf_len_ = write_data.size(); 251 io_buf_len_ = write_data.size();
252 memcpy(buffer_->data(), write_data.data(), io_buf_len_); 252 memcpy(buffer_->data(), write_data.data(), io_buf_len_);
253 253
254 next_state_ = STATE_WRITE_COMPLETE; 254 next_state_ = STATE_WRITE_COMPLETE;
255 255
256 return entry_->WriteData(0 /* index */, 256 return entry_->WriteData(0 /* index */,
257 0 /* offset */, 257 0 /* offset */,
258 buffer_, 258 buffer_.get(),
259 write_data.size(), 259 write_data.size(),
260 io_callback_, 260 io_callback_,
261 true /* truncate */); 261 true /* truncate */);
262 } 262 }
263 263
264 int DiskBasedCertCache::WriteWorker::DoWriteComplete(int rv) { 264 int DiskBasedCertCache::WriteWorker::DoWriteComplete(int rv) {
265 if (rv < io_buf_len_) 265 if (rv < io_buf_len_)
266 return ERR_FAILED; 266 return ERR_FAILED;
267 267
268 return OK; 268 return OK;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 449
450 next_state_ = STATE_READ; 450 next_state_ = STATE_READ;
451 return OK; 451 return OK;
452 } 452 }
453 453
454 int DiskBasedCertCache::ReadWorker::DoRead() { 454 int DiskBasedCertCache::ReadWorker::DoRead() {
455 next_state_ = STATE_READ_COMPLETE; 455 next_state_ = STATE_READ_COMPLETE;
456 io_buf_len_ = entry_->GetDataSize(0 /* index */); 456 io_buf_len_ = entry_->GetDataSize(0 /* index */);
457 buffer_ = new IOBuffer(io_buf_len_); 457 buffer_ = new IOBuffer(io_buf_len_);
458 return entry_->ReadData( 458 return entry_->ReadData(
459 0 /* index */, 0 /* offset */, buffer_, io_buf_len_, io_callback_); 459 0 /* index */, 0 /* offset */, buffer_.get(), io_buf_len_, io_callback_);
460 } 460 }
461 461
462 int DiskBasedCertCache::ReadWorker::DoReadComplete(int rv) { 462 int DiskBasedCertCache::ReadWorker::DoReadComplete(int rv) {
463 // The cache should return the entire buffer length. If it does not, 463 // The cache should return the entire buffer length. If it does not,
464 // it is probably indicative of an issue other than corruption. 464 // it is probably indicative of an issue other than corruption.
465 if (rv < io_buf_len_) { 465 if (rv < io_buf_len_) {
466 RecordCacheResult(DISK_CACHE_ERROR); 466 RecordCacheResult(DISK_CACHE_ERROR);
467 return ERR_FAILED; 467 return ERR_FAILED;
468 } 468 }
469 cert_handle_ = X509Certificate::CreateOSCertHandleFromBytes(buffer_->data(), 469 cert_handle_ = X509Certificate::CreateOSCertHandleFromBytes(buffer_->data(),
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 589
590 void DiskBasedCertCache::FinishedWriteOperation( 590 void DiskBasedCertCache::FinishedWriteOperation(
591 const std::string& key, 591 const std::string& key,
592 X509Certificate::OSCertHandle cert_handle) { 592 X509Certificate::OSCertHandle cert_handle) {
593 write_worker_map_.erase(key); 593 write_worker_map_.erase(key);
594 if (!key.empty()) 594 if (!key.empty())
595 mru_cert_cache_.Put(key, X509Certificate::DupOSCertHandle(cert_handle)); 595 mru_cert_cache_.Put(key, X509Certificate::DupOSCertHandle(cert_handle));
596 } 596 }
597 597
598 } // namespace net 598 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/disk_based_cert_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698