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

Side by Side Diff: content/port/browser/event_with_latency_info.h

Issue 264033002: Move some interfaces from content/port to internal content since they're not referenced in content/… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/content_common.gypi ('k') | content/port/browser/render_view_host_delegate_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_PORT_BROWSER_EVENT_WITH_LATENCY_INFO_H_
6 #define CONTENT_PORT_BROWSER_EVENT_WITH_LATENCY_INFO_H_
7
8 #include "ui/events/latency_info.h"
9
10 #include "content/common/input/web_input_event_traits.h"
11
12 namespace blink {
13 class WebGestureEvent;
14 class WebMouseEvent;
15 class WebMouseWheelEvent;
16 class WebTouchEvent;
17 }
18
19 namespace content {
20
21 template <typename T>
22 class EventWithLatencyInfo {
23 public:
24 T event;
25 ui::LatencyInfo latency;
26
27 EventWithLatencyInfo(const T& e, const ui::LatencyInfo& l)
28 : event(e), latency(l) {}
29
30 EventWithLatencyInfo() {}
31
32 bool CanCoalesceWith(const EventWithLatencyInfo& other)
33 const WARN_UNUSED_RESULT {
34 return WebInputEventTraits::CanCoalesce(other.event, event);
35 }
36
37 void CoalesceWith(const EventWithLatencyInfo& other) {
38 WebInputEventTraits::Coalesce(other.event, &event);
39 // When coalescing two input events, we keep the oldest LatencyInfo
40 // for Telemetry latency test since it will represent the longest
41 // latency.
42 if (other.latency.trace_id >= 0 &&
43 (latency.trace_id < 0 || other.latency.trace_id < latency.trace_id))
44 latency = other.latency;
45 }
46 };
47
48 typedef EventWithLatencyInfo<blink::WebGestureEvent>
49 GestureEventWithLatencyInfo;
50 typedef EventWithLatencyInfo<blink::WebMouseWheelEvent>
51 MouseWheelEventWithLatencyInfo;
52 typedef EventWithLatencyInfo<blink::WebMouseEvent>
53 MouseEventWithLatencyInfo;
54 typedef EventWithLatencyInfo<blink::WebTouchEvent>
55 TouchEventWithLatencyInfo;
56
57 } // namespace content
58
59 #endif // CONTENT_PORT_BROWSER_EVENT_WITH_LATENCY_INFO_H_
OLDNEW
« no previous file with comments | « content/content_common.gypi ('k') | content/port/browser/render_view_host_delegate_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698