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

Side by Side Diff: cc/test/test_shared_bitmap_manager.cc

Issue 2258833002: 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, 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
« no previous file with comments | « cc/test/test_layer_tree_host_base.cc ('k') | cc/tiles/eviction_tile_priority_queue.cc » ('j') | 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 "cc/test/test_shared_bitmap_manager.h" 5 #include "cc/test/test_shared_bitmap_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 20 matching lines...) Expand all
31 31
32 TestSharedBitmapManager::~TestSharedBitmapManager() {} 32 TestSharedBitmapManager::~TestSharedBitmapManager() {}
33 33
34 std::unique_ptr<SharedBitmap> TestSharedBitmapManager::AllocateSharedBitmap( 34 std::unique_ptr<SharedBitmap> TestSharedBitmapManager::AllocateSharedBitmap(
35 const gfx::Size& size) { 35 const gfx::Size& size) {
36 base::AutoLock lock(lock_); 36 base::AutoLock lock(lock_);
37 std::unique_ptr<base::SharedMemory> memory(new base::SharedMemory); 37 std::unique_ptr<base::SharedMemory> memory(new base::SharedMemory);
38 memory->CreateAndMapAnonymous(size.GetArea() * 4); 38 memory->CreateAndMapAnonymous(size.GetArea() * 4);
39 SharedBitmapId id = SharedBitmap::GenerateId(); 39 SharedBitmapId id = SharedBitmap::GenerateId();
40 bitmap_map_[id] = memory.get(); 40 bitmap_map_[id] = memory.get();
41 return base::WrapUnique(new OwnedSharedBitmap(std::move(memory), id)); 41 return base::MakeUnique<OwnedSharedBitmap>(std::move(memory), id);
42 } 42 }
43 43
44 std::unique_ptr<SharedBitmap> TestSharedBitmapManager::GetSharedBitmapFromId( 44 std::unique_ptr<SharedBitmap> TestSharedBitmapManager::GetSharedBitmapFromId(
45 const gfx::Size&, 45 const gfx::Size&,
46 const SharedBitmapId& id) { 46 const SharedBitmapId& id) {
47 base::AutoLock lock(lock_); 47 base::AutoLock lock(lock_);
48 if (bitmap_map_.find(id) == bitmap_map_.end()) 48 if (bitmap_map_.find(id) == bitmap_map_.end())
49 return nullptr; 49 return nullptr;
50 uint8_t* pixels = static_cast<uint8_t*>(bitmap_map_[id]->memory()); 50 uint8_t* pixels = static_cast<uint8_t*>(bitmap_map_[id]->memory());
51 return base::WrapUnique(new SharedBitmap(pixels, id)); 51 return base::MakeUnique<SharedBitmap>(pixels, id);
52 } 52 }
53 53
54 } // namespace cc 54 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_layer_tree_host_base.cc ('k') | cc/tiles/eviction_tile_priority_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698