OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/dom_storage/dom_storage_area.h" | 5 #include "content/browser/dom_storage/dom_storage_area.h" |
6 | 6 |
7 #include <inttypes.h> | |
8 | |
7 #include <algorithm> | 9 #include <algorithm> |
8 #include <cctype> // for std::isalnum | 10 #include <cctype> // for std::isalnum |
9 | 11 |
10 #include "base/bind.h" | 12 #include "base/bind.h" |
11 #include "base/location.h" | 13 #include "base/location.h" |
12 #include "base/logging.h" | 14 #include "base/logging.h" |
13 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
14 #include "base/process/process_info.h" | 16 #include "base/process/process_info.h" |
15 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
16 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
340 DCHECK(task_runner_->IsRunningOnPrimarySequence()); | 342 DCHECK(task_runner_->IsRunningOnPrimarySequence()); |
341 if (!is_initial_import_done_) | 343 if (!is_initial_import_done_) |
342 return; | 344 return; |
343 | 345 |
344 // Limit the url length to 50 and strip special characters. | 346 // Limit the url length to 50 and strip special characters. |
345 std::string url = origin_.spec().substr(0, 50); | 347 std::string url = origin_.spec().substr(0, 50); |
346 for (size_t index = 0; index < url.size(); ++index) { | 348 for (size_t index = 0; index < url.size(); ++index) { |
347 if (!std::isalnum(url[index])) | 349 if (!std::isalnum(url[index])) |
348 url[index] = '_'; | 350 url[index] = '_'; |
349 } | 351 } |
350 std::string name = StringPrintf("dom_storage/%s/%p", url.c_str(), this); | 352 std::string name = |
353 base::StringPrintf("dom_storage/%s/0x%" PRIXPTR, url.c_str(), | |
Primiano Tucci (use gerrit)
2016/06/14 08:33:51
uh, how is this working today without base? cannot
ssid
2016/06/14 20:28:15
So, we figured that C++ adds the namespaces of the
| |
354 reinterpret_cast<uintptr_t>(this)); | |
351 | 355 |
352 const char* system_allocator_name = | 356 const char* system_allocator_name = |
353 base::trace_event::MemoryDumpManager::GetInstance() | 357 base::trace_event::MemoryDumpManager::GetInstance() |
354 ->system_allocator_pool_name(); | 358 ->system_allocator_pool_name(); |
355 if (commit_batch_) { | 359 if (commit_batch_) { |
356 auto commit_batch_mad = pmd->CreateAllocatorDump(name + "/commit_batch"); | 360 auto commit_batch_mad = pmd->CreateAllocatorDump(name + "/commit_batch"); |
357 commit_batch_mad->AddScalar( | 361 commit_batch_mad->AddScalar( |
358 base::trace_event::MemoryAllocatorDump::kNameSize, | 362 base::trace_event::MemoryAllocatorDump::kNameSize, |
359 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 363 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
360 commit_batch_->GetDataSize()); | 364 commit_batch_->GetDataSize()); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
520 commit_batch_->clear_all_first, | 524 commit_batch_->clear_all_first, |
521 commit_batch_->changed_values); | 525 commit_batch_->changed_values); |
522 DCHECK(success); | 526 DCHECK(success); |
523 } | 527 } |
524 commit_batch_.reset(); | 528 commit_batch_.reset(); |
525 backing_.reset(); | 529 backing_.reset(); |
526 session_storage_backing_ = NULL; | 530 session_storage_backing_ = NULL; |
527 } | 531 } |
528 | 532 |
529 } // namespace content | 533 } // namespace content |
OLD | NEW |