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

Side by Side Diff: cc/layers/heads_up_display_layer_impl.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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/layers/heads_up_display_layer_impl.h" 5 #include "cc/layers/heads_up_display_layer_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 int id) 73 int id)
74 : LayerImpl(tree_impl, id), 74 : LayerImpl(tree_impl, id),
75 internal_contents_scale_(1.f), 75 internal_contents_scale_(1.f),
76 fps_graph_(60.0, 80.0), 76 fps_graph_(60.0, 80.0),
77 paint_time_graph_(16.0, 48.0), 77 paint_time_graph_(16.0, 48.0),
78 fade_step_(0) { 78 fade_step_(0) {
79 } 79 }
80 80
81 HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() {} 81 HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() {}
82 82
83 scoped_ptr<LayerImpl> HeadsUpDisplayLayerImpl::CreateLayerImpl( 83 std::unique_ptr<LayerImpl> HeadsUpDisplayLayerImpl::CreateLayerImpl(
84 LayerTreeImpl* tree_impl) { 84 LayerTreeImpl* tree_impl) {
85 return HeadsUpDisplayLayerImpl::Create(tree_impl, id()); 85 return HeadsUpDisplayLayerImpl::Create(tree_impl, id());
86 } 86 }
87 87
88 void HeadsUpDisplayLayerImpl::AcquireResource( 88 void HeadsUpDisplayLayerImpl::AcquireResource(
89 ResourceProvider* resource_provider) { 89 ResourceProvider* resource_provider) {
90 for (auto& resource : resources_) { 90 for (auto& resource : resources_) {
91 if (!resource_provider->InUseByConsumer(resource->id())) { 91 if (!resource_provider->InUseByConsumer(resource->id())) {
92 resource.swap(resources_.back()); 92 resource.swap(resources_.back());
93 return; 93 return;
94 } 94 }
95 } 95 }
96 96
97 scoped_ptr<ScopedResource> resource = 97 std::unique_ptr<ScopedResource> resource =
98 ScopedResource::Create(resource_provider); 98 ScopedResource::Create(resource_provider);
99 resource->Allocate(internal_content_bounds_, 99 resource->Allocate(internal_content_bounds_,
100 ResourceProvider::TEXTURE_HINT_IMMUTABLE, 100 ResourceProvider::TEXTURE_HINT_IMMUTABLE,
101 resource_provider->best_texture_format()); 101 resource_provider->best_texture_format());
102 resources_.push_back(std::move(resource)); 102 resources_.push_back(std::move(resource));
103 } 103 }
104 104
105 void HeadsUpDisplayLayerImpl::ReleaseUnmatchedSizeResources( 105 void HeadsUpDisplayLayerImpl::ReleaseUnmatchedSizeResources(
106 ResourceProvider* resource_provider) { 106 ResourceProvider* resource_provider) {
107 auto it_erase = 107 auto it_erase =
108 std::remove_if(resources_.begin(), resources_.end(), 108 std::remove_if(resources_.begin(), resources_.end(),
109 [this](const scoped_ptr<ScopedResource>& resource) { 109 [this](const std::unique_ptr<ScopedResource>& resource) {
110 return internal_content_bounds_ != resource->size(); 110 return internal_content_bounds_ != resource->size();
111 }); 111 });
112 resources_.erase(it_erase, resources_.end()); 112 resources_.erase(it_erase, resources_.end());
113 } 113 }
114 114
115 bool HeadsUpDisplayLayerImpl::WillDraw(DrawMode draw_mode, 115 bool HeadsUpDisplayLayerImpl::WillDraw(DrawMode draw_mode,
116 ResourceProvider* resource_provider) { 116 ResourceProvider* resource_provider) {
117 if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) 117 if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE)
118 return false; 118 return false;
119 119
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 return "cc::HeadsUpDisplayLayerImpl"; 808 return "cc::HeadsUpDisplayLayerImpl";
809 } 809 }
810 810
811 void HeadsUpDisplayLayerImpl::AsValueInto( 811 void HeadsUpDisplayLayerImpl::AsValueInto(
812 base::trace_event::TracedValue* dict) const { 812 base::trace_event::TracedValue* dict) const {
813 LayerImpl::AsValueInto(dict); 813 LayerImpl::AsValueInto(dict);
814 dict->SetString("layer_name", "Heads Up Display Layer"); 814 dict->SetString("layer_name", "Heads Up Display Layer");
815 } 815 }
816 816
817 } // namespace cc 817 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/heads_up_display_layer_impl.h ('k') | cc/layers/heads_up_display_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698