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

Side by Side Diff: content/common/host_discardable_shared_memory_manager.cc

Issue 1028853002: content: Crash key and trace counter cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « content/child/child_discardable_shared_memory_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/common/host_discardable_shared_memory_manager.h" 5 #include "content/common/host_discardable_shared_memory_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 // is that the memory will be released to the OS if the child process is 391 // is that the memory will be released to the OS if the child process is
392 // no longer referencing it. 392 // no longer referencing it.
393 // Note: We intentionally leave the segment in the |segments| vector to 393 // Note: We intentionally leave the segment in the |segments| vector to
394 // avoid reconstructing the heap. The element will be removed from the heap 394 // avoid reconstructing the heap. The element will be removed from the heap
395 // when its last usage time is older than all other segments. 395 // when its last usage time is older than all other segments.
396 memory->Close(); 396 memory->Close();
397 } 397 }
398 398
399 void HostDiscardableSharedMemoryManager::BytesAllocatedChanged( 399 void HostDiscardableSharedMemoryManager::BytesAllocatedChanged(
400 size_t new_bytes_allocated) const { 400 size_t new_bytes_allocated) const {
401 TRACE_COUNTER_ID1("renderer_host", "TotalDiscardableMemoryUsage", this, 401 TRACE_COUNTER1("renderer_host", "TotalDiscardableMemoryUsage",
402 new_bytes_allocated); 402 new_bytes_allocated);
403 403
404 static const char kTotalDiscardableMemoryUsageKey[] = "total-dm-usage"; 404 static const char kTotalDiscardableMemoryAllocatedKey[] =
405 base::debug::SetCrashKeyValue(kTotalDiscardableMemoryUsageKey, 405 "total-discardable-memory-allocated";
406 base::debug::SetCrashKeyValue(kTotalDiscardableMemoryAllocatedKey,
406 base::Uint64ToString(new_bytes_allocated)); 407 base::Uint64ToString(new_bytes_allocated));
407 } 408 }
408 409
409 base::Time HostDiscardableSharedMemoryManager::Now() const { 410 base::Time HostDiscardableSharedMemoryManager::Now() const {
410 return base::Time::Now(); 411 return base::Time::Now();
411 } 412 }
412 413
413 void HostDiscardableSharedMemoryManager::ScheduleEnforceMemoryPolicy() { 414 void HostDiscardableSharedMemoryManager::ScheduleEnforceMemoryPolicy() {
414 lock_.AssertAcquired(); 415 lock_.AssertAcquired();
415 416
416 if (enforce_memory_policy_pending_) 417 if (enforce_memory_policy_pending_)
417 return; 418 return;
418 419
419 enforce_memory_policy_pending_ = true; 420 enforce_memory_policy_pending_ = true;
420 base::MessageLoop::current()->PostDelayedTask( 421 base::MessageLoop::current()->PostDelayedTask(
421 FROM_HERE, 422 FROM_HERE,
422 base::Bind(&HostDiscardableSharedMemoryManager::EnforceMemoryPolicy, 423 base::Bind(&HostDiscardableSharedMemoryManager::EnforceMemoryPolicy,
423 weak_ptr_factory_.GetWeakPtr()), 424 weak_ptr_factory_.GetWeakPtr()),
424 base::TimeDelta::FromMilliseconds(kEnforceMemoryPolicyDelayMs)); 425 base::TimeDelta::FromMilliseconds(kEnforceMemoryPolicyDelayMs));
425 } 426 }
426 427
427 } // namespace content 428 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_discardable_shared_memory_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698