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

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

Issue 1262333005: [tracing] Introduce MemoryDumpArgs to enable light and heavy dumps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 4 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 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // Close file descriptor to avoid running out. 147 // Close file descriptor to avoid running out.
148 memory->Close(); 148 memory->Close();
149 return make_scoped_ptr(new DiscardableMemoryImpl( 149 return make_scoped_ptr(new DiscardableMemoryImpl(
150 memory.Pass(), 150 memory.Pass(),
151 base::Bind( 151 base::Bind(
152 &HostDiscardableSharedMemoryManager::DeletedDiscardableSharedMemory, 152 &HostDiscardableSharedMemoryManager::DeletedDiscardableSharedMemory,
153 base::Unretained(this), new_id, ChildProcessHost::kInvalidUniqueID))); 153 base::Unretained(this), new_id, ChildProcessHost::kInvalidUniqueID)));
154 } 154 }
155 155
156 bool HostDiscardableSharedMemoryManager::OnMemoryDump( 156 bool HostDiscardableSharedMemoryManager::OnMemoryDump(
157 const base::trace_event::MemoryDumpArgs& args,
157 base::trace_event::ProcessMemoryDump* pmd) { 158 base::trace_event::ProcessMemoryDump* pmd) {
158 base::AutoLock lock(lock_); 159 base::AutoLock lock(lock_);
159 for (const auto& process_entry : processes_) { 160 for (const auto& process_entry : processes_) {
160 const int child_process_id = process_entry.first; 161 const int child_process_id = process_entry.first;
161 const MemorySegmentMap& process_segments = process_entry.second; 162 const MemorySegmentMap& process_segments = process_entry.second;
162 for (const auto& segment_entry : process_segments) { 163 for (const auto& segment_entry : process_segments) {
163 const int segment_id = segment_entry.first; 164 const int segment_id = segment_entry.first;
164 const MemorySegment* segment = segment_entry.second.get(); 165 const MemorySegment* segment = segment_entry.second.get();
165 std::string dump_name = base::StringPrintf( 166 std::string dump_name = base::StringPrintf(
166 "discardable/process_%x/segment_%d", child_process_id, segment_id); 167 "discardable/process_%x/segment_%d", child_process_id, segment_id);
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 456
456 enforce_memory_policy_pending_ = true; 457 enforce_memory_policy_pending_ = true;
457 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 458 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
458 FROM_HERE, 459 FROM_HERE,
459 base::Bind(&HostDiscardableSharedMemoryManager::EnforceMemoryPolicy, 460 base::Bind(&HostDiscardableSharedMemoryManager::EnforceMemoryPolicy,
460 weak_ptr_factory_.GetWeakPtr()), 461 weak_ptr_factory_.GetWeakPtr()),
461 base::TimeDelta::FromMilliseconds(kEnforceMemoryPolicyDelayMs)); 462 base::TimeDelta::FromMilliseconds(kEnforceMemoryPolicyDelayMs));
462 } 463 }
463 464
464 } // namespace content 465 } // namespace content
OLDNEW
« no previous file with comments | « content/common/host_discardable_shared_memory_manager.h ('k') | content/common/host_shared_bitmap_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698