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

Side by Side Diff: components/discardable_memory/common/discardable_shared_memory_heap.cc

Issue 2668193002: [memory-infra] Make client discardable segments non-weak (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | 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 "components/discardable_memory/common/discardable_shared_memory_heap.h" 5 #include "components/discardable_memory/common/discardable_shared_memory_heap.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 // to avoid double-counting segments when both browser and client process emit 419 // to avoid double-counting segments when both browser and client process emit
420 // them. In the special case of single-process-mode, this will be the only 420 // them. In the special case of single-process-mode, this will be the only
421 // dumper active and the single ownership edge will become a no-op in the UI. 421 // dumper active and the single ownership edge will become a no-op in the UI.
422 // The global dump is created as a weak dump so that the segment is removed if 422 // The global dump is created as a weak dump so that the segment is removed if
423 // the browser does not dump it (segment was purged). 423 // the browser does not dump it (segment was purged).
424 const uint64_t tracing_process_id = 424 const uint64_t tracing_process_id =
425 base::trace_event::MemoryDumpManager::GetInstance() 425 base::trace_event::MemoryDumpManager::GetInstance()
426 ->GetTracingProcessId(); 426 ->GetTracingProcessId();
427 base::trace_event::MemoryAllocatorDumpGuid shared_segment_guid = 427 base::trace_event::MemoryAllocatorDumpGuid shared_segment_guid =
428 GetSegmentGUIDForTracing(tracing_process_id, segment_id); 428 GetSegmentGUIDForTracing(tracing_process_id, segment_id);
429 pmd->CreateWeakSharedGlobalAllocatorDump(shared_segment_guid); 429 // TODO(ssid): Make this weak once the GUID created is consistent
430 // crbug.com/661257.
431 pmd->CreateSharedGlobalAllocatorDump(shared_segment_guid);
430 432
431 // The size is added to the global dump so that it gets propagated to both the 433 // The size is added to the global dump so that it gets propagated to both the
432 // dumps associated. 434 // dumps associated.
433 pmd->GetSharedGlobalAllocatorDump(shared_segment_guid) 435 pmd->GetSharedGlobalAllocatorDump(shared_segment_guid)
434 ->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 436 ->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
435 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 437 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
436 allocated_objects_size_in_bytes); 438 allocated_objects_size_in_bytes);
437 439
438 // By creating an edge with a higher |importance| (w.r.t. browser-side dumps) 440 // By creating an edge with a higher |importance| (w.r.t. browser-side dumps)
439 // the tracing UI will account the effective size of the segment to the 441 // the tracing UI will account the effective size of the segment to the
(...skipping 27 matching lines...) Expand all
467 ScopedVector<ScopedMemorySegment>::const_iterator it = 469 ScopedVector<ScopedMemorySegment>::const_iterator it =
468 std::find_if(memory_segments_.begin(), memory_segments_.end(), 470 std::find_if(memory_segments_.begin(), memory_segments_.end(),
469 [span](const ScopedMemorySegment* segment) { 471 [span](const ScopedMemorySegment* segment) {
470 return segment->ContainsSpan(span); 472 return segment->ContainsSpan(span);
471 }); 473 });
472 DCHECK(it != memory_segments_.end()); 474 DCHECK(it != memory_segments_.end());
473 return (*it)->CreateMemoryAllocatorDump(span, block_size_, name, pmd); 475 return (*it)->CreateMemoryAllocatorDump(span, block_size_, name, pmd);
474 } 476 }
475 477
476 } // namespace discardable_memory 478 } // namespace discardable_memory
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698