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

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

Issue 1398163003: Handle EAGAIN error for the mincore syscall used (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@resident
Patch Set: Rebase. Created 5 years, 2 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 child_process_id); 203 child_process_id);
204 base::trace_event::MemoryAllocatorDumpGuid shared_segment_guid = 204 base::trace_event::MemoryAllocatorDumpGuid shared_segment_guid =
205 DiscardableSharedMemoryHeap::GetSegmentGUIDForTracing( 205 DiscardableSharedMemoryHeap::GetSegmentGUIDForTracing(
206 child_tracing_process_id, segment_id); 206 child_tracing_process_id, segment_id);
207 pmd->CreateSharedGlobalAllocatorDump(shared_segment_guid); 207 pmd->CreateSharedGlobalAllocatorDump(shared_segment_guid);
208 pmd->AddOwnershipEdge(dump->guid(), shared_segment_guid); 208 pmd->AddOwnershipEdge(dump->guid(), shared_segment_guid);
209 209
210 #if defined(COUNT_RESIDENT_BYTES_SUPPORTED) 210 #if defined(COUNT_RESIDENT_BYTES_SUPPORTED)
211 if (args.level_of_detail == 211 if (args.level_of_detail ==
212 base::trace_event::MemoryDumpLevelOfDetail::DETAILED) { 212 base::trace_event::MemoryDumpLevelOfDetail::DETAILED) {
213 size_t resident_size = 213 size_t resident_size;
214 base::trace_event::ProcessMemoryDump::CountResidentBytes(
215 segment->memory()->memory(), segment->memory()->mapped_size());
216 214
217 // This is added to the global dump since it has to be attributed to 215 // This is added to the global dump since it has to be attributed to
218 // both the allocator dumps involved. 216 // both the allocator dumps involved.
219 pmd->GetSharedGlobalAllocatorDump(shared_segment_guid) 217 if (base::trace_event::ProcessMemoryDump::CountResidentBytes(
220 ->AddScalar("resident_size", 218 segment->memory()->memory(), segment->memory()->mapped_size(),
221 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 219 &resident_size)) {
222 static_cast<uint64>(resident_size)); 220 pmd->GetSharedGlobalAllocatorDump(shared_segment_guid)
221 ->AddScalar("resident_size",
222 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
223 static_cast<uint64>(resident_size));
224 } else {
225 NOTREACHED();
reveman 2015/10/14 12:31:29 please bool rv = base::trace_event::ProcessMemory
ssid 2015/10/14 12:44:29 In general it should not fail. What I want is in r
reveman 2015/10/14 13:03:53 ok, sounds good. I don't like when NOTREACHED/DCHE
ssid 2015/10/14 13:35:55 Done.
226 }
223 } 227 }
224 #endif // defined(COUNT_RESIDENT_BYTES_SUPPORTED) 228 #endif // defined(COUNT_RESIDENT_BYTES_SUPPORTED)
225 } 229 }
226 } 230 }
227 return true; 231 return true;
228 } 232 }
229 233
230 void HostDiscardableSharedMemoryManager:: 234 void HostDiscardableSharedMemoryManager::
231 AllocateLockedDiscardableSharedMemoryForChild( 235 AllocateLockedDiscardableSharedMemoryForChild(
232 base::ProcessHandle process_handle, 236 base::ProcessHandle process_handle,
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 496
493 enforce_memory_policy_pending_ = true; 497 enforce_memory_policy_pending_ = true;
494 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 498 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
495 FROM_HERE, 499 FROM_HERE,
496 base::Bind(&HostDiscardableSharedMemoryManager::EnforceMemoryPolicy, 500 base::Bind(&HostDiscardableSharedMemoryManager::EnforceMemoryPolicy,
497 weak_ptr_factory_.GetWeakPtr()), 501 weak_ptr_factory_.GetWeakPtr()),
498 base::TimeDelta::FromMilliseconds(kEnforceMemoryPolicyDelayMs)); 502 base::TimeDelta::FromMilliseconds(kEnforceMemoryPolicyDelayMs));
499 } 503 }
500 504
501 } // namespace content 505 } // namespace content
OLDNEW
« base/trace_event/process_memory_dump.cc ('K') | « base/trace_event/process_memory_dump_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698