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/sparse_control.h" | 5 #include "net/disk_cache/sparse_control.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // We'll grab another reference to keep this object alive because we just have | 325 // We'll grab another reference to keep this object alive because we just have |
326 // one extra reference due to the pending IO operation itself, but we'll | 326 // one extra reference due to the pending IO operation itself, but we'll |
327 // release that one before invoking user_callback_. | 327 // release that one before invoking user_callback_. |
328 entry_->AddRef(); // Balanced in DoAbortCallbacks. | 328 entry_->AddRef(); // Balanced in DoAbortCallbacks. |
329 abort_callbacks_.push_back(callback); | 329 abort_callbacks_.push_back(callback); |
330 return net::ERR_IO_PENDING; | 330 return net::ERR_IO_PENDING; |
331 } | 331 } |
332 | 332 |
333 // Static | 333 // Static |
334 void SparseControl::DeleteChildren(EntryImpl* entry) { | 334 void SparseControl::DeleteChildren(EntryImpl* entry) { |
335 DCHECK(entry); | |
336 DCHECK(entry->GetEntryFlags() & PARENT_ENTRY); | 335 DCHECK(entry->GetEntryFlags() & PARENT_ENTRY); |
337 int data_len = entry->GetDataSize(kSparseIndex); | 336 int data_len = entry->GetDataSize(kSparseIndex); |
338 if (data_len < static_cast<int>(sizeof(SparseData)) || | 337 if (data_len < static_cast<int>(sizeof(SparseData)) || |
339 entry->GetDataSize(kSparseData)) | 338 entry->GetDataSize(kSparseData)) |
340 return; | 339 return; |
341 | 340 |
342 int map_len = data_len - sizeof(SparseHeader); | 341 int map_len = data_len - sizeof(SparseHeader); |
343 if (map_len > kMaxMapSize || map_len % 4) | 342 if (map_len > kMaxMapSize || map_len % 4) |
344 return; | 343 return; |
345 | 344 |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 CompletionCallback cb = abort_callbacks_[i]; | 875 CompletionCallback cb = abort_callbacks_[i]; |
877 if (i == abort_callbacks_.size() - 1) | 876 if (i == abort_callbacks_.size() - 1) |
878 abort_callbacks_.clear(); | 877 abort_callbacks_.clear(); |
879 | 878 |
880 entry_->Release(); // Don't touch object after this line. | 879 entry_->Release(); // Don't touch object after this line. |
881 cb.Run(net::OK); | 880 cb.Run(net::OK); |
882 } | 881 } |
883 } | 882 } |
884 | 883 |
885 } // namespace disk_cache | 884 } // namespace disk_cache |
OLD | NEW |