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

Unified Diff: cc/layers/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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_impl.cc
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 3c41b1832c7d6e35b48cd6b1a45f31e16bac15fa..8f750fbd3e7008ca85dd36ebde4a125c0afa3d69 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -11,6 +11,7 @@
#include <utility>
#include "base/json/json_reader.h"
+#include "base/memory/ptr_util.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/trace_event/trace_event.h"
@@ -123,14 +124,14 @@ LayerImpl::~LayerImpl() {
ClearChildList();
}
-void LayerImpl::AddChild(scoped_ptr<LayerImpl> child) {
+void LayerImpl::AddChild(std::unique_ptr<LayerImpl> child) {
child->SetParent(this);
DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl());
children_.push_back(child.get());
layer_tree_impl_->AddLayer(std::move(child));
}
-scoped_ptr<LayerImpl> LayerImpl::RemoveChildForTesting(LayerImpl* child) {
+std::unique_ptr<LayerImpl> LayerImpl::RemoveChildForTesting(LayerImpl* child) {
auto it = std::find(children_.begin(), children_.end(), child);
if (it != children_.end())
children_.erase(it);
@@ -167,7 +168,7 @@ void LayerImpl::SetScrollParent(LayerImpl* parent) {
}
void LayerImpl::SetDebugInfo(
- scoped_ptr<base::trace_event::ConvertableToTraceFormat> debug_info) {
+ std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info) {
owned_debug_info_ = std::move(debug_info);
debug_info_ = owned_debug_info_.get();
SetNeedsPushProperties();
@@ -249,7 +250,7 @@ void LayerImpl::SetScrollTreeIndex(int index) {
}
void LayerImpl::PassCopyRequests(
- std::vector<scoped_ptr<CopyOutputRequest>>* requests) {
+ std::vector<std::unique_ptr<CopyOutputRequest>>* requests) {
// In the case that a layer still has a copy request, this means that there's
// a commit to the active tree without a draw. This only happens in some
// edge cases during lost context or visibility changes, so don't try to
@@ -273,7 +274,7 @@ void LayerImpl::PassCopyRequests(
}
void LayerImpl::TakeCopyRequestsAndTransformToTarget(
- std::vector<scoped_ptr<CopyOutputRequest>>* requests) {
+ std::vector<std::unique_ptr<CopyOutputRequest>>* requests) {
DCHECK(!copy_requests_.empty());
DCHECK(layer_tree_impl()->IsActiveTree());
DCHECK_EQ(render_target(), this);
@@ -461,7 +462,8 @@ bool LayerImpl::user_scrollable(ScrollbarOrientation orientation) const {
: user_scrollable_vertical_;
}
-scoped_ptr<LayerImpl> LayerImpl::CreateLayerImpl(LayerTreeImpl* tree_impl) {
+std::unique_ptr<LayerImpl> LayerImpl::CreateLayerImpl(
+ LayerTreeImpl* tree_impl) {
return LayerImpl::Create(tree_impl, layer_id_);
}
@@ -651,7 +653,7 @@ base::DictionaryValue* LayerImpl::LayerTreeAsJson() const {
result->SetBoolean("Scrollable", true);
if (!touch_event_handler_region_.IsEmpty()) {
- scoped_ptr<base::Value> region = touch_event_handler_region_.AsValue();
+ std::unique_ptr<base::Value> region = touch_event_handler_region_.AsValue();
result->Set("TouchRegion", region.release());
}
@@ -979,7 +981,7 @@ void LayerImpl::SetBoundsDelta(const gfx::Vector2dF& bounds_delta) {
}
}
-void LayerImpl::SetMaskLayer(scoped_ptr<LayerImpl> mask_layer) {
+void LayerImpl::SetMaskLayer(std::unique_ptr<LayerImpl> mask_layer) {
int new_layer_id = mask_layer ? mask_layer->id() : -1;
if (mask_layer) {
@@ -998,16 +1000,16 @@ void LayerImpl::SetMaskLayer(scoped_ptr<LayerImpl> mask_layer) {
mask_layer_id_ = new_layer_id;
}
-scoped_ptr<LayerImpl> LayerImpl::TakeMaskLayer() {
+std::unique_ptr<LayerImpl> LayerImpl::TakeMaskLayer() {
mask_layer_id_ = -1;
- scoped_ptr<LayerImpl> ret;
+ std::unique_ptr<LayerImpl> ret;
if (mask_layer_)
ret = layer_tree_impl_->RemoveLayer(mask_layer_->id());
mask_layer_ = nullptr;
return ret;
}
-void LayerImpl::SetReplicaLayer(scoped_ptr<LayerImpl> replica_layer) {
+void LayerImpl::SetReplicaLayer(std::unique_ptr<LayerImpl> replica_layer) {
int new_layer_id = replica_layer ? replica_layer->id() : -1;
if (replica_layer) {
@@ -1026,9 +1028,9 @@ void LayerImpl::SetReplicaLayer(scoped_ptr<LayerImpl> replica_layer) {
replica_layer_id_ = new_layer_id;
}
-scoped_ptr<LayerImpl> LayerImpl::TakeReplicaLayer() {
+std::unique_ptr<LayerImpl> LayerImpl::TakeReplicaLayer() {
replica_layer_id_ = -1;
- scoped_ptr<LayerImpl> ret;
+ std::unique_ptr<LayerImpl> ret;
if (replica_layer_)
ret = layer_tree_impl_->RemoveLayer(replica_layer_->id());
replica_layer_ = nullptr;
@@ -1469,7 +1471,7 @@ void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const {
std::string str;
debug_info_->AppendAsTraceFormat(&str);
base::JSONReader json_reader;
- scoped_ptr<base::Value> debug_info_value(json_reader.ReadToValue(str));
+ std::unique_ptr<base::Value> debug_info_value(json_reader.ReadToValue(str));
if (debug_info_value->IsType(base::Value::TYPE_DICTIONARY)) {
base::DictionaryValue* dictionary_value = nullptr;
@@ -1518,7 +1520,7 @@ void LayerImpl::SetHasRenderSurface(bool should_have_render_surface) {
SetNeedsPushProperties();
if (should_have_render_surface) {
- render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this));
+ render_surface_ = base::WrapUnique(new RenderSurfaceImpl(this));
return;
}
render_surface_.reset();
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698