OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008, The Android Open Source Project | 2 * Copyright 2008, The Android Open Source Project |
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 * * Redistributions of source code must retain the above copyright | 7 * * 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 * * Redistributions in binary form must reproduce the above copyright | 9 * * 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 25 matching lines...) Expand all Loading... |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 class CORE_EXPORT TouchList final : public RefCountedWillBeGarbageCollected<Touc
hList>, public ScriptWrappable { | 38 class CORE_EXPORT TouchList final : public RefCountedWillBeGarbageCollected<Touc
hList>, public ScriptWrappable { |
39 DEFINE_WRAPPERTYPEINFO(); | 39 DEFINE_WRAPPERTYPEINFO(); |
40 public: | 40 public: |
41 static PassRefPtrWillBeRawPtr<TouchList> create() | 41 static PassRefPtrWillBeRawPtr<TouchList> create() |
42 { | 42 { |
43 return adoptRefWillBeNoop(new TouchList); | 43 return adoptRefWillBeNoop(new TouchList); |
44 } | 44 } |
45 | 45 |
| 46 static PassRefPtrWillBeRawPtr<TouchList> create(const WillBeHeapVector<RefPt
rWillBeMember<Touch>>& touches) |
| 47 { |
| 48 RefPtrWillBeRawPtr<TouchList> list = adoptRefWillBeNoop(new TouchList); |
| 49 list->m_values.appendVector(touches); |
| 50 return list.release(); |
| 51 } |
| 52 |
46 static PassRefPtrWillBeRawPtr<TouchList> adopt(WillBeHeapVector<RefPtrWillBe
Member<Touch>>& touches) | 53 static PassRefPtrWillBeRawPtr<TouchList> adopt(WillBeHeapVector<RefPtrWillBe
Member<Touch>>& touches) |
47 { | 54 { |
48 return adoptRefWillBeNoop(new TouchList(touches)); | 55 return adoptRefWillBeNoop(new TouchList(touches)); |
49 } | 56 } |
50 | 57 |
51 unsigned length() const { return m_values.size(); } | 58 unsigned length() const { return m_values.size(); } |
52 | 59 |
53 Touch* item(unsigned); | 60 Touch* item(unsigned); |
54 const Touch* item(unsigned) const; | 61 const Touch* item(unsigned) const; |
55 | 62 |
56 void append(const PassRefPtrWillBeRawPtr<Touch> touch) { m_values.append(tou
ch); } | 63 void append(const PassRefPtrWillBeRawPtr<Touch> touch) { m_values.append(tou
ch); } |
57 | 64 |
58 DECLARE_TRACE(); | 65 DECLARE_TRACE(); |
59 | 66 |
60 private: | 67 private: |
61 TouchList() { } | 68 TouchList() { } |
62 | 69 |
63 TouchList(WillBeHeapVector<RefPtrWillBeMember<Touch>>& touches) | 70 TouchList(WillBeHeapVector<RefPtrWillBeMember<Touch>>& touches) |
64 { | 71 { |
65 m_values.swap(touches); | 72 m_values.swap(touches); |
66 } | 73 } |
67 | 74 |
68 WillBeHeapVector<RefPtrWillBeMember<Touch>> m_values; | 75 WillBeHeapVector<RefPtrWillBeMember<Touch>> m_values; |
69 }; | 76 }; |
70 | 77 |
71 } // namespace blink | 78 } // namespace blink |
72 | 79 |
73 #endif // TouchList_h | 80 #endif // TouchList_h |
OLD | NEW |