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

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

Issue 2658513002: sdf
Patch Set: sdf Created 3 years, 11 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"
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 contentLayerClient->clearPaintChunkDebugData(); 526 contentLayerClient->clearPaintChunkDebugData();
527 527
528 for (const auto& paintChunk : pendingLayer.paintChunks) { 528 for (const auto& paintChunk : pendingLayer.paintChunks) {
529 RasterInvalidationTracking* rasterTracking = 529 RasterInvalidationTracking* rasterTracking =
530 trackingMap ? trackingMap->find(paintChunk) : nullptr; 530 trackingMap ? trackingMap->find(paintChunk) : nullptr;
531 DCHECK(!rasterTracking || 531 DCHECK(!rasterTracking ||
532 rasterTracking->trackedRasterInvalidations.size() == 532 rasterTracking->trackedRasterInvalidations.size() ==
533 paintChunk->rasterInvalidationRects.size()); 533 paintChunk->rasterInvalidationRects.size());
534 534
535 if (storeDebugInfo) { 535 if (storeDebugInfo) {
536 contentLayerClient->addPaintChunkDebugData( 536 std::unique_ptr<JSONArray> jsonArrayForChunk = paintArtifact.getDisplayIte mList().subsequenceAsJSON(
537 paintArtifact.getDisplayItemList().subsequenceAsJSON(
538 paintChunk->beginIndex, paintChunk->endIndex, 537 paintChunk->beginIndex, paintChunk->endIndex,
539 DisplayItemList::SkipNonDrawings | 538 DisplayItemList::SkipNonDrawings |
540 DisplayItemList::ShownOnlyDisplayItemTypes)); 539 DisplayItemList::ShownOnlyDisplayItemTypes);
540
541 std::unique_ptr<JSONObject> jsonForTransform = JSONObject::create();
542 jsonForTransform->setString("transform", paintChunk->properties.propertyTr eeState.transform()->toString());
543 jsonArrayForChunk->pushObject(std::move(jsonForTransform));
544 std::unique_ptr<JSONObject> jsonForScroll = JSONObject::create();
545 jsonForScroll->setString("scroll", paintChunk->properties.propertyTreeStat e.scroll()->toString());
546 jsonArrayForChunk->pushObject(std::move(jsonForScroll));
547 std::unique_ptr<JSONObject> jsonForClip = JSONObject::create();
548 jsonForClip->setString("clip", paintChunk->properties.propertyTreeState.cl ip()->toString());
549 jsonArrayForChunk->pushObject(std::move(jsonForClip));
550 contentLayerClient->addPaintChunkDebugData(std::move(jsonArrayForChunk));
541 } 551 }
542 552
543 for (unsigned index = 0; index < paintChunk->rasterInvalidationRects.size(); 553 for (unsigned index = 0; index < paintChunk->rasterInvalidationRects.size();
544 ++index) { 554 ++index) {
545 IntRect rect( 555 IntRect rect(
546 enclosingIntRect(paintChunk->rasterInvalidationRects[index])); 556 enclosingIntRect(paintChunk->rasterInvalidationRects[index]));
547 gfx::Rect ccInvalidationRect(rect.x(), rect.y(), 557 gfx::Rect ccInvalidationRect(rect.x(), rect.y(),
548 std::max(0, rect.width()), 558 std::max(0, rect.width()),
549 std::max(0, rect.height())); 559 std::max(0, rect.height()));
550 if (ccInvalidationRect.IsEmpty()) 560 if (ccInvalidationRect.IsEmpty())
(...skipping 27 matching lines...) Expand all
578 588
579 if (newChunk.properties.backfaceHidden != 589 if (newChunk.properties.backfaceHidden !=
580 pendingLayerFirstChunk.properties.backfaceHidden) 590 pendingLayerFirstChunk.properties.backfaceHidden)
581 return false; 591 return false;
582 592
583 DCHECK_GE(candidatePendingLayer.paintChunks.size(), 1u); 593 DCHECK_GE(candidatePendingLayer.paintChunks.size(), 1u);
584 PropertyTreeStateIterator iterator(newChunk.properties.propertyTreeState); 594 PropertyTreeStateIterator iterator(newChunk.properties.propertyTreeState);
585 for (const PropertyTreeState* currentState = 595 for (const PropertyTreeState* currentState =
586 &newChunk.properties.propertyTreeState; 596 &newChunk.properties.propertyTreeState;
587 currentState; currentState = iterator.next()) { 597 currentState; currentState = iterator.next()) {
588 if (*currentState == candidatePendingLayer.propertyTreeState) 598 if (currentState->equivalentGeometry(candidatePendingLayer.propertyTreeState )) {
589 return true; 599 return true;
600 }
601 // if (*currentState == candidatePendingLayer.propertyTreeState) {
602 // return true;
603 // }
590 if (currentState->hasDirectCompositingReasons()) 604 if (currentState->hasDirectCompositingReasons())
591 return false; 605 return false;
592 } 606 }
593 return false; 607 return false;
594 } 608 }
595 609
596 bool PaintArtifactCompositor::mightOverlap( 610 bool PaintArtifactCompositor::mightOverlap(
597 const PaintChunk& paintChunk, 611 const PaintChunk& paintChunk,
598 const PendingLayer& candidatePendingLayer, 612 const PendingLayer& candidatePendingLayer,
599 GeometryMapper& geometryMapper) { 613 GeometryMapper& geometryMapper) {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 m_extraDataForTesting->contentLayers.push_back(layer); 751 m_extraDataForTesting->contentLayers.push_back(layer);
738 } 752 }
739 m_contentLayerClients.clear(); 753 m_contentLayerClients.clear();
740 m_contentLayerClients.swap(newContentLayerClients); 754 m_contentLayerClients.swap(newContentLayerClients);
741 755
742 // Mark the property trees as having been rebuilt. 756 // Mark the property trees as having been rebuilt.
743 layerTree->property_trees()->sequence_number = 757 layerTree->property_trees()->sequence_number =
744 PropertyTreeManager::kPropertyTreeSequenceNumber; 758 PropertyTreeManager::kPropertyTreeSequenceNumber;
745 layerTree->property_trees()->needs_rebuild = false; 759 layerTree->property_trees()->needs_rebuild = false;
746 layerTree->property_trees()->ResetCachedData(); 760 layerTree->property_trees()->ResetCachedData();
761
762 showDebugData();
747 } 763 }
748 764
749 #ifndef NDEBUG 765 #ifndef NDEBUG
750 void PaintArtifactCompositor::showDebugData() { 766 void PaintArtifactCompositor::showDebugData() {
751 LOG(ERROR) << layersAsJSON(LayerTreeIncludesDebugInfo) 767 LOG(ERROR) << layersAsJSON(LayerTreeIncludesDebugInfo)
752 ->toPrettyJSONString() 768 ->toPrettyJSONString()
753 .utf8() 769 .utf8()
754 .data(); 770 .data();
755 } 771 }
756 #endif 772 #endif
757 773
758 } // namespace blink 774 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698