OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/graphics/paint/ForeignLayerDisplayItem.h" | 5 #include "platform/graphics/paint/ForeignLayerDisplayItem.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
9 #include "platform/graphics/GraphicsContext.h" | 9 #include "platform/graphics/GraphicsContext.h" |
10 #include "platform/graphics/paint/PaintController.h" | 10 #include "platform/graphics/paint/PaintController.h" |
11 #include "platform/wtf/Assertions.h" | 11 #include "platform/wtf/Assertions.h" |
12 #include "public/platform/WebLayer.h" | 12 #include "public/platform/WebLayer.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 ForeignLayerDisplayItem::ForeignLayerDisplayItem( | 16 ForeignLayerDisplayItem::ForeignLayerDisplayItem( |
17 const DisplayItemClient& client, | 17 const DisplayItemClient& client, |
18 Type type, | 18 Type type, |
19 scoped_refptr<cc::Layer> layer, | 19 scoped_refptr<cc::Layer> layer, |
20 const FloatPoint& location, | 20 const FloatPoint& location, |
21 const IntSize& bounds) | 21 const IntSize& bounds) |
22 : DisplayItem(client, type, sizeof(*this)), | 22 : DisplayItem(client, type, sizeof(*this)), |
23 m_layer(std::move(layer)), | 23 m_layer(std::move(layer)), |
24 m_location(location), | 24 m_location(location), |
25 m_bounds(bounds) { | 25 m_bounds(bounds) { |
26 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 26 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
27 ASSERT(isForeignLayerType(type)); | 27 DCHECK(isForeignLayerType(type)); |
28 ASSERT(m_layer); | 28 DCHECK(m_layer); |
29 } | 29 } |
30 | 30 |
31 ForeignLayerDisplayItem::~ForeignLayerDisplayItem() {} | 31 ForeignLayerDisplayItem::~ForeignLayerDisplayItem() {} |
32 | 32 |
33 void ForeignLayerDisplayItem::replay(GraphicsContext&) const { | 33 void ForeignLayerDisplayItem::replay(GraphicsContext&) const { |
34 ASSERT_NOT_REACHED(); | 34 NOTREACHED(); |
35 } | 35 } |
36 | 36 |
37 void ForeignLayerDisplayItem::appendToWebDisplayItemList( | 37 void ForeignLayerDisplayItem::appendToWebDisplayItemList( |
38 const IntRect&, | 38 const IntRect&, |
39 WebDisplayItemList*) const { | 39 WebDisplayItemList*) const { |
40 ASSERT_NOT_REACHED(); | 40 NOTREACHED(); |
41 } | 41 } |
42 | 42 |
43 bool ForeignLayerDisplayItem::drawsContent() const { | 43 bool ForeignLayerDisplayItem::drawsContent() const { |
44 return true; | 44 return true; |
45 } | 45 } |
46 | 46 |
47 bool ForeignLayerDisplayItem::equals(const DisplayItem& other) const { | 47 bool ForeignLayerDisplayItem::equals(const DisplayItem& other) const { |
48 return DisplayItem::equals(other) && | 48 return DisplayItem::equals(other) && |
49 m_layer == static_cast<const ForeignLayerDisplayItem&>(other).m_layer; | 49 m_layer == static_cast<const ForeignLayerDisplayItem&>(other).m_layer; |
50 } | 50 } |
(...skipping 14 matching lines...) Expand all Loading... |
65 const IntSize& bounds) { | 65 const IntSize& bounds) { |
66 PaintController& paintController = context.getPaintController(); | 66 PaintController& paintController = context.getPaintController(); |
67 if (paintController.displayItemConstructionIsDisabled()) | 67 if (paintController.displayItemConstructionIsDisabled()) |
68 return; | 68 return; |
69 | 69 |
70 paintController.createAndAppend<ForeignLayerDisplayItem>( | 70 paintController.createAndAppend<ForeignLayerDisplayItem>( |
71 client, type, webLayer->ccLayer(), location, bounds); | 71 client, type, webLayer->ccLayer(), location, bounds); |
72 } | 72 } |
73 | 73 |
74 } // namespace blink | 74 } // namespace blink |
OLD | NEW |