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

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

Issue 2626353002: Rename a few compositor property tree methods for clarity. (Closed)
Patch Set: Sync to head. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
index a1a4edc464a500b67db5e7f56c961cb8b0b86bf0..2f0cd287e04d891bc8a4eeef2923f1fb54aa2785 100644
--- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
+++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp
@@ -610,7 +610,7 @@ class PropertyTreeManager {
// is actually its index in the property tree's vector of its node type. More
// recent cc code now refers to these as 'node indices', or 'property tree
// indices'. |parent_id| is the same sort of 'node index' of that node's
- // parent, whereas |owner_id| is the layer id of the layer owning that node.
+ // parent.
//
// Note there are two other primary types of 'ids' referenced in cc property
// tree related logic: (1) ElementId, also known Blink-side as
@@ -630,18 +630,19 @@ class PropertyTreeManager {
// platform/graphics/paint/README.md for more.
//
// With the above as background, we can now state more clearly a description
- // of the below set of compositor id generation methods: they take Blink paint
- // property tree nodes as input and produce a corresponding cc 'node id',
- // a.k.a., 'node index', for use as we build out the corresponding cc property
- // tree representation.
+ // of the below set of compositor node methods: they take Blink paint property
+ // tree nodes as input, create a corresponding compositor property tree node
+ // if none yet exists, and return the compositor node's 'node id', a.k.a.,
+ // 'node index'.
+
+ int ensureCompositorTransformNode(const TransformPaintPropertyNode*);
+ int ensureCompositorClipNode(const ClipPaintPropertyNode*);
+ int ensureCompositorScrollNode(const ScrollPaintPropertyNode*);
- int compositorIdForTransformNode(const TransformPaintPropertyNode*);
- int compositorIdForClipNode(const ClipPaintPropertyNode*);
int switchToEffectNode(const EffectPaintPropertyNode& nextEffect);
- int compositorIdForCurrentEffectNode() const {
+ int getCurrentCompositorEffectNodeIndex() const {
return m_effectStack.back().id;
}
- int compositorIdForScrollNode(const ScrollPaintPropertyNode*);
// Scroll offset has special treatment in the transform and scroll trees.
void updateScrollOffset(int layerId, int scrollId);
@@ -772,7 +773,7 @@ void PropertyTreeManager::setupRootScrollNode() {
m_rootLayer->SetScrollTreeIndex(scrollNode.id);
}
-int PropertyTreeManager::compositorIdForTransformNode(
+int PropertyTreeManager::ensureCompositorTransformNode(
const TransformPaintPropertyNode* transformNode) {
DCHECK(transformNode);
// TODO(crbug.com/645615): Remove the failsafe here.
@@ -784,7 +785,7 @@ int PropertyTreeManager::compositorIdForTransformNode(
return it->value;
scoped_refptr<cc::Layer> dummyLayer = cc::Layer::Create();
- int parentId = compositorIdForTransformNode(transformNode->parent());
+ int parentId = ensureCompositorTransformNode(transformNode->parent());
int id = transformTree().Insert(cc::TransformNode(), parentId);
cc::TransformNode& compositorNode = *transformTree().Node(id);
@@ -817,7 +818,7 @@ int PropertyTreeManager::compositorIdForTransformNode(
return id;
}
-int PropertyTreeManager::compositorIdForClipNode(
+int PropertyTreeManager::ensureCompositorClipNode(
const ClipPaintPropertyNode* clipNode) {
DCHECK(clipNode);
// TODO(crbug.com/645615): Remove the failsafe here.
@@ -829,7 +830,7 @@ int PropertyTreeManager::compositorIdForClipNode(
return it->value;
scoped_refptr<cc::Layer> dummyLayer = cc::Layer::Create();
- int parentId = compositorIdForClipNode(clipNode->parent());
+ int parentId = ensureCompositorClipNode(clipNode->parent());
int id = clipTree().Insert(cc::ClipNode(), parentId);
cc::ClipNode& compositorNode = *clipTree().Node(id);
@@ -840,7 +841,7 @@ int PropertyTreeManager::compositorIdForClipNode(
// TODO(jbroman): Don't discard rounded corners.
compositorNode.clip = clipNode->clipRect().rect();
compositorNode.transform_id =
- compositorIdForTransformNode(clipNode->localTransformSpace());
+ ensureCompositorTransformNode(clipNode->localTransformSpace());
compositorNode.target_transform_id = kRealRootNodeId;
compositorNode.target_effect_id = kSecondaryRootNodeId;
compositorNode.clip_type = cc::ClipNode::ClipType::APPLIES_LOCAL_CLIP;
@@ -860,7 +861,7 @@ int PropertyTreeManager::compositorIdForClipNode(
return id;
}
-int PropertyTreeManager::compositorIdForScrollNode(
+int PropertyTreeManager::ensureCompositorScrollNode(
const ScrollPaintPropertyNode* scrollNode) {
DCHECK(scrollNode);
// TODO(crbug.com/645615): Remove the failsafe here.
@@ -871,7 +872,7 @@ int PropertyTreeManager::compositorIdForScrollNode(
if (it != m_scrollNodeMap.end())
return it->value;
- int parentId = compositorIdForScrollNode(scrollNode->parent());
+ int parentId = ensureCompositorScrollNode(scrollNode->parent());
int id = scrollTree().Insert(cc::ScrollNode(), parentId);
cc::ScrollNode& compositorNode = *scrollTree().Node(id);
@@ -890,7 +891,7 @@ int PropertyTreeManager::compositorIdForScrollNode(
compositorNode.user_scrollable_vertical =
scrollNode->userScrollableVertical();
compositorNode.transform_id =
- compositorIdForTransformNode(scrollNode->scrollOffsetTranslation());
+ ensureCompositorTransformNode(scrollNode->scrollOffsetTranslation());
compositorNode.main_thread_scrolling_reasons =
scrollNode->mainThreadScrollingReasons();
@@ -970,13 +971,14 @@ int PropertyTreeManager::switchToEffectNode(
// See comments in PropertyTreeManager::buildEffectNodesRecursively().
// TODO(crbug.com/504464): Remove premature optimization here.
if (currentEffectNode() && currentEffectNode()->opacity() != 1.f) {
- effectTree().Node(compositorIdForCurrentEffectNode())->has_render_surface =
- true;
+ effectTree()
+ .Node(getCurrentCompositorEffectNodeIndex())
+ ->has_render_surface = true;
}
buildEffectNodesRecursively(&nextEffect);
- return compositorIdForCurrentEffectNode();
+ return getCurrentCompositorEffectNodeIndex();
}
void PropertyTreeManager::buildEffectNodesRecursively(
@@ -999,8 +1001,9 @@ void PropertyTreeManager::buildEffectNodesRecursively(
// blending mode. See comments below for more detail.
// TODO(crbug.com/504464): Remove premature optimization here.
if (nextEffect->blendMode() != SkBlendMode::kSrcOver) {
- effectTree().Node(compositorIdForCurrentEffectNode())->has_render_surface =
- true;
+ effectTree()
+ .Node(getCurrentCompositorEffectNodeIndex())
+ ->has_render_surface = true;
}
// We currently create dummy layers to host effect nodes and corresponding
@@ -1009,10 +1012,10 @@ void PropertyTreeManager::buildEffectNodesRecursively(
scoped_refptr<cc::Layer> dummyLayer = nextEffect->ensureDummyLayer();
m_rootLayer->AddChild(dummyLayer);
- int outputClipId = compositorIdForClipNode(nextEffect->outputClip());
+ int outputClipId = ensureCompositorClipNode(nextEffect->outputClip());
cc::EffectNode& effectNode = *effectTree().Node(effectTree().Insert(
- cc::EffectNode(), compositorIdForCurrentEffectNode()));
+ cc::EffectNode(), getCurrentCompositorEffectNodeIndex()));
effectNode.owning_layer_id = dummyLayer->id();
effectNode.clip_id = outputClipId;
// Every effect is supposed to have render surface enabled for grouping,
@@ -1194,11 +1197,11 @@ void PaintArtifactCompositor::update(
paintArtifact, pendingLayer, layerOffset, newContentLayerClients,
rasterChunkInvalidations, storeDebugInfo, geometryMapper);
- int transformId = propertyTreeManager.compositorIdForTransformNode(
+ int transformId = propertyTreeManager.ensureCompositorTransformNode(
pendingLayer.propertyTreeState.transform());
- int scrollId = propertyTreeManager.compositorIdForScrollNode(
+ int scrollId = propertyTreeManager.ensureCompositorScrollNode(
pendingLayer.propertyTreeState.scroll());
- int clipId = propertyTreeManager.compositorIdForClipNode(
+ int clipId = propertyTreeManager.ensureCompositorClipNode(
pendingLayer.propertyTreeState.clip());
int effectId = propertyTreeManager.switchToEffectNode(
*pendingLayer.propertyTreeState.effect());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698