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

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

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 years, 8 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/fake_scoped_ui_resource.h ('k') | cc/test/fake_tile_manager.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/fake_scoped_ui_resource.h" 5 #include "cc/test/fake_scoped_ui_resource.h"
6 6
7 #include "base/memory/ptr_util.h"
7 #include "cc/trees/layer_tree_host.h" 8 #include "cc/trees/layer_tree_host.h"
8 9
9 namespace cc { 10 namespace cc {
10 11
11 namespace { 12 namespace {
12 13
13 UIResourceBitmap CreateMockUIResourceBitmap() { 14 UIResourceBitmap CreateMockUIResourceBitmap() {
14 bool is_opaque = false; 15 bool is_opaque = false;
15 return UIResourceBitmap(gfx::Size(1, 1), is_opaque); 16 return UIResourceBitmap(gfx::Size(1, 1), is_opaque);
16 } 17 }
17 18
18 } // anonymous namespace 19 } // anonymous namespace
19 20
20 scoped_ptr<FakeScopedUIResource> FakeScopedUIResource::Create( 21 std::unique_ptr<FakeScopedUIResource> FakeScopedUIResource::Create(
21 LayerTreeHost* host) { 22 LayerTreeHost* host) {
22 return make_scoped_ptr(new FakeScopedUIResource(host)); 23 return base::WrapUnique(new FakeScopedUIResource(host));
23 } 24 }
24 25
25 FakeScopedUIResource::FakeScopedUIResource(LayerTreeHost* host) 26 FakeScopedUIResource::FakeScopedUIResource(LayerTreeHost* host)
26 : ScopedUIResource(host, CreateMockUIResourceBitmap()) { 27 : ScopedUIResource(host, CreateMockUIResourceBitmap()) {
27 // The constructor of ScopedUIResource already created a resource so we need 28 // The constructor of ScopedUIResource already created a resource so we need
28 // to delete the created resource to wipe the state clean. 29 // to delete the created resource to wipe the state clean.
29 host_->DeleteUIResource(id_); 30 host_->DeleteUIResource(id_);
30 ResetCounters(); 31 ResetCounters();
31 id_ = host_->CreateUIResource(this); 32 id_ = host_->CreateUIResource(this);
32 } 33 }
33 34
34 UIResourceBitmap FakeScopedUIResource::GetBitmap(UIResourceId uid, 35 UIResourceBitmap FakeScopedUIResource::GetBitmap(UIResourceId uid,
35 bool resource_lost) { 36 bool resource_lost) {
36 resource_create_count++; 37 resource_create_count++;
37 if (resource_lost) 38 if (resource_lost)
38 lost_resource_count++; 39 lost_resource_count++;
39 return ScopedUIResource::GetBitmap(uid, resource_lost); 40 return ScopedUIResource::GetBitmap(uid, resource_lost);
40 } 41 }
41 42
42 void FakeScopedUIResource::ResetCounters() { 43 void FakeScopedUIResource::ResetCounters() {
43 resource_create_count = 0; 44 resource_create_count = 0;
44 lost_resource_count = 0; 45 lost_resource_count = 0;
45 } 46 }
46 47
47 } // namespace cc 48 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_scoped_ui_resource.h ('k') | cc/test/fake_tile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698