| 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/compositing_display_item.h" | 10 #include "cc/playback/compositing_display_item.h" |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 } | 665 } |
| 666 } | 666 } |
| 667 if (createNew) | 667 if (createNew) |
| 668 pendingLayers.push_back(PendingLayer(paintChunk)); | 668 pendingLayers.push_back(PendingLayer(paintChunk)); |
| 669 } | 669 } |
| 670 } | 670 } |
| 671 | 671 |
| 672 void PaintArtifactCompositor::update( | 672 void PaintArtifactCompositor::update( |
| 673 const PaintArtifact& paintArtifact, | 673 const PaintArtifact& paintArtifact, |
| 674 RasterInvalidationTrackingMap<const PaintChunk>* rasterChunkInvalidations, | 674 RasterInvalidationTrackingMap<const PaintChunk>* rasterChunkInvalidations, |
| 675 bool storeDebugInfo) { | 675 bool storeDebugInfo, |
| 676 GeometryMapper& geometryMapper) { |
| 676 #ifndef NDEBUG | 677 #ifndef NDEBUG |
| 677 storeDebugInfo = true; | 678 storeDebugInfo = true; |
| 678 #endif | 679 #endif |
| 679 | 680 |
| 680 DCHECK(m_rootLayer); | 681 DCHECK(m_rootLayer); |
| 681 | 682 |
| 682 cc::LayerTree* layerTree = m_rootLayer->GetLayerTree(); | 683 cc::LayerTree* layerTree = m_rootLayer->GetLayerTree(); |
| 683 | 684 |
| 684 // The tree will be null after detaching and this update can be ignored. | 685 // The tree will be null after detaching and this update can be ignored. |
| 685 // See: WebViewImpl::detachPaintArtifactCompositor(). | 686 // See: WebViewImpl::detachPaintArtifactCompositor(). |
| 686 if (!layerTree) | 687 if (!layerTree) |
| 687 return; | 688 return; |
| 688 | 689 |
| 689 if (m_extraDataForTestingEnabled) | 690 if (m_extraDataForTestingEnabled) |
| 690 m_extraDataForTesting = WTF::wrapUnique(new ExtraDataForTesting); | 691 m_extraDataForTesting = WTF::wrapUnique(new ExtraDataForTesting); |
| 691 | 692 |
| 692 m_rootLayer->RemoveAllChildren(); | 693 m_rootLayer->RemoveAllChildren(); |
| 693 m_rootLayer->set_property_tree_sequence_number( | 694 m_rootLayer->set_property_tree_sequence_number( |
| 694 PropertyTreeManager::kPropertyTreeSequenceNumber); | 695 PropertyTreeManager::kPropertyTreeSequenceNumber); |
| 695 | 696 |
| 696 PropertyTreeManager propertyTreeManager(*layerTree->property_trees(), | 697 PropertyTreeManager propertyTreeManager(*layerTree->property_trees(), |
| 697 m_rootLayer.get()); | 698 m_rootLayer.get()); |
| 698 | 699 |
| 699 Vector<PendingLayer, 0> pendingLayers; | 700 Vector<PendingLayer, 0> pendingLayers; |
| 700 GeometryMapper geometryMapper; | |
| 701 collectPendingLayers(paintArtifact, pendingLayers, geometryMapper); | 701 collectPendingLayers(paintArtifact, pendingLayers, geometryMapper); |
| 702 | 702 |
| 703 Vector<std::unique_ptr<ContentLayerClientImpl>> newContentLayerClients; | 703 Vector<std::unique_ptr<ContentLayerClientImpl>> newContentLayerClients; |
| 704 newContentLayerClients.reserveCapacity(paintArtifact.paintChunks().size()); | 704 newContentLayerClients.reserveCapacity(paintArtifact.paintChunks().size()); |
| 705 for (const PendingLayer& pendingLayer : pendingLayers) { | 705 for (const PendingLayer& pendingLayer : pendingLayers) { |
| 706 gfx::Vector2dF layerOffset; | 706 gfx::Vector2dF layerOffset; |
| 707 scoped_refptr<cc::Layer> layer = compositedLayerForPendingLayer( | 707 scoped_refptr<cc::Layer> layer = compositedLayerForPendingLayer( |
| 708 paintArtifact, pendingLayer, layerOffset, newContentLayerClients, | 708 paintArtifact, pendingLayer, layerOffset, newContentLayerClients, |
| 709 rasterChunkInvalidations, storeDebugInfo, geometryMapper); | 709 rasterChunkInvalidations, storeDebugInfo, geometryMapper); |
| 710 | 710 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 #ifndef NDEBUG | 748 #ifndef NDEBUG |
| 749 void PaintArtifactCompositor::showDebugData() { | 749 void PaintArtifactCompositor::showDebugData() { |
| 750 LOG(ERROR) << layersAsJSON(LayerTreeIncludesDebugInfo) | 750 LOG(ERROR) << layersAsJSON(LayerTreeIncludesDebugInfo) |
| 751 ->toPrettyJSONString() | 751 ->toPrettyJSONString() |
| 752 .utf8() | 752 .utf8() |
| 753 .data(); | 753 .data(); |
| 754 } | 754 } |
| 755 #endif | 755 #endif |
| 756 | 756 |
| 757 } // namespace blink | 757 } // namespace blink |
| OLD | NEW |