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

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

Issue 7065045: Fix nits related to SSLHostInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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
« no previous file with comments | « net/http/disk_cache_based_ssl_host_info.h ('k') | net/socket/ssl_client_socket_pool.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_ssl_host_info.h" 5 #include "net/http/disk_cache_based_ssl_host_info.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 case OPEN_COMPLETE: 113 case OPEN_COMPLETE:
114 rv = DoOpenComplete(rv); 114 rv = DoOpenComplete(rv);
115 break; 115 break;
116 case READ: 116 case READ:
117 rv = DoRead(); 117 rv = DoRead();
118 break; 118 break;
119 case READ_COMPLETE: 119 case READ_COMPLETE:
120 rv = DoReadComplete(rv); 120 rv = DoReadComplete(rv);
121 break; 121 break;
122 case WAIT_FOR_DATA_READY_DONE: 122 case WAIT_FOR_DATA_READY_DONE:
123 rv = WaitForDataReadyDone(); 123 rv = DoWaitForDataReadyDone();
124 break; 124 break;
125 case CREATE: 125 case CREATE:
126 rv = DoCreate(); 126 rv = DoCreate();
127 break; 127 break;
128 case CREATE_COMPLETE: 128 case CREATE_COMPLETE:
129 rv = DoCreateComplete(rv); 129 rv = DoCreateComplete(rv);
130 break; 130 break;
131 case WRITE: 131 case WRITE:
132 rv = DoWrite(); 132 rv = DoWrite();
133 break; 133 break;
134 case WRITE_COMPLETE: 134 case WRITE_COMPLETE:
135 rv = DoWriteComplete(rv); 135 rv = DoWriteComplete(rv);
136 break; 136 break;
137 case SET_DONE: 137 case SET_DONE:
138 rv = SetDone(); 138 rv = DoSetDone();
139 break; 139 break;
140 default: 140 default:
141 rv = OK; 141 rv = OK;
142 NOTREACHED(); 142 NOTREACHED();
143 } 143 }
144 } while (rv != ERR_IO_PENDING && state_ != NONE); 144 } while (rv != ERR_IO_PENDING && state_ != NONE);
145 } 145 }
146 146
147 int DiskCacheBasedSSLHostInfo::DoGetBackendComplete(int rv) { 147 int DiskCacheBasedSSLHostInfo::DoGetBackendComplete(int rv) {
148 if (rv == OK) { 148 if (rv == OK) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 return entry_->WriteData(0 /* index */, 0 /* offset */, write_buffer_, 219 return entry_->WriteData(0 /* index */, 0 /* offset */, write_buffer_,
220 new_data_.size(), callback_, true /* truncate */); 220 new_data_.size(), callback_, true /* truncate */);
221 } 221 }
222 222
223 int DiskCacheBasedSSLHostInfo::DoCreate() { 223 int DiskCacheBasedSSLHostInfo::DoCreate() {
224 DCHECK(entry_ == NULL); 224 DCHECK(entry_ == NULL);
225 state_ = CREATE_COMPLETE; 225 state_ = CREATE_COMPLETE;
226 return backend_->CreateEntry(key(), callback_->entry_pointer(), callback_); 226 return backend_->CreateEntry(key(), callback_->entry_pointer(), callback_);
227 } 227 }
228 228
229 int DiskCacheBasedSSLHostInfo::WaitForDataReadyDone() { 229 int DiskCacheBasedSSLHostInfo::DoWaitForDataReadyDone() {
230 CompletionCallback* callback; 230 CompletionCallback* callback;
231 231
232 DCHECK(!ready_); 232 DCHECK(!ready_);
233 state_ = NONE; 233 state_ = NONE;
234 ready_ = true; 234 ready_ = true;
235 callback = user_callback_; 235 callback = user_callback_;
236 user_callback_ = NULL; 236 user_callback_ = NULL;
237 // We close the entry because, if we shutdown before ::Persist is called, 237 // We close the entry because, if we shutdown before ::Persist is called,
238 // then we might leak a cache reference, which causes a DCHECK on shutdown. 238 // then we might leak a cache reference, which causes a DCHECK on shutdown.
239 if (entry_) 239 if (entry_)
240 entry_->Close(); 240 entry_->Close();
241 entry_ = NULL; 241 entry_ = NULL;
242 Parse(data_); 242 Parse(data_);
243 243
244 if (callback) 244 if (callback)
245 callback->Run(OK); 245 callback->Run(OK);
246 246
247 return OK; 247 return OK;
248 } 248 }
249 249
250 int DiskCacheBasedSSLHostInfo::SetDone() { 250 int DiskCacheBasedSSLHostInfo::DoSetDone() {
251 if (entry_) 251 if (entry_)
252 entry_->Close(); 252 entry_->Close();
253 entry_ = NULL; 253 entry_ = NULL;
254 state_ = NONE; 254 state_ = NONE;
255 return OK; 255 return OK;
256 } 256 }
257 257
258 bool DiskCacheBasedSSLHostInfo::IsCallbackPending() const { 258 bool DiskCacheBasedSSLHostInfo::IsCallbackPending() const {
259 switch (state_) { 259 switch (state_) {
260 case GET_BACKEND_COMPLETE: 260 case GET_BACKEND_COMPLETE:
261 case OPEN_COMPLETE: 261 case OPEN_COMPLETE:
262 case READ_COMPLETE: 262 case READ_COMPLETE:
263 case CREATE_COMPLETE: 263 case CREATE_COMPLETE:
264 case WRITE_COMPLETE: 264 case WRITE_COMPLETE:
265 return true; 265 return true;
266 default: 266 default:
267 return false; 267 return false;
268 } 268 }
269 } 269 }
270 270
271 } // namespace net 271 } // namespace net
OLDNEW
« no previous file with comments | « net/http/disk_cache_based_ssl_host_info.h ('k') | net/socket/ssl_client_socket_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698