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

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: Win export fix 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
« no previous file with comments | « content/common/input/OWNERS ('k') | content/common/input/event_packet.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..04819909ccf788797d9efbe64fa41ba9b8d0ca4a
--- /dev/null
+++ b/content/common/input/event_packet.h
@@ -0,0 +1,49 @@
+// 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();
+
+ // Only a non-NULL and valid |event| will be accepted and added to the packet.
+ // Returns true if |event| was added, and false otherwise.
+ bool Add(scoped_ptr<InputEvent> event);
+
+ void set_id(int64 id) { id_ = id; }
+ int64 id() const { return id_; }
+
+ // Accessor functions for convenience.
+ bool empty() const { return events_.empty(); }
+ size_t size() const { return events_.size(); }
+ InputEvents::const_iterator begin() const { return events_.end(); }
+ InputEvents::const_iterator end() const { return events_.end(); }
+ const InputEvents& events() const { return events_; }
+
+ protected:
+ int64 id_;
+ InputEvents events_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(EventPacket);
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_INPUT_EVENT_PACKET_H_
« no previous file with comments | « content/common/input/OWNERS ('k') | content/common/input/event_packet.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698