Chromium Code Reviews| Index: third_party/WebKit/public/platform/CoalescedWebInputEvent.h |
| diff --git a/third_party/WebKit/public/platform/CoalescedWebInputEvent.h b/third_party/WebKit/public/platform/CoalescedWebInputEvent.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..743aa874aff6a00ca03976f2fa95369c253d48b2 |
| --- /dev/null |
| +++ b/third_party/WebKit/public/platform/CoalescedWebInputEvent.h |
| @@ -0,0 +1,73 @@ |
| +/* |
| + * Copyright (C) 2009 Google Inc. All rights reserved. |
|
dtapuska
2016/11/21 18:21:18
wrong copy right use the simplified one for chromi
|
| + * |
| + * Redistribution and use in source and binary forms, with or without |
| + * modification, are permitted provided that the following conditions are |
| + * met: |
| + * |
| + * * Redistributions of source code must retain the above copyright |
| + * notice, this list of conditions and the following disclaimer. |
| + * * Redistributions in binary form must reproduce the above |
| + * copyright notice, this list of conditions and the following disclaimer |
| + * in the documentation and/or other materials provided with the |
| + * distribution. |
| + * * Neither the name of Google Inc. nor the names of its |
| + * contributors may be used to endorse or promote products derived from |
| + * this software without specific prior written permission. |
| + * |
| + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| + */ |
| + |
| +#ifndef CoalescedWebInputEvent_h |
|
dglazkov
2016/12/06 03:46:47
Nit: WebCoalescedInputEvent <-- "Web" is the prefi
|
| +#define CoalescedWebInputEvent_h |
| + |
| +#include "WebInputEvent.h" |
| + |
| +#include <memory> |
| + |
| +namespace blink { |
| + |
| +// This class is representing a polymorphic WebInputEvent structure with its |
| +// coalesced events. The event could be any events defined in WebInputEvent.h. |
| +class CoalescedWebInputEvent { |
|
jbroman
2016/11/22 15:27:37
nit: I'd actually prefer the words in the other or
|
| + public: |
| + struct WebInputEventDeleter { |
| + WebInputEventDeleter(); |
| + void operator()(blink::WebInputEvent* web_event) const; |
|
jbroman
2016/11/22 15:27:37
Hmm. I thought WebInputEvent (and its derived clas
Navid Zolghadr
2016/11/22 15:38:04
I believe their destructor is not virtual intentio
jbroman
2016/11/22 16:02:39
OK. Strictly speaking this is the most correct thi
|
| + }; |
| + |
| + using ScopedWebInputEvent = |
| + std::unique_ptr<WebInputEvent, WebInputEventDeleter>; |
| + |
| + CoalescedWebInputEvent(ScopedWebInputEvent); |
| + CoalescedWebInputEvent(const WebInputEvent&); |
| + CoalescedWebInputEvent(const WebInputEvent&, |
| + const std::vector<const WebInputEvent*>&); |
| + |
| + WebInputEvent* eventPointer(); |
|
dtapuska
2016/11/21 18:21:18
should we have a const ptr version as well? How of
|
| + const WebInputEvent& event() const; |
| + void addCoalescedEvent(const blink::WebInputEvent&); |
| + size_t coalescedEventSize(); |
|
dtapuska
2016/11/21 18:21:18
const?
|
| + WebInputEvent* coalescedEvent(int index); |
| + const std::vector<WebInputEvent*>& getCoalescedEventsPointers(); |
|
dtapuska
2016/11/21 18:21:18
is this const function?
|
| + |
| + private: |
| + ScopedWebInputEvent mEvent; |
|
dtapuska
2016/11/21 18:21:18
These are a weird format for member definition.
|
| + std::vector<ScopedWebInputEvent> mCoalescedEvents; |
|
jbroman
2016/11/22 15:27:37
Blink style: m_event, m_coalescedEvents
std::vect
Navid Zolghadr
2016/11/22 15:38:04
Alright. I didn't know about WebVector. So can I u
jbroman
2016/11/22 16:02:39
WebVector is legal throughout Blink if you're deal
|
| +}; |
| + |
| +typedef std::unique_ptr<CoalescedWebInputEvent> ScopedCoalescedWebInputEvent; |
| + |
| +} // namespace blink |
| + |
| +#endif |