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

Side by Side Diff: Source/WebCore/dom/NodeRareData.h

Issue 14028014: Remove MicroData implementation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Also delete all the tests Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/WebCore/dom/Node.cpp ('k') | Source/WebCore/dom/NodeRareData.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 David Smith <catfish.man@gmail.com> 3 * Copyright (C) 2008 David Smith <catfish.man@gmail.com>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 22 matching lines...) Expand all
33 #include "TagNodeList.h" 33 #include "TagNodeList.h"
34 #if ENABLE(VIDEO_TRACK) 34 #if ENABLE(VIDEO_TRACK)
35 #include "TextTrack.h" 35 #include "TextTrack.h"
36 #endif 36 #endif
37 #include <wtf/HashSet.h> 37 #include <wtf/HashSet.h>
38 #include <wtf/OwnPtr.h> 38 #include <wtf/OwnPtr.h>
39 #include <wtf/PassOwnPtr.h> 39 #include <wtf/PassOwnPtr.h>
40 #include <wtf/text/AtomicString.h> 40 #include <wtf/text/AtomicString.h>
41 #include <wtf/text/StringHash.h> 41 #include <wtf/text/StringHash.h>
42 42
43 #if ENABLE(MICRODATA)
44 #include "HTMLPropertiesCollection.h"
45 #include "MicroDataAttributeTokenList.h"
46 #include "MicroDataItemList.h"
47 #endif
48
49 namespace WebCore { 43 namespace WebCore {
50 44
51 class LabelsNodeList; 45 class LabelsNodeList;
52 class RadioNodeList; 46 class RadioNodeList;
53 class TreeScope; 47 class TreeScope;
54 48
55 class NodeListsNodeData { 49 class NodeListsNodeData {
56 WTF_MAKE_NONCOPYABLE(NodeListsNodeData); WTF_MAKE_FAST_ALLOCATED; 50 WTF_MAKE_NONCOPYABLE(NodeListsNodeData); WTF_MAKE_FAST_ALLOCATED;
57 public: 51 public:
58 void clearChildNodeListCache() 52 void clearChildNodeListCache()
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 public: 243 public:
250 Vector<OwnPtr<MutationObserverRegistration> > registry; 244 Vector<OwnPtr<MutationObserverRegistration> > registry;
251 HashSet<MutationObserverRegistration*> transientRegistry; 245 HashSet<MutationObserverRegistration*> transientRegistry;
252 246
253 static PassOwnPtr<NodeMutationObserverData> create() { return adoptPtr(new N odeMutationObserverData); } 247 static PassOwnPtr<NodeMutationObserverData> create() { return adoptPtr(new N odeMutationObserverData); }
254 248
255 private: 249 private:
256 NodeMutationObserverData() { } 250 NodeMutationObserverData() { }
257 }; 251 };
258 252
259 #if ENABLE(MICRODATA)
260 class NodeMicroDataTokenLists {
261 WTF_MAKE_NONCOPYABLE(NodeMicroDataTokenLists); WTF_MAKE_FAST_ALLOCATED;
262 public:
263 static PassOwnPtr<NodeMicroDataTokenLists> create() { return adoptPtr(new No deMicroDataTokenLists); }
264
265 MicroDataAttributeTokenList* itemProp(Node* node) const
266 {
267 if (!m_itemProp)
268 m_itemProp = MicroDataAttributeTokenList::create(toElement(node), HT MLNames::itempropAttr);
269 return m_itemProp.get();
270 }
271
272 MicroDataAttributeTokenList* itemRef(Node* node) const
273 {
274 if (!m_itemRef)
275 m_itemRef = MicroDataAttributeTokenList::create(toElement(node), HTM LNames::itemrefAttr);
276 return m_itemRef.get();
277 }
278
279 MicroDataAttributeTokenList* itemType(Node* node) const
280 {
281 if (!m_itemType)
282 m_itemType = MicroDataAttributeTokenList::create(toElement(node), HT MLNames::itemtypeAttr);
283 return m_itemType.get();
284 }
285
286 private:
287 NodeMicroDataTokenLists() { }
288
289 mutable RefPtr<MicroDataAttributeTokenList> m_itemProp;
290 mutable RefPtr<MicroDataAttributeTokenList> m_itemRef;
291 mutable RefPtr<MicroDataAttributeTokenList> m_itemType;
292 };
293 #endif
294
295 class NodeRareData : public NodeRareDataBase { 253 class NodeRareData : public NodeRareDataBase {
296 WTF_MAKE_NONCOPYABLE(NodeRareData); WTF_MAKE_FAST_ALLOCATED; 254 WTF_MAKE_NONCOPYABLE(NodeRareData); WTF_MAKE_FAST_ALLOCATED;
297 public: 255 public:
298 static PassOwnPtr<NodeRareData> create(RenderObject* renderer) { return adop tPtr(new NodeRareData(renderer)); } 256 static PassOwnPtr<NodeRareData> create(RenderObject* renderer) { return adop tPtr(new NodeRareData(renderer)); }
299 257
300 void clearNodeLists() { m_nodeLists.clear(); } 258 void clearNodeLists() { m_nodeLists.clear(); }
301 NodeListsNodeData* nodeLists() const { return m_nodeLists.get(); } 259 NodeListsNodeData* nodeLists() const { return m_nodeLists.get(); }
302 NodeListsNodeData* ensureNodeLists() 260 NodeListsNodeData* ensureNodeLists()
303 { 261 {
304 if (!m_nodeLists) 262 if (!m_nodeLists)
305 m_nodeLists = NodeListsNodeData::create(); 263 m_nodeLists = NodeListsNodeData::create();
306 return m_nodeLists.get(); 264 return m_nodeLists.get();
307 } 265 }
308 266
309 NodeMutationObserverData* mutationObserverData() { return m_mutationObserver Data.get(); } 267 NodeMutationObserverData* mutationObserverData() { return m_mutationObserver Data.get(); }
310 NodeMutationObserverData* ensureMutationObserverData() 268 NodeMutationObserverData* ensureMutationObserverData()
311 { 269 {
312 if (!m_mutationObserverData) 270 if (!m_mutationObserverData)
313 m_mutationObserverData = NodeMutationObserverData::create(); 271 m_mutationObserverData = NodeMutationObserverData::create();
314 return m_mutationObserverData.get(); 272 return m_mutationObserverData.get();
315 } 273 }
316 274
317 #if ENABLE(MICRODATA)
318 NodeMicroDataTokenLists* ensureMicroDataTokenLists() const
319 {
320 if (!m_microDataTokenLists)
321 m_microDataTokenLists = NodeMicroDataTokenLists::create();
322 return m_microDataTokenLists.get();
323 }
324 #endif
325
326 unsigned connectedSubframeCount() const { return m_connectedFrameCount; } 275 unsigned connectedSubframeCount() const { return m_connectedFrameCount; }
327 void incrementConnectedSubframeCount(unsigned amount) 276 void incrementConnectedSubframeCount(unsigned amount)
328 { 277 {
329 m_connectedFrameCount += amount; 278 m_connectedFrameCount += amount;
330 } 279 }
331 void decrementConnectedSubframeCount(unsigned amount) 280 void decrementConnectedSubframeCount(unsigned amount)
332 { 281 {
333 ASSERT(m_connectedFrameCount); 282 ASSERT(m_connectedFrameCount);
334 ASSERT(amount <= m_connectedFrameCount); 283 ASSERT(amount <= m_connectedFrameCount);
335 m_connectedFrameCount -= amount; 284 m_connectedFrameCount -= amount;
336 } 285 }
337 286
338 // This member function is intentionally not virtual to avoid adding a vtabl e pointer. 287 // This member function is intentionally not virtual to avoid adding a vtabl e pointer.
339 void reportMemoryUsage(MemoryObjectInfo*) const; 288 void reportMemoryUsage(MemoryObjectInfo*) const;
340 289
341 protected: 290 protected:
342 NodeRareData(RenderObject* renderer) 291 NodeRareData(RenderObject* renderer)
343 : NodeRareDataBase(renderer) 292 : NodeRareDataBase(renderer)
344 , m_connectedFrameCount(0) 293 , m_connectedFrameCount(0)
345 { } 294 { }
346 295
347 private: 296 private:
348 unsigned m_connectedFrameCount : 10; // Must fit Page::maxNumberOfFrames. 297 unsigned m_connectedFrameCount : 10; // Must fit Page::maxNumberOfFrames.
349 298
350 OwnPtr<NodeListsNodeData> m_nodeLists; 299 OwnPtr<NodeListsNodeData> m_nodeLists;
351 OwnPtr<NodeMutationObserverData> m_mutationObserverData; 300 OwnPtr<NodeMutationObserverData> m_mutationObserverData;
352
353 #if ENABLE(MICRODATA)
354 mutable OwnPtr<NodeMicroDataTokenLists> m_microDataTokenLists;
355 #endif
356 }; 301 };
357 302
358 inline bool NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLas tList(Node* ownerNode) 303 inline bool NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLas tList(Node* ownerNode)
359 { 304 {
360 ASSERT(ownerNode); 305 ASSERT(ownerNode);
361 ASSERT(ownerNode->nodeLists() == this); 306 ASSERT(ownerNode->nodeLists() == this);
362 if ((m_childNodeList ? 1 : 0) + m_atomicNameCaches.size() + m_nameCaches.siz e() + m_tagNodeListCacheNS.size() != 1) 307 if ((m_childNodeList ? 1 : 0) + m_atomicNameCaches.size() + m_nameCaches.siz e() + m_tagNodeListCacheNS.size() != 1)
363 return false; 308 return false;
364 ownerNode->clearNodeLists(); 309 ownerNode->clearNodeLists();
365 return true; 310 return true;
366 } 311 }
367 312
368 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow 313 // Ensure the 10 bits reserved for the m_connectedFrameCount cannot overflow
369 COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_da ta_count); 314 COMPILE_ASSERT(Page::maxNumberOfFrames < 1024, Frame_limit_should_fit_in_rare_da ta_count);
370 315
371 } // namespace WebCore 316 } // namespace WebCore
372 317
373 #endif // NodeRareData_h 318 #endif // NodeRareData_h
OLDNEW
« no previous file with comments | « Source/WebCore/dom/Node.cpp ('k') | Source/WebCore/dom/NodeRareData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698