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

Side by Side Diff: base/debug/activity_tracker.cc

Issue 2258713003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/debug/activity_tracker.h" 5 #include "base/debug/activity_tracker.h"
6 6
7 #include "base/debug/stack_trace.h" 7 #include "base/debug/stack_trace.h"
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/memory_mapped_file.h" 10 #include "base/files/memory_mapped_file.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 474
475 // Create and map the file into memory and make it globally available. 475 // Create and map the file into memory and make it globally available.
476 std::unique_ptr<MemoryMappedFile> mapped_file(new MemoryMappedFile()); 476 std::unique_ptr<MemoryMappedFile> mapped_file(new MemoryMappedFile());
477 bool success = 477 bool success =
478 mapped_file->Initialize(File(file_path, 478 mapped_file->Initialize(File(file_path,
479 File::FLAG_CREATE_ALWAYS | File::FLAG_READ | 479 File::FLAG_CREATE_ALWAYS | File::FLAG_READ |
480 File::FLAG_WRITE | File::FLAG_SHARE_DELETE), 480 File::FLAG_WRITE | File::FLAG_SHARE_DELETE),
481 {0, static_cast<int64_t>(size)}, 481 {0, static_cast<int64_t>(size)},
482 MemoryMappedFile::READ_WRITE_EXTEND); 482 MemoryMappedFile::READ_WRITE_EXTEND);
483 DCHECK(success); 483 DCHECK(success);
484 CreateWithAllocator(WrapUnique(new FilePersistentMemoryAllocator( 484 CreateWithAllocator(MakeUnique<FilePersistentMemoryAllocator>(
485 std::move(mapped_file), size, id, name, false)), 485 std::move(mapped_file), size, id, name, false),
486 stack_depth); 486 stack_depth);
487 } 487 }
488 #endif // !defined(OS_NACL) 488 #endif // !defined(OS_NACL)
489 489
490 // static 490 // static
491 void GlobalActivityTracker::CreateWithLocalMemory(size_t size, 491 void GlobalActivityTracker::CreateWithLocalMemory(size_t size,
492 uint64_t id, 492 uint64_t id,
493 StringPiece name, 493 StringPiece name,
494 int stack_depth) { 494 int stack_depth) {
495 CreateWithAllocator( 495 CreateWithAllocator(
496 WrapUnique(new LocalPersistentMemoryAllocator(size, id, name)), 496 MakeUnique<LocalPersistentMemoryAllocator>(size, id, name), stack_depth);
497 stack_depth);
498 } 497 }
499 498
500 ThreadActivityTracker* GlobalActivityTracker::CreateTrackerForCurrentThread() { 499 ThreadActivityTracker* GlobalActivityTracker::CreateTrackerForCurrentThread() {
501 DCHECK(!this_thread_tracker_.Get()); 500 DCHECK(!this_thread_tracker_.Get());
502 501
503 PersistentMemoryAllocator::Reference mem_reference = 0; 502 PersistentMemoryAllocator::Reference mem_reference = 0;
504 void* mem_base = nullptr; 503 void* mem_base = nullptr;
505 504
506 // Get the current count of available memories, acquiring the array values. 505 // Get the current count of available memories, acquiring the array values.
507 int count = available_memories_count_.load(std::memory_order_acquire); 506 int count = available_memories_count_.load(std::memory_order_acquire);
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 const base::Process* process) 769 const base::Process* process)
771 : GlobalActivityTracker::ScopedThreadActivity( 770 : GlobalActivityTracker::ScopedThreadActivity(
772 nullptr, 771 nullptr,
773 Activity::ACT_PROCESS_WAIT, 772 Activity::ACT_PROCESS_WAIT,
774 ActivityData::ForProcess(process->Pid()), 773 ActivityData::ForProcess(process->Pid()),
775 /*lock_allowed=*/true) {} 774 /*lock_allowed=*/true) {}
776 #endif 775 #endif
777 776
778 } // namespace debug 777 } // namespace debug
779 } // namespace base 778 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698