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/mem_entry_impl.h" | 5 #include "net/disk_cache/mem_entry_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 // Returns a name for a child entry given the base_name of the parent and the | 38 // Returns a name for a child entry given the base_name of the parent and the |
39 // child_id. This name is only used for logging purposes. | 39 // child_id. This name is only used for logging purposes. |
40 // If the entry is called entry_name, child entries will be named something | 40 // If the entry is called entry_name, child entries will be named something |
41 // like Range_entry_name:YYY where YYY is the number of the particular child. | 41 // like Range_entry_name:YYY where YYY is the number of the particular child. |
42 std::string GenerateChildName(const std::string& base_name, int child_id) { | 42 std::string GenerateChildName(const std::string& base_name, int child_id) { |
43 return base::StringPrintf("Range_%s:%i", base_name.c_str(), child_id); | 43 return base::StringPrintf("Range_%s:%i", base_name.c_str(), child_id); |
44 } | 44 } |
45 | 45 |
46 // Returns NetLog parameters for the creation of a child MemEntryImpl. Separate | 46 // Returns NetLog parameters for the creation of a child MemEntryImpl. Separate |
47 // function needed because child entries don't suppport GetKey(). | 47 // function needed because child entries don't suppport GetKey(). |
48 Value* NetLogChildEntryCreationCallback(const disk_cache::MemEntryImpl* parent, | 48 base::Value* NetLogChildEntryCreationCallback( |
49 int child_id, | 49 const disk_cache::MemEntryImpl* parent, |
50 net::NetLog::LogLevel /* log_level */) { | 50 int child_id, |
51 DictionaryValue* dict = new DictionaryValue(); | 51 net::NetLog::LogLevel /* log_level */) { |
| 52 base::DictionaryValue* dict = new base::DictionaryValue(); |
52 dict->SetString("key", GenerateChildName(parent->GetKey(), child_id)); | 53 dict->SetString("key", GenerateChildName(parent->GetKey(), child_id)); |
53 dict->SetBoolean("created", true); | 54 dict->SetBoolean("created", true); |
54 return dict; | 55 return dict; |
55 } | 56 } |
56 | 57 |
57 } // namespace | 58 } // namespace |
58 | 59 |
59 namespace disk_cache { | 60 namespace disk_cache { |
60 | 61 |
61 MemEntryImpl::MemEntryImpl(MemBackendImpl* backend) { | 62 MemEntryImpl::MemEntryImpl(MemBackendImpl* backend) { |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 scanned_len += kMaxSparseEntrySize - current_child_offset; | 622 scanned_len += kMaxSparseEntrySize - current_child_offset; |
622 } | 623 } |
623 return scanned_len; | 624 return scanned_len; |
624 } | 625 } |
625 | 626 |
626 void MemEntryImpl::DetachChild(int child_id) { | 627 void MemEntryImpl::DetachChild(int child_id) { |
627 children_->erase(child_id); | 628 children_->erase(child_id); |
628 } | 629 } |
629 | 630 |
630 } // namespace disk_cache | 631 } // namespace disk_cache |
OLD | NEW |