OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "bindings/core/v8/ScriptWrappable.h" | 29 #include "bindings/core/v8/ScriptWrappable.h" |
30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
31 #include "platform/heap/Handle.h" | 31 #include "platform/heap/Handle.h" |
32 #include "wtf/PassRefPtr.h" | 32 #include "wtf/PassRefPtr.h" |
33 #include "wtf/RefCounted.h" | 33 #include "wtf/RefCounted.h" |
34 #include "wtf/Vector.h" | 34 #include "wtf/Vector.h" |
35 #include "wtf/text/WTFString.h" | 35 #include "wtf/text/WTFString.h" |
36 | 36 |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
| 39 class ExecutionContext; |
| 40 |
39 // FIXME: Some consumers of this class may benefit from lazily fetching items ra
ther | 41 // FIXME: Some consumers of this class may benefit from lazily fetching items ra
ther |
40 // than creating the list statically as is currently the only option. | 42 // than creating the list statically as is currently the only option. |
41 class CORE_EXPORT DOMStringList final : public RefCountedWillBeGarbageCollectedF
inalized<DOMStringList>, public ScriptWrappable { | 43 class CORE_EXPORT DOMStringList final : public RefCountedWillBeGarbageCollectedF
inalized<DOMStringList>, public ScriptWrappable { |
42 DEFINE_WRAPPERTYPEINFO(); | 44 DEFINE_WRAPPERTYPEINFO(); |
43 public: | 45 public: |
44 static PassRefPtrWillBeRawPtr<DOMStringList> create() | 46 // We would like to remove DOMStringList from the platform if possible. |
| 47 // Track the source of each instance so we can measure the use of methods |
| 48 // not present on Arrays and determine the feasibility of removal and |
| 49 // what path it should take. http://crbug.com/460726 |
| 50 enum Source { IndexedDB, Location }; |
| 51 |
| 52 static PassRefPtrWillBeRawPtr<DOMStringList> create(Source source) |
45 { | 53 { |
46 return adoptRefWillBeNoop(new DOMStringList()); | 54 return adoptRefWillBeNoop(new DOMStringList(source)); |
47 } | 55 } |
48 | 56 |
49 bool isEmpty() const { return m_strings.isEmpty(); } | 57 bool isEmpty() const { return m_strings.isEmpty(); } |
50 void clear() { m_strings.clear(); } | 58 void clear() { m_strings.clear(); } |
51 void append(const String& string) { m_strings.append(string); } | 59 void append(const String& string) { m_strings.append(string); } |
52 void sort(); | 60 void sort(); |
53 | 61 |
54 // Implements the IDL. | 62 // Implements the IDL. |
55 size_t length() const { return m_strings.size(); } | 63 size_t length() const { return m_strings.size(); } |
56 String item(unsigned index) const; | 64 String anonymousIndexedGetter(unsigned index) const; |
57 bool contains(const String& str) const; | 65 |
| 66 String item(ExecutionContext*, unsigned index) const; |
| 67 bool contains(ExecutionContext*, const String&) const; |
58 | 68 |
59 operator const Vector<String>&() const { return m_strings; } | 69 operator const Vector<String>&() const { return m_strings; } |
60 | 70 |
61 DEFINE_INLINE_TRACE() { } | 71 DEFINE_INLINE_TRACE() { } |
62 | 72 |
63 private: | 73 private: |
64 DOMStringList() { } | 74 DOMStringList(Source source) : m_source(source) { } |
65 | 75 |
66 Vector<String> m_strings; | 76 Vector<String> m_strings; |
| 77 Source m_source; |
67 }; | 78 }; |
68 | 79 |
69 } // namespace blink | 80 } // namespace blink |
70 | 81 |
71 #endif // DOMStringList_h | 82 #endif // DOMStringList_h |
OLD | NEW |