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

Side by Side Diff: Source/core/dom/Node.cpp

Issue 465223002: [ Do not submit ] Prototype for invalidation analysis Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Cleanup Created 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 #include "core/svg/graphics/SVGImage.h" 89 #include "core/svg/graphics/SVGImage.h"
90 #include "platform/Partitions.h" 90 #include "platform/Partitions.h"
91 #include "platform/TraceEvent.h" 91 #include "platform/TraceEvent.h"
92 #include "platform/TracedValue.h" 92 #include "platform/TracedValue.h"
93 #include "wtf/HashSet.h" 93 #include "wtf/HashSet.h"
94 #include "wtf/PassOwnPtr.h" 94 #include "wtf/PassOwnPtr.h"
95 #include "wtf/RefCountedLeakCounter.h" 95 #include "wtf/RefCountedLeakCounter.h"
96 #include "wtf/Vector.h" 96 #include "wtf/Vector.h"
97 #include "wtf/text/CString.h" 97 #include "wtf/text/CString.h"
98 #include "wtf/text/StringBuilder.h" 98 #include "wtf/text/StringBuilder.h"
99 #include <inttypes.h>
99 100
100 namespace blink { 101 namespace blink {
101 102
102 using namespace HTMLNames; 103 using namespace HTMLNames;
103 104
104 struct SameSizeAsNode : NODE_BASE_CLASSES { 105 struct SameSizeAsNode : NODE_BASE_CLASSES {
105 uint32_t m_nodeFlags; 106 uint32_t m_nodeFlags;
106 void* m_pointer[5]; 107 void* m_pointer[5];
107 }; 108 };
108 109
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType; 760 m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType;
760 } 761 }
761 762
762 void Node::markAncestorsWithChildNeedsStyleRecalc() 763 void Node::markAncestorsWithChildNeedsStyleRecalc()
763 { 764 {
764 for (ContainerNode* p = parentOrShadowHostNode(); p && !p->childNeedsStyleRe calc(); p = p->parentOrShadowHostNode()) 765 for (ContainerNode* p = parentOrShadowHostNode(); p && !p->childNeedsStyleRe calc(); p = p->parentOrShadowHostNode())
765 p->setChildNeedsStyleRecalc(); 766 p->setChildNeedsStyleRecalc();
766 document().scheduleRenderTreeUpdateIfNeeded(); 767 document().scheduleRenderTreeUpdateIfNeeded();
767 } 768 }
768 769
770 PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForTracedStyleInvalid ation(const Node* node, const StyleChangeType styleChangeType)
771 {
772 RefPtr<TracedValue> value = TracedValue::create();
773 value->setString("root_node", node->debugName());
774 LocalFrame* frame = node->document().frame();
775 value->setString("frame", String::format("0x%" PRIx64, static_cast<uint64>(r einterpret_cast<intptr_t>(frame))));
776 switch(styleChangeType) {
777 case(NoStyleChange): value->setString("styleChange", "NoStyleChange"); b reak;
778 case(LocalStyleChange): value->setString("styleChange", "LocalStyleChang e"); break;
779 case(SubtreeStyleChange): value->setString("styleChange", "SubtreeStyleC hange"); break;
780 case(NeedsReattachStyleChange): value->setString("styleChange", "NeedsRe attachStyleChange"); break;
781 default: value->setString("styleChange", "Unknown");
782 }
783 return value;
784 }
785
769 void Node::setNeedsStyleRecalc(StyleChangeType changeType) 786 void Node::setNeedsStyleRecalc(StyleChangeType changeType)
770 { 787 {
771 ASSERT(changeType != NoStyleChange); 788 ASSERT(changeType != NoStyleChange);
772 if (!inActiveDocument()) 789 if (!inActiveDocument())
773 return; 790 return;
774 791
775 StyleChangeType existingChangeType = styleChangeType(); 792 StyleChangeType existingChangeType = styleChangeType();
776 if (changeType > existingChangeType) { 793 if (changeType > existingChangeType) {
777 setStyleChange(changeType); 794 setStyleChange(changeType);
778 if (changeType >= SubtreeStyleChange) 795 if (changeType >= SubtreeStyleChange)
779 traceStyleChangeIfNeeded(changeType); 796 traceStyleChangeIfNeeded(changeType);
797 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invali dations"), "Invalidation", "data", jsonObjectForTracedStyleInvalidation(this, ch angeType));
780 } 798 }
781 799
782 if (existingChangeType == NoStyleChange) 800 if (existingChangeType == NoStyleChange)
783 markAncestorsWithChildNeedsStyleRecalc(); 801 markAncestorsWithChildNeedsStyleRecalc();
784 802
785 if (isElementNode() && hasRareData()) 803 if (isElementNode() && hasRareData())
786 toElement(*this).setAnimationStyleChange(false); 804 toElement(*this).setAnimationStyleChange(false);
787 } 805 }
788 806
789 void Node::clearNeedsStyleRecalc() 807 void Node::clearNeedsStyleRecalc()
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
2490 node->showTreeForThis(); 2508 node->showTreeForThis();
2491 } 2509 }
2492 2510
2493 void showNodePath(const blink::Node* node) 2511 void showNodePath(const blink::Node* node)
2494 { 2512 {
2495 if (node) 2513 if (node)
2496 node->showNodePathForThis(); 2514 node->showNodePathForThis();
2497 } 2515 }
2498 2516
2499 #endif 2517 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698