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

Side by Side Diff: public/web/WebElementCollection.h

Issue 280123002: Oilpan: move LiveNodeList collections to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Pre-emptively GC a long runnning test 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 14 matching lines...) Expand all
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #ifndef WebElementCollection_h 32 #ifndef WebElementCollection_h
33 #define WebElementCollection_h 33 #define WebElementCollection_h
34 34
35 #include "../platform/WebCommon.h" 35 #include "public/platform/WebCommon.h"
tkent 2014/05/13 11:20:37 Please keep ../. This change will break Chromium
sof 2014/05/15 09:23:24 Reverted, but I notice there are both styles (i.e.
36 #include "public/platform/WebPrivatePtr.h"
36 37
37 namespace WebCore { class HTMLCollection; } 38 namespace WebCore { class HTMLCollection; }
38 #if BLINK_IMPLEMENTATION 39 #if BLINK_IMPLEMENTATION
40 #include "platform/heap/Handle.h"
39 namespace WTF { template <typename T> class PassRefPtr; } 41 namespace WTF { template <typename T> class PassRefPtr; }
40 #endif 42 #endif
41 43
42 namespace blink { 44 namespace blink {
43 class WebElement; 45 class WebElement;
44 46
45 // Provides readonly access to some properties of a DOM node. 47 // Provides readonly access to some properties of a DOM node.
46 class WebElementCollection { 48 class WebElementCollection {
47 public: 49 public:
48 ~WebElementCollection() { reset(); } 50 ~WebElementCollection() { reset(); }
49 51
50 WebElementCollection() : m_private(0), m_current(0) { } 52 WebElementCollection() : m_current(0) { }
51 WebElementCollection(const WebElementCollection& n) : m_private(0) { assign( n); } 53 WebElementCollection(const WebElementCollection& n) { assign(n); }
52 WebElementCollection& operator=(const WebElementCollection& n) 54 WebElementCollection& operator=(const WebElementCollection& n)
53 { 55 {
54 assign(n); 56 assign(n);
55 return *this; 57 return *this;
56 } 58 }
57 59
58 bool isNull() const { return !m_private; } 60 bool isNull() const { return m_private.isNull(); }
haraken 2014/05/12 12:04:13 Nit: If we forget to make this change, do we hit a
sof 2014/05/12 12:24:36 I seem to remember answering this question in some
59 61
60 BLINK_EXPORT void reset(); 62 BLINK_EXPORT void reset();
61 BLINK_EXPORT void assign(const WebElementCollection&); 63 BLINK_EXPORT void assign(const WebElementCollection&);
62 64
63 BLINK_EXPORT unsigned length() const; 65 BLINK_EXPORT unsigned length() const;
64 BLINK_EXPORT WebElement nextItem() const; 66 BLINK_EXPORT WebElement nextItem() const;
65 BLINK_EXPORT WebElement firstItem() const; 67 BLINK_EXPORT WebElement firstItem() const;
66 68
67 #if BLINK_IMPLEMENTATION 69 #if BLINK_IMPLEMENTATION
68 WebElementCollection(const WTF::PassRefPtr<WebCore::HTMLCollection>&); 70 WebElementCollection(const PassRefPtrWillBeRawPtr<WebCore::HTMLCollection>&) ;
71 WebElementCollection& operator=(const PassRefPtrWillBeRawPtr<WebCore::HTMLCo llection>&);
69 #endif 72 #endif
70 73
71 private: 74 private:
72 void assign(WebCore::HTMLCollection*); 75 WebPrivatePtr<WebCore::HTMLCollection> m_private;
73 WebCore::HTMLCollection* m_private;
74 mutable unsigned m_current; 76 mutable unsigned m_current;
75 }; 77 };
76 78
77 } // namespace blink 79 } // namespace blink
78 80
79 #endif 81 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698