Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Unified Diff: content/common/input/event_packet.h

Issue 19624005: Add InputEvent and EventPacket types for batched input delivery (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/input/event_packet.h
diff --git a/content/common/input/event_packet.h b/content/common/input/event_packet.h
new file mode 100644
index 0000000000000000000000000000000000000000..31f91dbff861c3b7af47bf81f4557083cc698c88
--- /dev/null
+++ b/content/common/input/event_packet.h
@@ -0,0 +1,42 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_COMMON_INPUT_EVENT_PACKET_H_
+#define CONTENT_COMMON_INPUT_EVENT_PACKET_H_
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
+#include "content/common/content_export.h"
+
+namespace content {
+
+class InputEvent;
+
+// An id'ed sequence of InputEvents.
+class CONTENT_EXPORT EventPacket {
+ public:
+ typedef ScopedVector<InputEvent> InputEvents;
+
+ EventPacket();
+ ~EventPacket();
+
+ // |event| should be non-NULL and valid.
palmer 2013/09/03 23:12:47 Should, or must? What happens if I pass a NULL or
+ void Add(scoped_ptr<InputEvent> event);
+
+ bool empty() const { return events.empty(); }
+ size_t size() const { return events.size(); }
+ InputEvents::const_iterator begin() const { return events.begin(); }
palmer 2013/09/03 23:12:47 It seems like these accessors exist to hide the ex
jdduke (slow) 2013/09/04 17:53:24 Less for hiding and more for convenience, really.
+ InputEvents::const_iterator end() const { return events.end(); }
+
+ int64 id;
+ InputEvents events;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(EventPacket);
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_INPUT_EVENT_PACKET_H_

Powered by Google App Engine
This is Rietveld 408576698