| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WebCoalescedInputEvent_h | 5 #ifndef WebCoalescedInputEvent_h |
| 6 #define WebCoalescedInputEvent_h | 6 #define WebCoalescedInputEvent_h |
| 7 | 7 |
| 8 #include "WebCommon.h" | 8 #include "WebCommon.h" |
| 9 #include "WebInputEvent.h" | 9 #include "WebInputEvent.h" |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 struct BLINK_COMMON_EXPORT WebInputEventDeleter { | 16 struct BLINK_COMMON_EXPORT WebInputEventDeleter { |
| 17 void operator()(blink::WebInputEvent*) const; | 17 void operator()(blink::WebInputEvent*) const; |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 using WebScopedInputEvent = | 20 using WebScopedInputEvent = |
| 21 std::unique_ptr<WebInputEvent, WebInputEventDeleter>; | 21 std::unique_ptr<WebInputEvent, WebInputEventDeleter>; |
| 22 | 22 |
| 23 // This class is representing a polymorphic WebInputEvent structure with its | 23 // This class is representing a polymorphic WebInputEvent structure with its |
| 24 // coalesced events. The event could be any events defined in WebInputEvent.h. | 24 // coalesced events. The event could be any events defined in WebInputEvent.h. |
| 25 class BLINK_COMMON_EXPORT WebCoalescedInputEvent { | 25 class BLINK_COMMON_EXPORT WebCoalescedInputEvent { |
| 26 public: | 26 public: |
| 27 WebCoalescedInputEvent(WebScopedInputEvent); | 27 explicit WebCoalescedInputEvent(WebScopedInputEvent); |
| 28 WebCoalescedInputEvent(const WebInputEvent&); | 28 explicit WebCoalescedInputEvent(const WebInputEvent&); |
| 29 WebCoalescedInputEvent(const WebInputEvent&, | 29 WebCoalescedInputEvent(const WebInputEvent&, |
| 30 const std::vector<const WebInputEvent*>&); | 30 const std::vector<const WebInputEvent*>&); |
| 31 | 31 |
| 32 WebInputEvent* eventPointer(); | 32 WebInputEvent* eventPointer(); |
| 33 void addCoalescedEvent(const blink::WebInputEvent&); | 33 void addCoalescedEvent(const blink::WebInputEvent&); |
| 34 const WebInputEvent& event() const; | 34 const WebInputEvent& event() const; |
| 35 size_t coalescedEventSize() const; | 35 size_t coalescedEventSize() const; |
| 36 const WebInputEvent* coalescedEvent(int index) const; | 36 const WebInputEvent& coalescedEvent(size_t index) const; |
| 37 std::vector<const WebInputEvent*> getCoalescedEventsPointers() const; | 37 std::vector<const WebInputEvent*> getCoalescedEventsPointers() const; |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 WebScopedInputEvent m_event; | 40 WebScopedInputEvent m_event; |
| 41 std::vector<WebScopedInputEvent> m_coalescedEvents; | 41 std::vector<WebScopedInputEvent> m_coalescedEvents; |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 using WebScopedCoalescedInputEvent = std::unique_ptr<WebCoalescedInputEvent>; | 44 using WebScopedCoalescedInputEvent = std::unique_ptr<WebCoalescedInputEvent>; |
| 45 | 45 |
| 46 } // namespace blink | 46 } // namespace blink |
| 47 | 47 |
| 48 #endif | 48 #endif |
| OLD | NEW |