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

Side by Side Diff: Source/web/WebNodeList.cpp

Issue 280123002: Oilpan: move LiveNodeList collections to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Have NodeRareData clear out NodeListsNodeData instead. Created 6 years, 7 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
« no previous file with comments | « Source/web/WebFormElement.cpp ('k') | Source/web/WebPageSerializer.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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 24 matching lines...) Expand all
35 #include "core/dom/NodeList.h" 35 #include "core/dom/NodeList.h"
36 #include "public/web/WebNode.h" 36 #include "public/web/WebNode.h"
37 #include "wtf/PassRefPtr.h" 37 #include "wtf/PassRefPtr.h"
38 38
39 using namespace WebCore; 39 using namespace WebCore;
40 40
41 namespace blink { 41 namespace blink {
42 42
43 void WebNodeList::reset() 43 void WebNodeList::reset()
44 { 44 {
45 assign(0); 45 m_private.reset();
46 } 46 }
47 47
48 void WebNodeList::assign(const WebNodeList& other) 48 void WebNodeList::assign(const WebNodeList& other)
49 { 49 {
50 NodeList* p = const_cast<NodeList*>(other.m_private); 50 m_private = other.m_private;
51 if (p)
52 p->ref();
53 assign(p);
54 } 51 }
55 52
56 WebNodeList::WebNodeList(const PassRefPtr<NodeList>& col) 53 WebNodeList::WebNodeList(const PassRefPtrWillBeRawPtr<NodeList>& list)
57 : m_private(static_cast<NodeList*>(col.leakRef())) 54 : m_private(list)
58 { 55 {
59 } 56 }
60 57
61 void WebNodeList::assign(NodeList* p) 58 WebNodeList& WebNodeList::operator=(const PassRefPtrWillBeRawPtr<NodeList>& list )
62 { 59 {
63 // p is already ref'd for us by the caller 60 m_private = list;
64 if (m_private) 61 return *this;
65 m_private->deref();
66 m_private = p;
67 } 62 }
68 63
69 unsigned WebNodeList::length() const 64 unsigned WebNodeList::length() const
70 { 65 {
71 return m_private->length(); 66 return m_private->length();
72 } 67 }
73 68
74 WebNode WebNodeList::item(size_t index) const 69 WebNode WebNodeList::item(size_t index) const
75 { 70 {
76 return WebNode(m_private->item(index)); 71 return WebNode(m_private->item(index));
77 } 72 }
78 73
79 } // namespace blink 74 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebFormElement.cpp ('k') | Source/web/WebPageSerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698