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

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

Issue 2230513005: Move visual rect unioning between paired items to cc::DisplayItemList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review feedback. Created 4 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/paint/PaintController.h" 5 #include "platform/graphics/paint/PaintController.h"
6 6
7 #include "platform/TraceEvent.h" 7 #include "platform/TraceEvent.h"
8 #include "platform/graphics/GraphicsLayer.h" 8 #include "platform/graphics/GraphicsLayer.h"
9 #include "platform/graphics/paint/DrawingDisplayItem.h" 9 #include "platform/graphics/paint/DrawingDisplayItem.h"
10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h"
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 432
433 SkPictureGpuAnalyzer gpuAnalyzer; 433 SkPictureGpuAnalyzer gpuAnalyzer;
434 434
435 m_currentCacheGeneration = DisplayItemClient::CacheGenerationOrInvalidationR eason::next(); 435 m_currentCacheGeneration = DisplayItemClient::CacheGenerationOrInvalidationR eason::next();
436 Vector<const DisplayItemClient*> skippedCacheClients; 436 Vector<const DisplayItemClient*> skippedCacheClients;
437 for (const auto& item : m_newDisplayItemList) { 437 for (const auto& item : m_newDisplayItemList) {
438 // No reason to continue the analysis once we have a veto. 438 // No reason to continue the analysis once we have a veto.
439 if (gpuAnalyzer.suitableForGpuRasterization()) 439 if (gpuAnalyzer.suitableForGpuRasterization())
440 item.analyzeForGpuRasterization(gpuAnalyzer); 440 item.analyzeForGpuRasterization(gpuAnalyzer);
441 441
442 // TODO(wkorman): Only compute and append visual rect for drawings.
442 m_newDisplayItemList.appendVisualRect(visualRectForDisplayItem(item, off setFromLayoutObject)); 443 m_newDisplayItemList.appendVisualRect(visualRectForDisplayItem(item, off setFromLayoutObject));
443 444
444 if (item.isCacheable()) { 445 if (item.isCacheable()) {
445 item.client().setDisplayItemsCached(m_currentCacheGeneration); 446 item.client().setDisplayItemsCached(m_currentCacheGeneration);
446 } else { 447 } else {
447 if (item.client().isJustCreated()) 448 if (item.client().isJustCreated())
448 item.client().clearIsJustCreated(); 449 item.client().clearIsJustCreated();
449 if (item.skippedCache()) 450 if (item.skippedCache())
450 skippedCacheClients.append(&item.client()); 451 skippedCacheClients.append(&item.client());
451 } 452 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 memoryUsage += m_newDisplayItemList.memoryUsageInBytes(); 506 memoryUsage += m_newDisplayItemList.memoryUsageInBytes();
506 507
507 return memoryUsage; 508 return memoryUsage;
508 } 509 }
509 510
510 void PaintController::appendDebugDrawingAfterCommit(const DisplayItemClient& dis playItemClient, PassRefPtr<SkPicture> picture, const LayoutSize& offsetFromLayou tObject) 511 void PaintController::appendDebugDrawingAfterCommit(const DisplayItemClient& dis playItemClient, PassRefPtr<SkPicture> picture, const LayoutSize& offsetFromLayou tObject)
511 { 512 {
512 DCHECK(m_newDisplayItemList.isEmpty()); 513 DCHECK(m_newDisplayItemList.isEmpty());
513 DrawingDisplayItem& displayItem = m_currentPaintArtifact.getDisplayItemList( ).allocateAndConstruct<DrawingDisplayItem>(displayItemClient, DisplayItem::Debug Drawing, picture); 514 DrawingDisplayItem& displayItem = m_currentPaintArtifact.getDisplayItemList( ).allocateAndConstruct<DrawingDisplayItem>(displayItemClient, DisplayItem::Debug Drawing, picture);
514 displayItem.setSkippedCache(); 515 displayItem.setSkippedCache();
516 // TODO(wkorman): Only compute and append visual rect for drawings.
515 m_currentPaintArtifact.getDisplayItemList().appendVisualRect(visualRectForDi splayItem(displayItem, offsetFromLayoutObject)); 517 m_currentPaintArtifact.getDisplayItemList().appendVisualRect(visualRectForDi splayItem(displayItem, offsetFromLayoutObject));
516 } 518 }
517 519
518 #if DCHECK_IS_ON() 520 #if DCHECK_IS_ON()
519 521
520 void PaintController::showUnderInvalidationError(const char* reason, const Displ ayItem& newItem, const DisplayItem* oldItem) const 522 void PaintController::showUnderInvalidationError(const char* reason, const Displ ayItem& newItem, const DisplayItem* oldItem) const
521 { 523 {
522 LOG(ERROR) << m_underInvalidationMessagePrefix << " " << reason; 524 LOG(ERROR) << m_underInvalidationMessagePrefix << " " << reason;
523 #ifndef NDEBUG 525 #ifndef NDEBUG
524 LOG(ERROR) << "New display item: " << newItem.asDebugString(); 526 LOG(ERROR) << "New display item: " << newItem.asDebugString();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 return stringBuilder.toString(); 611 return stringBuilder.toString();
610 } 612 }
611 613
612 void PaintController::showDebugData() const 614 void PaintController::showDebugData() const
613 { 615 {
614 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data()); 616 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data());
615 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m _newDisplayItemList).utf8().data()); 617 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m _newDisplayItemList).utf8().data());
616 } 618 }
617 619
618 } // namespace blink 620 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698