| OLD | NEW |
| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 break; | 118 break; |
| 119 } | 119 } |
| 120 } while (state_ != STATE_NONE && rv != ERR_IO_PENDING); | 120 } while (state_ != STATE_NONE && rv != ERR_IO_PENDING); |
| 121 return rv; | 121 return rv; |
| 122 } | 122 } |
| 123 | 123 |
| 124 int SimpleCacheDumper::DoCreateCache() { | 124 int SimpleCacheDumper::DoCreateCache() { |
| 125 DCHECK(!cache_); | 125 DCHECK(!cache_); |
| 126 state_ = STATE_CREATE_CACHE_COMPLETE; | 126 state_ = STATE_CREATE_CACHE_COMPLETE; |
| 127 return disk_cache::CreateCacheBackend( | 127 return disk_cache::CreateCacheBackend( |
| 128 DISK_CACHE, CACHE_BACKEND_DEFAULT, input_path_, 0, false, | 128 DISK_CACHE, |
| 129 cache_thread_->message_loop_proxy(), | 129 CACHE_BACKEND_DEFAULT, |
| 130 NULL, &cache_, io_callback_); | 130 input_path_, |
| 131 0, |
| 132 false, |
| 133 cache_thread_->message_loop_proxy().get(), |
| 134 NULL, |
| 135 &cache_, |
| 136 io_callback_); |
| 131 } | 137 } |
| 132 | 138 |
| 133 int SimpleCacheDumper::DoCreateCacheComplete(int rv) { | 139 int SimpleCacheDumper::DoCreateCacheComplete(int rv) { |
| 134 if (rv < 0) | 140 if (rv < 0) |
| 135 return rv; | 141 return rv; |
| 136 | 142 |
| 137 reinterpret_cast<disk_cache::BackendImpl*>(cache_)->SetUpgradeMode(); | 143 reinterpret_cast<disk_cache::BackendImpl*>(cache_)->SetUpgradeMode(); |
| 138 reinterpret_cast<disk_cache::BackendImpl*>(cache_)->SetFlags( | 144 reinterpret_cast<disk_cache::BackendImpl*>(cache_)->SetFlags( |
| 139 disk_cache::kNoRandom); | 145 disk_cache::kNoRandom); |
| 140 | 146 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 267 |
| 262 if (rv != ERR_IO_PENDING) { | 268 if (rv != ERR_IO_PENDING) { |
| 263 rv_ = rv; | 269 rv_ = rv; |
| 264 delete cache_; | 270 delete cache_; |
| 265 cache_ = NULL; | 271 cache_ = NULL; |
| 266 base::MessageLoop::current()->Quit(); | 272 base::MessageLoop::current()->Quit(); |
| 267 } | 273 } |
| 268 } | 274 } |
| 269 | 275 |
| 270 } // namespace net | 276 } // namespace net |
| OLD | NEW |