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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "public/platform/WebCompositorSupport.h" 50 #include "public/platform/WebCompositorSupport.h"
51 #include "public/platform/WebFloatPoint.h" 51 #include "public/platform/WebFloatPoint.h"
52 #include "public/platform/WebFloatRect.h" 52 #include "public/platform/WebFloatRect.h"
53 #include "public/platform/WebLayer.h" 53 #include "public/platform/WebLayer.h"
54 #include "public/platform/WebPoint.h" 54 #include "public/platform/WebPoint.h"
55 #include "public/platform/WebSize.h" 55 #include "public/platform/WebSize.h"
56 #include "wtf/CurrentTime.h" 56 #include "wtf/CurrentTime.h"
57 #include "wtf/HashMap.h" 57 #include "wtf/HashMap.h"
58 #include "wtf/HashSet.h" 58 #include "wtf/HashSet.h"
59 #include "wtf/MathExtras.h" 59 #include "wtf/MathExtras.h"
60 #include "wtf/PtrUtil.h"
60 #include "wtf/text/StringUTF8Adaptor.h" 61 #include "wtf/text/StringUTF8Adaptor.h"
61 #include "wtf/text/WTFString.h" 62 #include "wtf/text/WTFString.h"
62 #include <algorithm> 63 #include <algorithm>
63 #include <cmath> 64 #include <cmath>
65 #include <memory>
64 #include <utility> 66 #include <utility>
65 67
66 #ifndef NDEBUG 68 #ifndef NDEBUG
67 #include <stdio.h> 69 #include <stdio.h>
68 #endif 70 #endif
69 71
70 namespace blink { 72 namespace blink {
71 73
72 static bool s_drawDebugRedFill = true; 74 static bool s_drawDebugRedFill = true;
73 75
(...skipping 26 matching lines...) Expand all
100 #endif 102 #endif
101 }; 103 };
102 104
103 typedef HashMap<const GraphicsLayer*, PaintInvalidationTracking> PaintInvalidati onTrackingMap; 105 typedef HashMap<const GraphicsLayer*, PaintInvalidationTracking> PaintInvalidati onTrackingMap;
104 static PaintInvalidationTrackingMap& paintInvalidationTrackingMap() 106 static PaintInvalidationTrackingMap& paintInvalidationTrackingMap()
105 { 107 {
106 DEFINE_STATIC_LOCAL(PaintInvalidationTrackingMap, map, ()); 108 DEFINE_STATIC_LOCAL(PaintInvalidationTrackingMap, map, ());
107 return map; 109 return map;
108 } 110 }
109 111
110 PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client) 112 std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client )
111 { 113 {
112 return adoptPtr(new GraphicsLayer(client)); 114 return wrapUnique(new GraphicsLayer(client));
113 } 115 }
114 116
115 GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) 117 GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client)
116 : m_client(client) 118 : m_client(client)
117 , m_backgroundColor(Color::transparent) 119 , m_backgroundColor(Color::transparent)
118 , m_opacity(1) 120 , m_opacity(1)
119 , m_blendMode(WebBlendModeNormal) 121 , m_blendMode(WebBlendModeNormal)
120 , m_hasTransformOrigin(false) 122 , m_hasTransformOrigin(false)
121 , m_contentsOpaque(false) 123 , m_contentsOpaque(false)
122 , m_shouldFlattenTransform(true) 124 , m_shouldFlattenTransform(true)
(...skipping 18 matching lines...) Expand all
141 , m_contentsLayer(0) 143 , m_contentsLayer(0)
142 , m_contentsLayerId(0) 144 , m_contentsLayerId(0)
143 , m_scrollableArea(nullptr) 145 , m_scrollableArea(nullptr)
144 , m_3dRenderingContext(0) 146 , m_3dRenderingContext(0)
145 { 147 {
146 #if ENABLE(ASSERT) 148 #if ENABLE(ASSERT)
147 if (m_client) 149 if (m_client)
148 m_client->verifyNotPainting(); 150 m_client->verifyNotPainting();
149 #endif 151 #endif
150 152
151 m_contentLayerDelegate = adoptPtr(new ContentLayerDelegate(this)); 153 m_contentLayerDelegate = wrapUnique(new ContentLayerDelegate(this));
152 m_layer = adoptPtr(Platform::current()->compositorSupport()->createContentLa yer(m_contentLayerDelegate.get())); 154 m_layer = wrapUnique(Platform::current()->compositorSupport()->createContent Layer(m_contentLayerDelegate.get()));
153 m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible); 155 m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible);
154 m_layer->layer()->setLayerClient(this); 156 m_layer->layer()->setLayerClient(this);
155 } 157 }
156 158
157 GraphicsLayer::~GraphicsLayer() 159 GraphicsLayer::~GraphicsLayer()
158 { 160 {
159 for (size_t i = 0; i < m_linkHighlights.size(); ++i) 161 for (size_t i = 0; i < m_linkHighlights.size(); ++i)
160 m_linkHighlights[i]->clearCurrentGraphicsLayer(); 162 m_linkHighlights[i]->clearCurrentGraphicsLayer();
161 m_linkHighlights.clear(); 163 m_linkHighlights.clear();
162 164
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 1150
1149 if (image && skImage && image->isBitmapImage()) { 1151 if (image && skImage && image->isBitmapImage()) {
1150 if (respectImageOrientation == RespectImageOrientation) { 1152 if (respectImageOrientation == RespectImageOrientation) {
1151 ImageOrientation imageOrientation = toBitmapImage(image)->currentFra meOrientation(); 1153 ImageOrientation imageOrientation = toBitmapImage(image)->currentFra meOrientation();
1152 skImage = DragImage::resizeAndOrientImage(skImage.release(), imageOr ientation); 1154 skImage = DragImage::resizeAndOrientImage(skImage.release(), imageOr ientation);
1153 } 1155 }
1154 } 1156 }
1155 1157
1156 if (image && skImage) { 1158 if (image && skImage) {
1157 if (!m_imageLayer) { 1159 if (!m_imageLayer) {
1158 m_imageLayer = adoptPtr(Platform::current()->compositorSupport()->cr eateImageLayer()); 1160 m_imageLayer = wrapUnique(Platform::current()->compositorSupport()-> createImageLayer());
1159 registerContentsLayer(m_imageLayer->layer()); 1161 registerContentsLayer(m_imageLayer->layer());
1160 } 1162 }
1161 m_imageLayer->setImage(skImage.get()); 1163 m_imageLayer->setImage(skImage.get());
1162 m_imageLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque()); 1164 m_imageLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque());
1163 updateContentsRect(); 1165 updateContentsRect();
1164 } else { 1166 } else {
1165 if (m_imageLayer) { 1167 if (m_imageLayer) {
1166 unregisterContentsLayer(m_imageLayer->layer()); 1168 unregisterContentsLayer(m_imageLayer->layer());
1167 m_imageLayer.reset(); 1169 m_imageLayer.reset();
1168 } 1170 }
1169 } 1171 }
1170 1172
1171 setContentsTo(m_imageLayer ? m_imageLayer->layer() : 0); 1173 setContentsTo(m_imageLayer ? m_imageLayer->layer() : 0);
1172 } 1174 }
1173 1175
1174 WebLayer* GraphicsLayer::platformLayer() const 1176 WebLayer* GraphicsLayer::platformLayer() const
1175 { 1177 {
1176 return m_layer->layer(); 1178 return m_layer->layer();
1177 } 1179 }
1178 1180
1179 void GraphicsLayer::setFilters(const FilterOperations& filters) 1181 void GraphicsLayer::setFilters(const FilterOperations& filters)
1180 { 1182 {
1181 OwnPtr<CompositorFilterOperations> compositorFilters = CompositorFilterOpera tions::create(); 1183 std::unique_ptr<CompositorFilterOperations> compositorFilters = CompositorFi lterOperations::create();
1182 SkiaImageFilterBuilder::buildFilterOperations(filters, compositorFilters.get ()); 1184 SkiaImageFilterBuilder::buildFilterOperations(filters, compositorFilters.get ());
1183 m_layer->layer()->setFilters(compositorFilters->asFilterOperations()); 1185 m_layer->layer()->setFilters(compositorFilters->asFilterOperations());
1184 } 1186 }
1185 1187
1186 void GraphicsLayer::setBackdropFilters(const FilterOperations& filters) 1188 void GraphicsLayer::setBackdropFilters(const FilterOperations& filters)
1187 { 1189 {
1188 OwnPtr<CompositorFilterOperations> compositorFilters = CompositorFilterOpera tions::create(); 1190 std::unique_ptr<CompositorFilterOperations> compositorFilters = CompositorFi lterOperations::create();
1189 SkiaImageFilterBuilder::buildFilterOperations(filters, compositorFilters.get ()); 1191 SkiaImageFilterBuilder::buildFilterOperations(filters, compositorFilters.get ());
1190 m_layer->layer()->setBackgroundFilters(compositorFilters->asFilterOperations ()); 1192 m_layer->layer()->setBackgroundFilters(compositorFilters->asFilterOperations ());
1191 } 1193 }
1192 1194
1193 void GraphicsLayer::setFilterQuality(SkFilterQuality filterQuality) 1195 void GraphicsLayer::setFilterQuality(SkFilterQuality filterQuality)
1194 { 1196 {
1195 if (m_imageLayer) 1197 if (m_imageLayer)
1196 m_imageLayer->setNearestNeighbor(filterQuality == kNone_SkFilterQuality) ; 1198 m_imageLayer->setNearestNeighbor(filterQuality == kNone_SkFilterQuality) ;
1197 } 1199 }
1198 1200
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 { 1371 {
1370 if (!layer) { 1372 if (!layer) {
1371 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); 1373 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n");
1372 return; 1374 return;
1373 } 1375 }
1374 1376
1375 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); 1377 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
1376 fprintf(stderr, "%s\n", output.utf8().data()); 1378 fprintf(stderr, "%s\n", output.utf8().data());
1377 } 1379 }
1378 #endif 1380 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698