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

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

Issue 2389973002: Use std::unique_ptr to signal ownership transfer in WebCompositorSupport (Closed)
Patch Set: rebase Created 4 years, 2 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 m_contentsLayer(0), 109 m_contentsLayer(0),
110 m_contentsLayerId(0), 110 m_contentsLayerId(0),
111 m_scrollableArea(nullptr), 111 m_scrollableArea(nullptr),
112 m_renderingContext3d(0) { 112 m_renderingContext3d(0) {
113 #if ENABLE(ASSERT) 113 #if ENABLE(ASSERT)
114 if (m_client) 114 if (m_client)
115 m_client->verifyNotPainting(); 115 m_client->verifyNotPainting();
116 #endif 116 #endif
117 117
118 m_contentLayerDelegate = wrapUnique(new ContentLayerDelegate(this)); 118 m_contentLayerDelegate = wrapUnique(new ContentLayerDelegate(this));
119 m_layer = 119 m_layer = Platform::current()->compositorSupport()->createContentLayer(
120 wrapUnique(Platform::current()->compositorSupport()->createContentLayer( 120 m_contentLayerDelegate.get());
121 m_contentLayerDelegate.get()));
122 m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible); 121 m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible);
123 m_layer->layer()->setLayerClient(this); 122 m_layer->layer()->setLayerClient(this);
124 } 123 }
125 124
126 GraphicsLayer::~GraphicsLayer() { 125 GraphicsLayer::~GraphicsLayer() {
127 for (size_t i = 0; i < m_linkHighlights.size(); ++i) 126 for (size_t i = 0; i < m_linkHighlights.size(); ++i)
128 m_linkHighlights[i]->clearCurrentGraphicsLayer(); 127 m_linkHighlights[i]->clearCurrentGraphicsLayer();
129 m_linkHighlights.clear(); 128 m_linkHighlights.clear();
130 129
131 #if ENABLE(ASSERT) 130 #if ENABLE(ASSERT)
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 if (respectImageOrientation == RespectImageOrientation) { 1032 if (respectImageOrientation == RespectImageOrientation) {
1034 ImageOrientation imageOrientation = 1033 ImageOrientation imageOrientation =
1035 toBitmapImage(image)->currentFrameOrientation(); 1034 toBitmapImage(image)->currentFrameOrientation();
1036 skImage = 1035 skImage =
1037 DragImage::resizeAndOrientImage(std::move(skImage), imageOrientation); 1036 DragImage::resizeAndOrientImage(std::move(skImage), imageOrientation);
1038 } 1037 }
1039 } 1038 }
1040 1039
1041 if (image && skImage) { 1040 if (image && skImage) {
1042 if (!m_imageLayer) { 1041 if (!m_imageLayer) {
1043 m_imageLayer = wrapUnique( 1042 m_imageLayer =
1044 Platform::current()->compositorSupport()->createImageLayer()); 1043 Platform::current()->compositorSupport()->createImageLayer();
1045 registerContentsLayer(m_imageLayer->layer()); 1044 registerContentsLayer(m_imageLayer->layer());
1046 } 1045 }
1047 m_imageLayer->setImage(skImage.get()); 1046 m_imageLayer->setImage(skImage.get());
1048 m_imageLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque()); 1047 m_imageLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque());
1049 updateContentsRect(); 1048 updateContentsRect();
1050 } else { 1049 } else {
1051 if (m_imageLayer) { 1050 if (m_imageLayer) {
1052 unregisterContentsLayer(m_imageLayer->layer()); 1051 unregisterContentsLayer(m_imageLayer->layer());
1053 m_imageLayer.reset(); 1052 m_imageLayer.reset();
1054 } 1053 }
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { 1273 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) {
1275 if (!layer) { 1274 if (!layer) {
1276 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); 1275 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n");
1277 return; 1276 return;
1278 } 1277 }
1279 1278
1280 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); 1279 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
1281 fprintf(stderr, "%s\n", output.utf8().data()); 1280 fprintf(stderr, "%s\n", output.utf8().data());
1282 } 1281 }
1283 #endif 1282 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698