Chromium Code Reviews| 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 | |
| 50 size_t touchCount = touches.size(); | |
| 51 for (size_t i = 0; i < touchCount; ++i) { | |
|
dtapuska
2015/11/04 16:29:43
Remove braces; and you should be able to use a ran
sof
2015/11/04 16:38:27
list->m_values.appendVector(touches); is shorter,
| |
| 52 list->append(touches[i]); | |
| 53 } | |
| 54 return list.release(); | |
| 55 } | |
| 56 | |
| 46 static PassRefPtrWillBeRawPtr<TouchList> adopt(WillBeHeapVector<RefPtrWillBe Member<Touch>>& touches) | 57 static PassRefPtrWillBeRawPtr<TouchList> adopt(WillBeHeapVector<RefPtrWillBe Member<Touch>>& touches) |
| 47 { | 58 { |
| 48 return adoptRefWillBeNoop(new TouchList(touches)); | 59 return adoptRefWillBeNoop(new TouchList(touches)); |
| 49 } | 60 } |
| 50 | 61 |
| 51 unsigned length() const { return m_values.size(); } | 62 unsigned length() const { return m_values.size(); } |
| 52 | 63 |
| 53 Touch* item(unsigned); | 64 Touch* item(unsigned); |
| 54 const Touch* item(unsigned) const; | 65 const Touch* item(unsigned) const; |
| 55 | 66 |
| 56 void append(const PassRefPtrWillBeRawPtr<Touch> touch) { m_values.append(tou ch); } | 67 void append(const PassRefPtrWillBeRawPtr<Touch> touch) { m_values.append(tou ch); } |
| 57 | 68 |
| 58 DECLARE_TRACE(); | 69 DECLARE_TRACE(); |
| 59 | 70 |
| 60 private: | 71 private: |
| 61 TouchList() { } | 72 TouchList() { } |
| 62 | 73 |
| 63 TouchList(WillBeHeapVector<RefPtrWillBeMember<Touch>>& touches) | 74 TouchList(WillBeHeapVector<RefPtrWillBeMember<Touch>>& touches) |
| 64 { | 75 { |
| 65 m_values.swap(touches); | 76 m_values.swap(touches); |
| 66 } | 77 } |
| 67 | 78 |
| 68 WillBeHeapVector<RefPtrWillBeMember<Touch>> m_values; | 79 WillBeHeapVector<RefPtrWillBeMember<Touch>> m_values; |
| 69 }; | 80 }; |
| 70 | 81 |
| 71 } // namespace blink | 82 } // namespace blink |
| 72 | 83 |
| 73 #endif // TouchList_h | 84 #endif // TouchList_h |
| OLD | NEW |