| 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/memory/mem_entry_impl.h" | 5 #include "net/disk_cache/memory/mem_entry_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // Returns a name for a child entry given the base_name of the parent and the | 43 // Returns a name for a child entry given the base_name of the parent and the |
| 44 // child_id. This name is only used for logging purposes. | 44 // child_id. This name is only used for logging purposes. |
| 45 // If the entry is called entry_name, child entries will be named something | 45 // If the entry is called entry_name, child entries will be named something |
| 46 // like Range_entry_name:YYY where YYY is the number of the particular child. | 46 // like Range_entry_name:YYY where YYY is the number of the particular child. |
| 47 std::string GenerateChildName(const std::string& base_name, int child_id) { | 47 std::string GenerateChildName(const std::string& base_name, int child_id) { |
| 48 return base::StringPrintf("Range_%s:%i", base_name.c_str(), child_id); | 48 return base::StringPrintf("Range_%s:%i", base_name.c_str(), child_id); |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Returns NetLog parameters for the creation of a MemEntryImpl. A separate | 51 // Returns NetLog parameters for the creation of a MemEntryImpl. A separate |
| 52 // function is needed because child entries don't store their key(). | 52 // function is needed because child entries don't store their key(). |
| 53 scoped_ptr<base::Value> NetLogEntryCreationCallback( | 53 std::unique_ptr<base::Value> NetLogEntryCreationCallback( |
| 54 const MemEntryImpl* entry, | 54 const MemEntryImpl* entry, |
| 55 net::NetLogCaptureMode /* capture_mode */) { | 55 net::NetLogCaptureMode /* capture_mode */) { |
| 56 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 56 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 57 std::string key; | 57 std::string key; |
| 58 switch (entry->type()) { | 58 switch (entry->type()) { |
| 59 case MemEntryImpl::PARENT_ENTRY: | 59 case MemEntryImpl::PARENT_ENTRY: |
| 60 key = entry->key(); | 60 key = entry->key(); |
| 61 break; | 61 break; |
| 62 case MemEntryImpl::CHILD_ENTRY: | 62 case MemEntryImpl::CHILD_ENTRY: |
| 63 key = GenerateChildName(entry->parent()->key(), entry->child_id()); | 63 key = GenerateChildName(entry->parent()->key(), entry->child_id()); |
| 64 break; | 64 break; |
| 65 } | 65 } |
| 66 dict->SetString("key", key); | 66 dict->SetString("key", key); |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 scanned_len += first_pos - current_child_offset; | 582 scanned_len += first_pos - current_child_offset; |
| 583 break; | 583 break; |
| 584 } | 584 } |
| 585 } | 585 } |
| 586 scanned_len += kMaxSparseEntrySize - current_child_offset; | 586 scanned_len += kMaxSparseEntrySize - current_child_offset; |
| 587 } | 587 } |
| 588 return scanned_len; | 588 return scanned_len; |
| 589 } | 589 } |
| 590 | 590 |
| 591 } // namespace disk_cache | 591 } // namespace disk_cache |
| OLD | NEW |