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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
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/logging.h" 9 #include "base/logging.h"
10 #include "net/base/completion_callback.h" 10 #include "net/base/completion_callback.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 disk_cache::Backend* backend; 42 disk_cache::Backend* backend;
43 disk_cache::Entry* entry; 43 disk_cache::Entry* entry;
44 }; 44 };
45 45
46 DiskCacheBasedQuicServerInfo::DiskCacheBasedQuicServerInfo( 46 DiskCacheBasedQuicServerInfo::DiskCacheBasedQuicServerInfo(
47 const QuicServerId& server_id, 47 const QuicServerId& server_id,
48 HttpCache* http_cache) 48 HttpCache* http_cache)
49 : QuicServerInfo(server_id), 49 : QuicServerInfo(server_id),
50 weak_factory_(this), 50 weak_factory_(this),
51 data_shim_(new CacheOperationDataShim()), 51 data_shim_(new CacheOperationDataShim()),
52 io_callback_( 52 io_callback_(base::Bind(&DiskCacheBasedQuicServerInfo::OnIOComplete,
53 base::Bind(&DiskCacheBasedQuicServerInfo::OnIOComplete, 53 weak_factory_.GetWeakPtr(),
54 weak_factory_.GetWeakPtr(), 54 base::Owned(data_shim_))), // Ownership assigned.
55 base::Owned(data_shim_))), // Ownership assigned.
56 state_(GET_BACKEND), 55 state_(GET_BACKEND),
57 ready_(false), 56 ready_(false),
58 found_entry_(false), 57 found_entry_(false),
59 server_id_(server_id), 58 server_id_(server_id),
60 http_cache_(http_cache), 59 http_cache_(http_cache),
61 backend_(NULL), 60 backend_(NULL),
62 entry_(NULL) { 61 entry_(NULL) {
63 } 62 }
64 63
65 void DiskCacheBasedQuicServerInfo::Start() { 64 void DiskCacheBasedQuicServerInfo::Start() {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 state_ = READ_COMPLETE; 247 state_ = READ_COMPLETE;
249 return entry_->ReadData( 248 return entry_->ReadData(
250 0 /* index */, 0 /* offset */, read_buffer_, size, io_callback_); 249 0 /* index */, 0 /* offset */, read_buffer_, size, io_callback_);
251 } 250 }
252 251
253 int DiskCacheBasedQuicServerInfo::DoWrite() { 252 int DiskCacheBasedQuicServerInfo::DoWrite() {
254 write_buffer_ = new IOBuffer(new_data_.size()); 253 write_buffer_ = new IOBuffer(new_data_.size());
255 memcpy(write_buffer_->data(), new_data_.data(), new_data_.size()); 254 memcpy(write_buffer_->data(), new_data_.data(), new_data_.size());
256 state_ = WRITE_COMPLETE; 255 state_ = WRITE_COMPLETE;
257 256
258 return entry_->WriteData( 257 return entry_->WriteData(0 /* index */,
259 0 /* index */, 0 /* offset */, write_buffer_, new_data_.size(), 258 0 /* offset */,
260 io_callback_, true /* truncate */); 259 write_buffer_,
260 new_data_.size(),
261 io_callback_,
262 true /* truncate */);
261 } 263 }
262 264
263 int DiskCacheBasedQuicServerInfo::DoCreateOrOpen() { 265 int DiskCacheBasedQuicServerInfo::DoCreateOrOpen() {
264 DCHECK(entry_ == NULL); 266 DCHECK(entry_ == NULL);
265 state_ = CREATE_OR_OPEN_COMPLETE; 267 state_ = CREATE_OR_OPEN_COMPLETE;
266 if (found_entry_) { 268 if (found_entry_) {
267 return backend_->OpenEntry(key(), &data_shim_->entry, io_callback_); 269 return backend_->OpenEntry(key(), &data_shim_->entry, io_callback_);
268 } 270 }
269 271
270 return backend_->CreateEntry(key(), &data_shim_->entry, io_callback_); 272 return backend_->CreateEntry(key(), &data_shim_->entry, io_callback_);
(...skipping 15 matching lines...) Expand all
286 int DiskCacheBasedQuicServerInfo::DoSetDone() { 288 int DiskCacheBasedQuicServerInfo::DoSetDone() {
287 if (entry_) 289 if (entry_)
288 entry_->Close(); 290 entry_->Close();
289 entry_ = NULL; 291 entry_ = NULL;
290 new_data_.clear(); 292 new_data_.clear();
291 state_ = NONE; 293 state_ = NONE;
292 return OK; 294 return OK;
293 } 295 }
294 296
295 } // namespace net 297 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698