| 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/disk_cache/in_flight_backend_io.h" | 5 #include "net/disk_cache/in_flight_backend_io.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } | 219 } |
| 220 | 220 |
| 221 base::TimeDelta BackendIO::ElapsedTime() const { | 221 base::TimeDelta BackendIO::ElapsedTime() const { |
| 222 return base::TimeTicks::Now() - start_time_; | 222 return base::TimeTicks::Now() - start_time_; |
| 223 } | 223 } |
| 224 | 224 |
| 225 // Runs on the background thread. | 225 // Runs on the background thread. |
| 226 void BackendIO::ExecuteBackendOperation() { | 226 void BackendIO::ExecuteBackendOperation() { |
| 227 switch (operation_) { | 227 switch (operation_) { |
| 228 case OP_INIT: | 228 case OP_INIT: |
| 229 result_ = backend_->SyncInit(); | 229 result_ = backend_->SyncInit(GetCallbackThread()); |
| 230 break; | 230 break; |
| 231 case OP_OPEN: | 231 case OP_OPEN: |
| 232 result_ = backend_->SyncOpenEntry(key_, entry_ptr_); | 232 result_ = backend_->SyncOpenEntry(key_, entry_ptr_); |
| 233 break; | 233 break; |
| 234 case OP_CREATE: | 234 case OP_CREATE: |
| 235 result_ = backend_->SyncCreateEntry(key_, entry_ptr_); | 235 result_ = backend_->SyncCreateEntry(key_, entry_ptr_); |
| 236 break; | 236 break; |
| 237 case OP_DOOM: | 237 case OP_DOOM: |
| 238 result_ = backend_->SyncDoomEntry(key_); | 238 result_ = backend_->SyncDoomEntry(key_); |
| 239 break; | 239 break; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 background_thread_->PostTask(FROM_HERE, | 513 background_thread_->PostTask(FROM_HERE, |
| 514 base::Bind(&BackendIO::ExecuteOperation, operation)); | 514 base::Bind(&BackendIO::ExecuteOperation, operation)); |
| 515 OnOperationPosted(operation); | 515 OnOperationPosted(operation); |
| 516 } | 516 } |
| 517 | 517 |
| 518 base::WeakPtr<InFlightBackendIO> InFlightBackendIO::GetWeakPtr() { | 518 base::WeakPtr<InFlightBackendIO> InFlightBackendIO::GetWeakPtr() { |
| 519 return ptr_factory_.GetWeakPtr(); | 519 return ptr_factory_.GetWeakPtr(); |
| 520 } | 520 } |
| 521 | 521 |
| 522 } // namespace | 522 } // namespace |
| OLD | NEW |