OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/compositing/PaintArtifactCompositor.h" | 5 #include "platform/graphics/compositing/PaintArtifactCompositor.h" |
6 | 6 |
7 #include "cc/layers/content_layer_client.h" | 7 #include "cc/layers/content_layer_client.h" |
8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
9 #include "cc/layers/picture_layer.h" | 9 #include "cc/layers/picture_layer.h" |
10 #include "cc/playback/display_item_list.h" | 10 #include "cc/playback/display_item_list.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 const PaintChunk& paintChunk, | 283 const PaintChunk& paintChunk, |
284 const PaintArtifact& paintArtifact) { | 284 const PaintArtifact& paintArtifact) { |
285 // TODO(chrishtr): for now, just using a linear walk. In the future we can | 285 // TODO(chrishtr): for now, just using a linear walk. In the future we can |
286 // optimize this by using the same techniques used in PaintController for | 286 // optimize this by using the same techniques used in PaintController for |
287 // display lists. | 287 // display lists. |
288 for (auto& client : m_contentLayerClients) { | 288 for (auto& client : m_contentLayerClients) { |
289 if (client && client->matches(paintChunk)) | 289 if (client && client->matches(paintChunk)) |
290 return std::move(client); | 290 return std::move(client); |
291 } | 291 } |
292 | 292 |
293 return wrapUnique(new ContentLayerClientImpl( | 293 return WTF::wrapUnique(new ContentLayerClientImpl( |
294 paintChunk.id | 294 paintChunk.id |
295 ? *paintChunk.id | 295 ? *paintChunk.id |
296 : paintArtifact.getDisplayItemList()[paintChunk.beginIndex].getId())); | 296 : paintArtifact.getDisplayItemList()[paintChunk.beginIndex].getId())); |
297 } | 297 } |
298 | 298 |
299 scoped_refptr<cc::Layer> PaintArtifactCompositor::layerForPaintChunk( | 299 scoped_refptr<cc::Layer> PaintArtifactCompositor::layerForPaintChunk( |
300 const PaintArtifact& paintArtifact, | 300 const PaintArtifact& paintArtifact, |
301 const PaintChunk& paintChunk, | 301 const PaintChunk& paintChunk, |
302 gfx::Vector2dF& layerOffset, | 302 gfx::Vector2dF& layerOffset, |
303 Vector<std::unique_ptr<ContentLayerClientImpl>>& newContentLayerClients, | 303 Vector<std::unique_ptr<ContentLayerClientImpl>>& newContentLayerClients, |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 DCHECK(m_rootLayer); | 761 DCHECK(m_rootLayer); |
762 | 762 |
763 cc::LayerTree* layerTree = m_rootLayer->GetLayerTree(); | 763 cc::LayerTree* layerTree = m_rootLayer->GetLayerTree(); |
764 | 764 |
765 // The tree will be null after detaching and this update can be ignored. | 765 // The tree will be null after detaching and this update can be ignored. |
766 // See: WebViewImpl::detachPaintArtifactCompositor(). | 766 // See: WebViewImpl::detachPaintArtifactCompositor(). |
767 if (!layerTree) | 767 if (!layerTree) |
768 return; | 768 return; |
769 | 769 |
770 if (m_extraDataForTestingEnabled) | 770 if (m_extraDataForTestingEnabled) |
771 m_extraDataForTesting = wrapUnique(new ExtraDataForTesting); | 771 m_extraDataForTesting = WTF::wrapUnique(new ExtraDataForTesting); |
772 | 772 |
773 m_rootLayer->RemoveAllChildren(); | 773 m_rootLayer->RemoveAllChildren(); |
774 m_rootLayer->set_property_tree_sequence_number(kPropertyTreeSequenceNumber); | 774 m_rootLayer->set_property_tree_sequence_number(kPropertyTreeSequenceNumber); |
775 | 775 |
776 PropertyTreeManager propertyTreeManager(*layerTree->property_trees(), | 776 PropertyTreeManager propertyTreeManager(*layerTree->property_trees(), |
777 m_rootLayer.get()); | 777 m_rootLayer.get()); |
778 | 778 |
779 Vector<std::unique_ptr<ContentLayerClientImpl>> newContentLayerClients; | 779 Vector<std::unique_ptr<ContentLayerClientImpl>> newContentLayerClients; |
780 newContentLayerClients.reserveCapacity(paintArtifact.paintChunks().size()); | 780 newContentLayerClients.reserveCapacity(paintArtifact.paintChunks().size()); |
781 for (const PaintChunk& paintChunk : paintArtifact.paintChunks()) { | 781 for (const PaintChunk& paintChunk : paintArtifact.paintChunks()) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 m_contentLayerClients.clear(); | 820 m_contentLayerClients.clear(); |
821 m_contentLayerClients.swap(newContentLayerClients); | 821 m_contentLayerClients.swap(newContentLayerClients); |
822 | 822 |
823 // Mark the property trees as having been rebuilt. | 823 // Mark the property trees as having been rebuilt. |
824 layerTree->property_trees()->sequence_number = kPropertyTreeSequenceNumber; | 824 layerTree->property_trees()->sequence_number = kPropertyTreeSequenceNumber; |
825 layerTree->property_trees()->needs_rebuild = false; | 825 layerTree->property_trees()->needs_rebuild = false; |
826 layerTree->property_trees()->ResetCachedData(); | 826 layerTree->property_trees()->ResetCachedData(); |
827 } | 827 } |
828 | 828 |
829 } // namespace blink | 829 } // namespace blink |
OLD | NEW |