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

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

Issue 1404433003: Rename 2 variables in discardable_shared_memory_heap.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_base
Patch Set: 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
« 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 "content/common/discardable_shared_memory_heap.h" 5 #include "content/common/discardable_shared_memory_heap.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/discardable_shared_memory.h" 10 #include "base/memory/discardable_shared_memory.h"
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 } 362 }
363 } 363 }
364 } 364 }
365 365
366 void DiscardableSharedMemoryHeap::OnMemoryDump( 366 void DiscardableSharedMemoryHeap::OnMemoryDump(
367 const base::DiscardableSharedMemory* shared_memory, 367 const base::DiscardableSharedMemory* shared_memory,
368 size_t size, 368 size_t size,
369 int32_t segment_id, 369 int32_t segment_id,
370 base::trace_event::ProcessMemoryDump* pmd) { 370 base::trace_event::ProcessMemoryDump* pmd) {
371 size_t allocated_objects_count = 0; 371 size_t allocated_objects_count = 0;
372 size_t allocated_objects_blocks = 0; 372 size_t allocated_objects_size_in_blocks = 0;
373 size_t locked_objects_blocks = 0; 373 size_t locked_objects_size_in_blocks = 0;
374 size_t offset = 374 size_t offset =
375 reinterpret_cast<size_t>(shared_memory->memory()) / block_size_; 375 reinterpret_cast<size_t>(shared_memory->memory()) / block_size_;
376 size_t end = offset + size / block_size_; 376 size_t end = offset + size / block_size_;
377 while (offset < end) { 377 while (offset < end) {
378 Span* span = spans_[offset]; 378 Span* span = spans_[offset];
379 if (!IsInFreeList(span)) { 379 if (!IsInFreeList(span)) {
380 allocated_objects_blocks += span->length_; 380 allocated_objects_size_in_blocks += span->length_;
381 locked_objects_blocks += span->is_locked_ ? span->length_ : 0; 381 locked_objects_size_in_blocks += span->is_locked_ ? span->length_ : 0;
382 allocated_objects_count++; 382 allocated_objects_count++;
383 } 383 }
384 offset += span->length_; 384 offset += span->length_;
385 } 385 }
386 size_t allocated_objects_size_in_bytes = 386 size_t allocated_objects_size_in_bytes =
387 allocated_objects_blocks * block_size_; 387 allocated_objects_size_in_blocks * block_size_;
388 size_t locked_objects_size_in_bytes = locked_objects_blocks * block_size_; 388 size_t locked_objects_size_in_bytes =
389 locked_objects_size_in_blocks * block_size_;
389 390
390 std::string segment_dump_name = 391 std::string segment_dump_name =
391 base::StringPrintf("discardable/segment_%d", segment_id); 392 base::StringPrintf("discardable/segment_%d", segment_id);
392 base::trace_event::MemoryAllocatorDump* segment_dump = 393 base::trace_event::MemoryAllocatorDump* segment_dump =
393 pmd->CreateAllocatorDump(segment_dump_name); 394 pmd->CreateAllocatorDump(segment_dump_name);
394 segment_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 395 segment_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
395 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 396 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
396 size); 397 size);
397 398
398 base::trace_event::MemoryAllocatorDump* obj_dump = 399 base::trace_event::MemoryAllocatorDump* obj_dump =
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 ScopedVector<ScopedMemorySegment>::const_iterator it = 449 ScopedVector<ScopedMemorySegment>::const_iterator it =
449 std::find_if(memory_segments_.begin(), memory_segments_.end(), 450 std::find_if(memory_segments_.begin(), memory_segments_.end(),
450 [span](const ScopedMemorySegment* segment) { 451 [span](const ScopedMemorySegment* segment) {
451 return segment->ContainsSpan(span); 452 return segment->ContainsSpan(span);
452 }); 453 });
453 DCHECK(it != memory_segments_.end()); 454 DCHECK(it != memory_segments_.end());
454 return (*it)->CreateMemoryAllocatorDump(span, block_size_, name, pmd); 455 return (*it)->CreateMemoryAllocatorDump(span, block_size_, name, pmd);
455 } 456 }
456 457
457 } // namespace content 458 } // namespace content
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