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

Side by Side Diff: net/tools/dump_cache/simple_cache_dumper.cc

Issue 15829004: Update net/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: license twerk Created 7 years, 6 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/test/embedded_test_server/embedded_test_server.cc ('k') | net/tools/fetch/fetch_client.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/tools/dump_cache/simple_cache_dumper.h" 5 #include "net/tools/dump_cache/simple_cache_dumper.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 return rv; 176 return rv;
177 177
178 state_ = STATE_READ_HEADERS; 178 state_ = STATE_READ_HEADERS;
179 return OK; 179 return OK;
180 } 180 }
181 181
182 int SimpleCacheDumper::DoReadHeaders() { 182 int SimpleCacheDumper::DoReadHeaders() {
183 state_ = STATE_READ_HEADERS_COMPLETE; 183 state_ = STATE_READ_HEADERS_COMPLETE;
184 int32 size = src_entry_->GetDataSize(0); 184 int32 size = src_entry_->GetDataSize(0);
185 buf_ = new IOBufferWithSize(size); 185 buf_ = new IOBufferWithSize(size);
186 return src_entry_->ReadData(0, 0, buf_, size, io_callback_); 186 return src_entry_->ReadData(0, 0, buf_.get(), size, io_callback_);
187 } 187 }
188 188
189 int SimpleCacheDumper::DoReadHeadersComplete(int rv) { 189 int SimpleCacheDumper::DoReadHeadersComplete(int rv) {
190 if (rv < 0) 190 if (rv < 0)
191 return rv; 191 return rv;
192 192
193 state_ = STATE_WRITE_HEADERS; 193 state_ = STATE_WRITE_HEADERS;
194 return OK; 194 return OK;
195 } 195 }
196 196
197 int SimpleCacheDumper::DoWriteHeaders() { 197 int SimpleCacheDumper::DoWriteHeaders() {
198 int rv = writer_->WriteEntry(dst_entry_, 0, 0, buf_, buf_->size(), 198 int rv = writer_->WriteEntry(
199 io_callback_); 199 dst_entry_, 0, 0, buf_.get(), buf_->size(), io_callback_);
200 if (rv == 0) 200 if (rv == 0)
201 return ERR_FAILED; 201 return ERR_FAILED;
202 202
203 state_ = STATE_WRITE_HEADERS_COMPLETE; 203 state_ = STATE_WRITE_HEADERS_COMPLETE;
204 return OK; 204 return OK;
205 } 205 }
206 206
207 int SimpleCacheDumper::DoWriteHeadersComplete(int rv) { 207 int SimpleCacheDumper::DoWriteHeadersComplete(int rv) {
208 if (rv < 0) 208 if (rv < 0)
209 return rv; 209 return rv;
210 210
211 state_ = STATE_READ_BODY; 211 state_ = STATE_READ_BODY;
212 return OK; 212 return OK;
213 } 213 }
214 214
215 int SimpleCacheDumper::DoReadBody() { 215 int SimpleCacheDumper::DoReadBody() {
216 state_ = STATE_READ_BODY_COMPLETE; 216 state_ = STATE_READ_BODY_COMPLETE;
217 int32 size = src_entry_->GetDataSize(1); 217 int32 size = src_entry_->GetDataSize(1);
218 // If the body is empty, we can neither read nor write it, so 218 // If the body is empty, we can neither read nor write it, so
219 // just move to the next. 219 // just move to the next.
220 if (size <= 0) { 220 if (size <= 0) {
221 state_ = STATE_WRITE_BODY_COMPLETE; 221 state_ = STATE_WRITE_BODY_COMPLETE;
222 return OK; 222 return OK;
223 } 223 }
224 buf_ = new IOBufferWithSize(size); 224 buf_ = new IOBufferWithSize(size);
225 return src_entry_->ReadData(1, 0, buf_, size, io_callback_); 225 return src_entry_->ReadData(1, 0, buf_.get(), size, io_callback_);
226 } 226 }
227 227
228 int SimpleCacheDumper::DoReadBodyComplete(int rv) { 228 int SimpleCacheDumper::DoReadBodyComplete(int rv) {
229 if (rv < 0) 229 if (rv < 0)
230 return rv; 230 return rv;
231 231
232 state_ = STATE_WRITE_BODY; 232 state_ = STATE_WRITE_BODY;
233 return OK; 233 return OK;
234 } 234 }
235 235
236 int SimpleCacheDumper::DoWriteBody() { 236 int SimpleCacheDumper::DoWriteBody() {
237 int rv = writer_->WriteEntry(dst_entry_, 1, 0, buf_, buf_->size(), 237 int rv = writer_->WriteEntry(
238 io_callback_); 238 dst_entry_, 1, 0, buf_.get(), buf_->size(), io_callback_);
239 if (rv == 0) 239 if (rv == 0)
240 return ERR_FAILED; 240 return ERR_FAILED;
241 241
242 state_ = STATE_WRITE_BODY_COMPLETE; 242 state_ = STATE_WRITE_BODY_COMPLETE;
243 return OK; 243 return OK;
244 } 244 }
245 245
246 int SimpleCacheDumper::DoWriteBodyComplete(int rv) { 246 int SimpleCacheDumper::DoWriteBodyComplete(int rv) {
247 if (rv < 0) 247 if (rv < 0)
248 return rv; 248 return rv;
(...skipping 12 matching lines...) Expand all
261 261
262 if (rv != ERR_IO_PENDING) { 262 if (rv != ERR_IO_PENDING) {
263 rv_ = rv; 263 rv_ = rv;
264 delete cache_; 264 delete cache_;
265 cache_ = NULL; 265 cache_ = NULL;
266 base::MessageLoop::current()->Quit(); 266 base::MessageLoop::current()->Quit();
267 } 267 }
268 } 268 }
269 269
270 } // namespace net 270 } // namespace net
OLDNEW
« no previous file with comments | « net/test/embedded_test_server/embedded_test_server.cc ('k') | net/tools/fetch/fetch_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698