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/base/sdch_manager.h" | 5 #include "net/base/sdch_manager.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 for (const auto& dictionary : dictionaries_) { | 343 for (const auto& dictionary : dictionaries_) { |
344 total_size += dictionary.second->data.text().size(); | 344 total_size += dictionary.second->data.text().size(); |
345 } | 345 } |
346 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 346 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
347 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 347 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
348 total_size); | 348 total_size); |
349 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount, | 349 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount, |
350 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 350 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
351 total_count); | 351 total_count); |
352 } | 352 } |
| 353 |
353 // Create an empty row under parent's dump so size can be attributed correctly | 354 // Create an empty row under parent's dump so size can be attributed correctly |
354 // if |this| is shared between URLRequestContexts. | 355 // if |this| is shared between URLRequestContexts. It is not required if |
355 base::trace_event::MemoryAllocatorDump* empty_row_dump = | 356 // parent details are not reported. |
356 pmd->CreateAllocatorDump(parent_dump_absolute_name + "/sdch_manager"); | 357 if (!parent_dump_absolute_name.empty()) { |
357 pmd->AddOwnershipEdge(empty_row_dump->guid(), dump->guid()); | 358 base::trace_event::MemoryAllocatorDump* empty_row_dump = |
| 359 pmd->CreateAllocatorDump(parent_dump_absolute_name + "/sdch_manager"); |
| 360 pmd->AddOwnershipEdge(empty_row_dump->guid(), dump->guid()); |
| 361 } |
358 } | 362 } |
359 | 363 |
360 SdchProblemCode SdchManager::AddSdchDictionary( | 364 SdchProblemCode SdchManager::AddSdchDictionary( |
361 const std::string& dictionary_text, | 365 const std::string& dictionary_text, |
362 const GURL& dictionary_url, | 366 const GURL& dictionary_url, |
363 std::string* server_hash_p) { | 367 std::string* server_hash_p) { |
364 DCHECK(thread_checker_.CalledOnValidThread()); | 368 DCHECK(thread_checker_.CalledOnValidThread()); |
365 std::string client_hash; | 369 std::string client_hash; |
366 std::string server_hash; | 370 std::string server_hash; |
367 GenerateHash(dictionary_text, &client_hash, &server_hash); | 371 GenerateHash(dictionary_text, &client_hash, &server_hash); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 entry_dict->SetInteger("tries", it->second.count); | 531 entry_dict->SetInteger("tries", it->second.count); |
528 entry_dict->SetInteger("reason", it->second.reason); | 532 entry_dict->SetInteger("reason", it->second.reason); |
529 entry_list->Append(std::move(entry_dict)); | 533 entry_list->Append(std::move(entry_dict)); |
530 } | 534 } |
531 value->Set("blacklisted", std::move(entry_list)); | 535 value->Set("blacklisted", std::move(entry_list)); |
532 | 536 |
533 return std::move(value); | 537 return std::move(value); |
534 } | 538 } |
535 | 539 |
536 } // namespace net | 540 } // namespace net |
OLD | NEW |