| OLD | NEW |
| 1 // Copyright (c) 2009-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009-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/disk_cache/sparse_control.h" | 5 #include "net/disk_cache/sparse_control.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 // Post a task to delete the next child. | 136 // Post a task to delete the next child. |
| 137 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( | 137 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( |
| 138 this, &ChildrenDeleter::DeleteChildren)); | 138 this, &ChildrenDeleter::DeleteChildren)); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace. | 141 } // namespace. |
| 142 | 142 |
| 143 namespace disk_cache { | 143 namespace disk_cache { |
| 144 | 144 |
| 145 SparseControl::SparseControl(EntryImpl* entry) |
| 146 : entry_(entry), |
| 147 child_(NULL), |
| 148 operation_(kNoOperation), |
| 149 init_(false), |
| 150 child_map_(child_data_.bitmap, kNumSparseBits, kNumSparseBits / 32), |
| 151 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 152 child_callback_(this, &SparseControl::OnChildIOCompleted)), |
| 153 user_callback_(NULL) { |
| 154 } |
| 155 |
| 145 SparseControl::~SparseControl() { | 156 SparseControl::~SparseControl() { |
| 146 if (child_) | 157 if (child_) |
| 147 CloseChild(); | 158 CloseChild(); |
| 148 if (init_) | 159 if (init_) |
| 149 WriteSparseData(); | 160 WriteSparseData(); |
| 150 } | 161 } |
| 151 | 162 |
| 152 int SparseControl::Init() { | 163 int SparseControl::Init() { |
| 153 DCHECK(!init_); | 164 DCHECK(!init_); |
| 154 | 165 |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 net::CompletionCallback* c = abort_callbacks_[i]; | 764 net::CompletionCallback* c = abort_callbacks_[i]; |
| 754 if (i == abort_callbacks_.size() - 1) | 765 if (i == abort_callbacks_.size() - 1) |
| 755 abort_callbacks_.clear(); | 766 abort_callbacks_.clear(); |
| 756 | 767 |
| 757 entry_->Release(); // Don't touch object after this line. | 768 entry_->Release(); // Don't touch object after this line. |
| 758 c->Run(net::OK); | 769 c->Run(net::OK); |
| 759 } | 770 } |
| 760 } | 771 } |
| 761 | 772 |
| 762 } // namespace disk_cache | 773 } // namespace disk_cache |
| OLD | NEW |