OLD | NEW |
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/blink/web_compositor_support_impl.h" | 5 #include "cc/blink/web_compositor_support_impl.h" |
6 | 6 |
7 #include <memory> | 7 #include <utility> |
8 | 8 |
| 9 #include "base/memory/ptr_util.h" |
9 #include "cc/blink/web_content_layer_impl.h" | 10 #include "cc/blink/web_content_layer_impl.h" |
10 #include "cc/blink/web_display_item_list_impl.h" | 11 #include "cc/blink/web_display_item_list_impl.h" |
11 #include "cc/blink/web_external_texture_layer_impl.h" | 12 #include "cc/blink/web_external_texture_layer_impl.h" |
12 #include "cc/blink/web_image_layer_impl.h" | 13 #include "cc/blink/web_image_layer_impl.h" |
13 #include "cc/blink/web_layer_impl.h" | 14 #include "cc/blink/web_layer_impl.h" |
14 #include "cc/blink/web_scrollbar_layer_impl.h" | 15 #include "cc/blink/web_scrollbar_layer_impl.h" |
15 #include "cc/layers/layer.h" | 16 #include "cc/layers/layer.h" |
16 #include "cc/output/output_surface.h" | 17 #include "cc/output/output_surface.h" |
17 #include "cc/output/software_output_device.h" | 18 #include "cc/output/software_output_device.h" |
18 | 19 |
19 using blink::WebContentLayer; | 20 using blink::WebContentLayer; |
20 using blink::WebContentLayerClient; | 21 using blink::WebContentLayerClient; |
21 using blink::WebDisplayItemList; | 22 using blink::WebDisplayItemList; |
22 using blink::WebExternalTextureLayer; | 23 using blink::WebExternalTextureLayer; |
23 using blink::WebImageLayer; | 24 using blink::WebImageLayer; |
24 using blink::WebLayer; | 25 using blink::WebLayer; |
25 using blink::WebScrollbar; | 26 using blink::WebScrollbar; |
26 using blink::WebScrollbarLayer; | 27 using blink::WebScrollbarLayer; |
27 using blink::WebScrollbarThemeGeometry; | 28 using blink::WebScrollbarThemeGeometry; |
28 using blink::WebScrollbarThemePainter; | 29 using blink::WebScrollbarThemePainter; |
29 | 30 |
30 namespace cc_blink { | 31 namespace cc_blink { |
31 | 32 |
32 WebCompositorSupportImpl::WebCompositorSupportImpl() { | 33 WebCompositorSupportImpl::WebCompositorSupportImpl() { |
33 } | 34 } |
34 | 35 |
35 WebCompositorSupportImpl::~WebCompositorSupportImpl() { | 36 WebCompositorSupportImpl::~WebCompositorSupportImpl() { |
36 } | 37 } |
37 | 38 |
38 WebLayer* WebCompositorSupportImpl::createLayer() { | 39 std::unique_ptr<WebLayer> WebCompositorSupportImpl::createLayer() { |
39 return new WebLayerImpl(); | 40 return base::MakeUnique<WebLayerImpl>(); |
40 } | 41 } |
41 | 42 |
42 WebLayer* WebCompositorSupportImpl::createLayerFromCCLayer(cc::Layer* layer) { | 43 std::unique_ptr<WebLayer> WebCompositorSupportImpl::createLayerFromCCLayer( |
43 return new WebLayerImpl(layer); | 44 cc::Layer* layer) { |
| 45 return base::MakeUnique<WebLayerImpl>(layer); |
44 } | 46 } |
45 | 47 |
46 WebContentLayer* WebCompositorSupportImpl::createContentLayer( | 48 std::unique_ptr<WebContentLayer> WebCompositorSupportImpl::createContentLayer( |
47 WebContentLayerClient* client) { | 49 WebContentLayerClient* client) { |
48 return new WebContentLayerImpl(client); | 50 return base::MakeUnique<WebContentLayerImpl>(client); |
49 } | 51 } |
50 | 52 |
51 WebExternalTextureLayer* WebCompositorSupportImpl::createExternalTextureLayer( | 53 std::unique_ptr<WebExternalTextureLayer> |
| 54 WebCompositorSupportImpl::createExternalTextureLayer( |
52 cc::TextureLayerClient* client) { | 55 cc::TextureLayerClient* client) { |
53 return new WebExternalTextureLayerImpl(client); | 56 return base::MakeUnique<WebExternalTextureLayerImpl>(client); |
54 } | 57 } |
55 | 58 |
56 blink::WebImageLayer* WebCompositorSupportImpl::createImageLayer() { | 59 std::unique_ptr<blink::WebImageLayer> |
57 return new WebImageLayerImpl(); | 60 WebCompositorSupportImpl::createImageLayer() { |
| 61 return base::MakeUnique<WebImageLayerImpl>(); |
58 } | 62 } |
59 | 63 |
60 WebScrollbarLayer* WebCompositorSupportImpl::createScrollbarLayer( | 64 std::unique_ptr<WebScrollbarLayer> |
61 WebScrollbar* scrollbar, | 65 WebCompositorSupportImpl::createScrollbarLayer( |
| 66 std::unique_ptr<WebScrollbar> scrollbar, |
62 WebScrollbarThemePainter painter, | 67 WebScrollbarThemePainter painter, |
63 WebScrollbarThemeGeometry* geometry) { | 68 std::unique_ptr<WebScrollbarThemeGeometry> geometry) { |
64 return new WebScrollbarLayerImpl(scrollbar, painter, geometry); | 69 return base::MakeUnique<WebScrollbarLayerImpl>(std::move(scrollbar), painter, |
| 70 std::move(geometry)); |
65 } | 71 } |
66 | 72 |
67 WebScrollbarLayer* WebCompositorSupportImpl::createSolidColorScrollbarLayer( | 73 std::unique_ptr<WebScrollbarLayer> |
| 74 WebCompositorSupportImpl::createSolidColorScrollbarLayer( |
68 WebScrollbar::Orientation orientation, | 75 WebScrollbar::Orientation orientation, |
69 int thumb_thickness, | 76 int thumb_thickness, |
70 int track_start, | 77 int track_start, |
71 bool is_left_side_vertical_scrollbar) { | 78 bool is_left_side_vertical_scrollbar) { |
72 return new WebScrollbarLayerImpl(orientation, | 79 return base::MakeUnique<WebScrollbarLayerImpl>( |
73 thumb_thickness, | 80 orientation, thumb_thickness, track_start, |
74 track_start, | 81 is_left_side_vertical_scrollbar); |
75 is_left_side_vertical_scrollbar); | |
76 } | 82 } |
77 | 83 |
78 } // namespace cc_blink | 84 } // namespace cc_blink |
OLD | NEW |