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

Side by Side Diff: cc/layers/painted_scrollbar_layer.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/layers/painted_scrollbar_layer.h ('k') | cc/layers/painted_scrollbar_layer_impl.h » ('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/layers/painted_scrollbar_layer.h" 5 #include "cc/layers/painted_scrollbar_layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
11 #include "cc/input/main_thread_scrolling_reason.h" 11 #include "cc/input/main_thread_scrolling_reason.h"
12 #include "cc/layers/painted_scrollbar_layer_impl.h" 12 #include "cc/layers/painted_scrollbar_layer_impl.h"
13 #include "cc/resources/ui_resource_bitmap.h" 13 #include "cc/resources/ui_resource_bitmap.h"
14 #include "cc/trees/draw_property_utils.h" 14 #include "cc/trees/draw_property_utils.h"
15 #include "cc/trees/layer_tree_host.h" 15 #include "cc/trees/layer_tree_host.h"
16 #include "cc/trees/layer_tree_impl.h" 16 #include "cc/trees/layer_tree_impl.h"
17 #include "skia/ext/platform_canvas.h" 17 #include "skia/ext/platform_canvas.h"
18 #include "skia/ext/refptr.h" 18 #include "skia/ext/refptr.h"
19 #include "third_party/skia/include/core/SkBitmap.h" 19 #include "third_party/skia/include/core/SkBitmap.h"
20 #include "third_party/skia/include/core/SkCanvas.h" 20 #include "third_party/skia/include/core/SkCanvas.h"
21 #include "third_party/skia/include/core/SkSize.h" 21 #include "third_party/skia/include/core/SkSize.h"
22 #include "ui/gfx/geometry/size_conversions.h" 22 #include "ui/gfx/geometry/size_conversions.h"
23 #include "ui/gfx/skia_util.h" 23 #include "ui/gfx/skia_util.h"
24 24
25 namespace cc { 25 namespace cc {
26 26
27 scoped_ptr<LayerImpl> PaintedScrollbarLayer::CreateLayerImpl( 27 std::unique_ptr<LayerImpl> PaintedScrollbarLayer::CreateLayerImpl(
28 LayerTreeImpl* tree_impl) { 28 LayerTreeImpl* tree_impl) {
29 return PaintedScrollbarLayerImpl::Create( 29 return PaintedScrollbarLayerImpl::Create(
30 tree_impl, id(), scrollbar_->Orientation()); 30 tree_impl, id(), scrollbar_->Orientation());
31 } 31 }
32 32
33 scoped_refptr<PaintedScrollbarLayer> PaintedScrollbarLayer::Create( 33 scoped_refptr<PaintedScrollbarLayer> PaintedScrollbarLayer::Create(
34 scoped_ptr<Scrollbar> scrollbar, 34 std::unique_ptr<Scrollbar> scrollbar,
35 int scroll_layer_id) { 35 int scroll_layer_id) {
36 return make_scoped_refptr( 36 return make_scoped_refptr(
37 new PaintedScrollbarLayer(std::move(scrollbar), scroll_layer_id)); 37 new PaintedScrollbarLayer(std::move(scrollbar), scroll_layer_id));
38 } 38 }
39 39
40 PaintedScrollbarLayer::PaintedScrollbarLayer(scoped_ptr<Scrollbar> scrollbar, 40 PaintedScrollbarLayer::PaintedScrollbarLayer(
41 int scroll_layer_id) 41 std::unique_ptr<Scrollbar> scrollbar,
42 int scroll_layer_id)
42 : scrollbar_(std::move(scrollbar)), 43 : scrollbar_(std::move(scrollbar)),
43 scroll_layer_id_(scroll_layer_id), 44 scroll_layer_id_(scroll_layer_id),
44 internal_contents_scale_(1.f), 45 internal_contents_scale_(1.f),
45 thumb_thickness_(scrollbar_->ThumbThickness()), 46 thumb_thickness_(scrollbar_->ThumbThickness()),
46 thumb_length_(scrollbar_->ThumbLength()), 47 thumb_length_(scrollbar_->ThumbLength()),
47 is_overlay_(scrollbar_->IsOverlay()), 48 is_overlay_(scrollbar_->IsOverlay()),
48 has_thumb_(scrollbar_->HasThumb()), 49 has_thumb_(scrollbar_->HasThumb()),
49 thumb_opacity_(scrollbar_->ThumbOpacity()) { 50 thumb_opacity_(scrollbar_->ThumbOpacity()) {
50 if (!scrollbar_->IsOverlay()) 51 if (!scrollbar_->IsOverlay())
51 AddMainThreadScrollingReasons( 52 AddMainThreadScrollingReasons(
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 301
301 scrollbar_->PaintPart(&skcanvas, part, layer_rect); 302 scrollbar_->PaintPart(&skcanvas, part, layer_rect);
302 // Make sure that the pixels are no longer mutable to unavoid unnecessary 303 // Make sure that the pixels are no longer mutable to unavoid unnecessary
303 // allocation and copying. 304 // allocation and copying.
304 skbitmap.setImmutable(); 305 skbitmap.setImmutable();
305 306
306 return UIResourceBitmap(skbitmap); 307 return UIResourceBitmap(skbitmap);
307 } 308 }
308 309
309 } // namespace cc 310 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/painted_scrollbar_layer.h ('k') | cc/layers/painted_scrollbar_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698