Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: net/base/sdch_manager.cc

Issue 2699163002: Whitelist net/ MemoryDumpProvider (Closed)
Patch Set: fix test on windows Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <inttypes.h>
7 #include <limits.h> 8 #include <limits.h>
8 9
9 #include <utility> 10 #include <utility>
10 11
11 #include "base/base64url.h" 12 #include "base/base64url.h"
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "base/metrics/histogram_macros.h" 14 #include "base/metrics/histogram_macros.h"
14 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
16 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 329 }
329 330
330 void SdchManager::DumpMemoryStats( 331 void SdchManager::DumpMemoryStats(
331 base::trace_event::ProcessMemoryDump* pmd, 332 base::trace_event::ProcessMemoryDump* pmd,
332 const std::string& parent_dump_absolute_name) const { 333 const std::string& parent_dump_absolute_name) const {
333 // If there are no dictionaries stored, return early without creating a new 334 // If there are no dictionaries stored, return early without creating a new
334 // MemoryAllocatorDump. 335 // MemoryAllocatorDump.
335 size_t total_count = dictionaries_.size(); 336 size_t total_count = dictionaries_.size();
336 if (total_count == 0) 337 if (total_count == 0)
337 return; 338 return;
338 std::string name = base::StringPrintf("net/sdch_manager_%p", this); 339 std::string name = base::StringPrintf("net/sdch_manager_0x%" PRIxPTR,
340 reinterpret_cast<uintptr_t>(this));
339 base::trace_event::MemoryAllocatorDump* dump = pmd->GetAllocatorDump(name); 341 base::trace_event::MemoryAllocatorDump* dump = pmd->GetAllocatorDump(name);
340 if (dump == nullptr) { 342 if (dump == nullptr) {
341 dump = pmd->CreateAllocatorDump(name); 343 dump = pmd->CreateAllocatorDump(name);
342 size_t total_size = 0; 344 size_t total_size = 0;
343 for (const auto& dictionary : dictionaries_) { 345 for (const auto& dictionary : dictionaries_) {
344 total_size += dictionary.second->data.text().size(); 346 total_size += dictionary.second->data.text().size();
345 } 347 }
346 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 348 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
347 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 349 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
348 total_size); 350 total_size);
349 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount, 351 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount,
350 base::trace_event::MemoryAllocatorDump::kUnitsObjects, 352 base::trace_event::MemoryAllocatorDump::kUnitsObjects,
351 total_count); 353 total_count);
352 } 354 }
355
353 // Create an empty row under parent's dump so size can be attributed correctly 356 // Create an empty row under parent's dump so size can be attributed correctly
354 // if |this| is shared between URLRequestContexts. 357 // if |this| is shared between URLRequestContexts.
355 base::trace_event::MemoryAllocatorDump* empty_row_dump = 358 base::trace_event::MemoryAllocatorDump* empty_row_dump =
356 pmd->CreateAllocatorDump(parent_dump_absolute_name + "/sdch_manager"); 359 pmd->CreateAllocatorDump(parent_dump_absolute_name + "/sdch_manager");
357 pmd->AddOwnershipEdge(empty_row_dump->guid(), dump->guid()); 360 pmd->AddOwnershipEdge(empty_row_dump->guid(), dump->guid());
358 } 361 }
359 362
360 SdchProblemCode SdchManager::AddSdchDictionary( 363 SdchProblemCode SdchManager::AddSdchDictionary(
361 const std::string& dictionary_text, 364 const std::string& dictionary_text,
362 const GURL& dictionary_url, 365 const GURL& dictionary_url,
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 entry_dict->SetInteger("tries", it->second.count); 530 entry_dict->SetInteger("tries", it->second.count);
528 entry_dict->SetInteger("reason", it->second.reason); 531 entry_dict->SetInteger("reason", it->second.reason);
529 entry_list->Append(std::move(entry_dict)); 532 entry_list->Append(std::move(entry_dict));
530 } 533 }
531 value->Set("blacklisted", std::move(entry_list)); 534 value->Set("blacklisted", std::move(entry_list));
532 535
533 return std::move(value); 536 return std::move(value);
534 } 537 }
535 538
536 } // namespace net 539 } // namespace net
OLDNEW
« no previous file with comments | « base/trace_event/memory_infra_background_whitelist.cc ('k') | net/base/sdch_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698