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

Side by Side Diff: third_party/WebKit/Source/core/dom/NodeRareData.cpp

Issue 2814603002: Move LayoutObject to satellite NodeLayoutData that hangs from a Node. (Closed)
Patch Set: Question Created 3 years, 8 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 21 matching lines...) Expand all
32 32
33 #include "bindings/core/v8/ScriptWrappableVisitor.h" 33 #include "bindings/core/v8/ScriptWrappableVisitor.h"
34 #include "core/dom/Element.h" 34 #include "core/dom/Element.h"
35 #include "core/dom/ElementRareData.h" 35 #include "core/dom/ElementRareData.h"
36 #include "core/page/Page.h" 36 #include "core/page/Page.h"
37 #include "platform/heap/Handle.h" 37 #include "platform/heap/Handle.h"
38 38
39 namespace blink { 39 namespace blink {
40 40
41 struct SameSizeAsNodeRareData { 41 struct SameSizeAsNodeRareData {
42 void* pointer_;
43 Member<void*> willbe_member_[2]; 42 Member<void*> willbe_member_[2];
44 unsigned bitfields_; 43 unsigned bitfields_;
45 }; 44 };
46 45
47 static_assert(sizeof(NodeRareData) == sizeof(SameSizeAsNodeRareData), 46 static_assert(sizeof(NodeRareData) == sizeof(SameSizeAsNodeRareData),
48 "NodeRareData should stay small"); 47 "NodeRareData should stay small");
49 48
50 DEFINE_TRACE_AFTER_DISPATCH(NodeRareData) { 49 DEFINE_TRACE_AFTER_DISPATCH(NodeRareData) {
51 visitor->Trace(mutation_observer_data_); 50 visitor->Trace(mutation_observer_data_);
52 // Do not keep empty NodeListsNodeData objects around. 51 // Do not keep empty NodeListsNodeData objects around.
(...skipping 17 matching lines...) Expand all
70 else 69 else
71 TraceWrappersAfterDispatch(visitor); 70 TraceWrappersAfterDispatch(visitor);
72 } 71 }
73 72
74 DEFINE_TRACE_WRAPPERS_AFTER_DISPATCH(NodeRareData) { 73 DEFINE_TRACE_WRAPPERS_AFTER_DISPATCH(NodeRareData) {
75 visitor->TraceWrappersWithManualWriteBarrier(node_lists_); 74 visitor->TraceWrappersWithManualWriteBarrier(node_lists_);
76 visitor->TraceWrappersWithManualWriteBarrier(mutation_observer_data_); 75 visitor->TraceWrappersWithManualWriteBarrier(mutation_observer_data_);
77 } 76 }
78 77
79 void NodeRareData::FinalizeGarbageCollectedObject() { 78 void NodeRareData::FinalizeGarbageCollectedObject() {
80 CHECK(!GetLayoutObject());
81 if (is_element_rare_data_) 79 if (is_element_rare_data_)
82 static_cast<ElementRareData*>(this)->~ElementRareData(); 80 static_cast<ElementRareData*>(this)->~ElementRareData();
83 else 81 else
84 this->~NodeRareData(); 82 this->~NodeRareData();
85 } 83 }
86 84
87 void NodeRareData::IncrementConnectedSubframeCount() { 85 void NodeRareData::IncrementConnectedSubframeCount() {
88 SECURITY_CHECK((connected_frame_count_ + 1) <= Page::kMaxNumberOfFrames); 86 SECURITY_CHECK((connected_frame_count_ + 1) <= Page::kMaxNumberOfFrames);
89 ++connected_frame_count_; 87 ++connected_frame_count_;
90 } 88 }
91 89
92 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow 90 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow
93 static_assert(Page::kMaxNumberOfFrames < 91 static_assert(Page::kMaxNumberOfFrames <
94 (1 << NodeRareData::kConnectedFrameCountBits), 92 (1 << NodeRareData::kConnectedFrameCountBits),
95 "Frame limit should fit in rare data count"); 93 "Frame limit should fit in rare data count");
96 94
97 } // namespace blink 95 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698