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

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

Issue 2661523003: cc: Merge LayerTree into the LayerTreeHost. (Closed)
Patch Set: auto Created 3 years, 10 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 // 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"
11 #include "cc/playback/display_item_list.h" 11 #include "cc/playback/display_item_list.h"
12 #include "cc/playback/display_item_list_settings.h" 12 #include "cc/playback/display_item_list_settings.h"
13 #include "cc/playback/drawing_display_item.h" 13 #include "cc/playback/drawing_display_item.h"
14 #include "cc/playback/filter_display_item.h" 14 #include "cc/playback/filter_display_item.h"
15 #include "cc/playback/float_clip_display_item.h" 15 #include "cc/playback/float_clip_display_item.h"
16 #include "cc/playback/transform_display_item.h" 16 #include "cc/playback/transform_display_item.h"
17 #include "cc/trees/layer_tree_host.h"
17 #include "platform/RuntimeEnabledFeatures.h" 18 #include "platform/RuntimeEnabledFeatures.h"
18 #include "platform/graphics/compositing/PropertyTreeManager.h" 19 #include "platform/graphics/compositing/PropertyTreeManager.h"
19 #include "platform/graphics/paint/ClipPaintPropertyNode.h" 20 #include "platform/graphics/paint/ClipPaintPropertyNode.h"
20 #include "platform/graphics/paint/DisplayItem.h" 21 #include "platform/graphics/paint/DisplayItem.h"
21 #include "platform/graphics/paint/DrawingDisplayItem.h" 22 #include "platform/graphics/paint/DrawingDisplayItem.h"
22 #include "platform/graphics/paint/ForeignLayerDisplayItem.h" 23 #include "platform/graphics/paint/ForeignLayerDisplayItem.h"
23 #include "platform/graphics/paint/GeometryMapper.h" 24 #include "platform/graphics/paint/GeometryMapper.h"
24 #include "platform/graphics/paint/PaintArtifact.h" 25 #include "platform/graphics/paint/PaintArtifact.h"
25 #include "platform/graphics/paint/PropertyTreeState.h" 26 #include "platform/graphics/paint/PropertyTreeState.h"
26 #include "platform/graphics/paint/RasterInvalidationTracking.h" 27 #include "platform/graphics/paint/RasterInvalidationTracking.h"
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 const PaintArtifact& paintArtifact, 674 const PaintArtifact& paintArtifact,
674 RasterInvalidationTrackingMap<const PaintChunk>* rasterChunkInvalidations, 675 RasterInvalidationTrackingMap<const PaintChunk>* rasterChunkInvalidations,
675 bool storeDebugInfo, 676 bool storeDebugInfo,
676 GeometryMapper& geometryMapper) { 677 GeometryMapper& geometryMapper) {
677 #ifndef NDEBUG 678 #ifndef NDEBUG
678 storeDebugInfo = true; 679 storeDebugInfo = true;
679 #endif 680 #endif
680 681
681 DCHECK(m_rootLayer); 682 DCHECK(m_rootLayer);
682 683
683 cc::LayerTree* layerTree = m_rootLayer->GetLayerTree(); 684 cc::LayerTreeHost* layerTreeHost = m_rootLayer->layer_tree_host();
684 685
685 // The tree will be null after detaching and this update can be ignored. 686 // The tree will be null after detaching and this update can be ignored.
686 // See: WebViewImpl::detachPaintArtifactCompositor(). 687 // See: WebViewImpl::detachPaintArtifactCompositor().
687 if (!layerTree) 688 if (!layerTreeHost)
688 return; 689 return;
689 690
690 if (m_extraDataForTestingEnabled) 691 if (m_extraDataForTestingEnabled)
691 m_extraDataForTesting = WTF::wrapUnique(new ExtraDataForTesting); 692 m_extraDataForTesting = WTF::wrapUnique(new ExtraDataForTesting);
692 693
693 m_rootLayer->RemoveAllChildren(); 694 m_rootLayer->RemoveAllChildren();
694 m_rootLayer->set_property_tree_sequence_number( 695 m_rootLayer->set_property_tree_sequence_number(
695 PropertyTreeManager::kPropertyTreeSequenceNumber); 696 PropertyTreeManager::kPropertyTreeSequenceNumber);
696 697
697 PropertyTreeManager propertyTreeManager(*layerTree->property_trees(), 698 PropertyTreeManager propertyTreeManager(*layerTreeHost->property_trees(),
698 m_rootLayer.get()); 699 m_rootLayer.get());
699 700
700 Vector<PendingLayer, 0> pendingLayers; 701 Vector<PendingLayer, 0> pendingLayers;
701 collectPendingLayers(paintArtifact, pendingLayers, geometryMapper); 702 collectPendingLayers(paintArtifact, pendingLayers, geometryMapper);
702 703
703 Vector<std::unique_ptr<ContentLayerClientImpl>> newContentLayerClients; 704 Vector<std::unique_ptr<ContentLayerClientImpl>> newContentLayerClients;
704 newContentLayerClients.reserveCapacity(paintArtifact.paintChunks().size()); 705 newContentLayerClients.reserveCapacity(paintArtifact.paintChunks().size());
705 for (const PendingLayer& pendingLayer : pendingLayers) { 706 for (const PendingLayer& pendingLayer : pendingLayers) {
706 gfx::Vector2dF layerOffset; 707 gfx::Vector2dF layerOffset;
707 scoped_refptr<cc::Layer> layer = compositedLayerForPendingLayer( 708 scoped_refptr<cc::Layer> layer = compositedLayerForPendingLayer(
(...skipping 25 matching lines...) Expand all
733 734
734 layer->SetShouldCheckBackfaceVisibility(pendingLayer.backfaceHidden); 735 layer->SetShouldCheckBackfaceVisibility(pendingLayer.backfaceHidden);
735 736
736 if (m_extraDataForTestingEnabled) 737 if (m_extraDataForTestingEnabled)
737 m_extraDataForTesting->contentLayers.push_back(layer); 738 m_extraDataForTesting->contentLayers.push_back(layer);
738 } 739 }
739 m_contentLayerClients.clear(); 740 m_contentLayerClients.clear();
740 m_contentLayerClients.swap(newContentLayerClients); 741 m_contentLayerClients.swap(newContentLayerClients);
741 742
742 // Mark the property trees as having been rebuilt. 743 // Mark the property trees as having been rebuilt.
743 layerTree->property_trees()->sequence_number = 744 layerTreeHost->property_trees()->sequence_number =
744 PropertyTreeManager::kPropertyTreeSequenceNumber; 745 PropertyTreeManager::kPropertyTreeSequenceNumber;
745 layerTree->property_trees()->needs_rebuild = false; 746 layerTreeHost->property_trees()->needs_rebuild = false;
746 layerTree->property_trees()->ResetCachedData(); 747 layerTreeHost->property_trees()->ResetCachedData();
747 } 748 }
748 749
749 #ifndef NDEBUG 750 #ifndef NDEBUG
750 void PaintArtifactCompositor::showDebugData() { 751 void PaintArtifactCompositor::showDebugData() {
751 LOG(ERROR) << layersAsJSON(LayerTreeIncludesDebugInfo) 752 LOG(ERROR) << layersAsJSON(LayerTreeIncludesDebugInfo)
752 ->toPrettyJSONString() 753 ->toPrettyJSONString()
753 .utf8() 754 .utf8()
754 .data(); 755 .data();
755 } 756 }
756 #endif 757 #endif
757 758
758 } // namespace blink 759 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698