Index: content/common/input/event_with_latency_info.h |
diff --git a/content/common/input/event_with_latency_info.h b/content/common/input/event_with_latency_info.h |
index 24742a3baeb0f57f6755724c5cd33ba93272c6b3..c224201c2fb22ed26aa8d064ea6fe765efb9bda9 100644 |
--- a/content/common/input/event_with_latency_info.h |
+++ b/content/common/input/event_with_latency_info.h |
@@ -5,17 +5,12 @@ |
#ifndef CONTENT_COMMON_INPUT_EVENT_WITH_LATENCY_INFO_H_ |
#define CONTENT_COMMON_INPUT_EVENT_WITH_LATENCY_INFO_H_ |
+#include "base/compiler_specific.h" |
+#include "content/common/content_export.h" |
+#include "ipc/export_template.h" |
+#include "third_party/WebKit/public/web/WebInputEvent.h" |
#include "ui/events/latency_info.h" |
-#include "content/common/input/web_input_event_traits.h" |
- |
-namespace blink { |
-class WebGestureEvent; |
-class WebMouseEvent; |
-class WebMouseWheelEvent; |
-class WebTouchEvent; |
-} |
- |
namespace content { |
template <typename T> |
@@ -24,31 +19,40 @@ class EventWithLatencyInfo { |
T event; |
mutable ui::LatencyInfo latency; |
+ EventWithLatencyInfo() {} |
explicit EventWithLatencyInfo(const T& e) : event(e) {} |
- |
EventWithLatencyInfo(const T& e, const ui::LatencyInfo& l) |
: event(e), latency(l) {} |
- EventWithLatencyInfo() {} |
+#if defined(OS_WIN) |
+ // Explicitly declare these, otherwise invoking the move constructor via |
+ // dllimport on Windows generates a link error. See http://crbug.com/623844. |
+ // Declare all three otherwise the move constructor will hide the others. |
+ EventWithLatencyInfo(const EventWithLatencyInfo& other) = default; |
+ EventWithLatencyInfo(EventWithLatencyInfo&& other) = default; |
+ EventWithLatencyInfo& operator=(const EventWithLatencyInfo& other) = default; |
+#endif |
- bool CanCoalesceWith(const EventWithLatencyInfo& other) |
- const WARN_UNUSED_RESULT { |
- return WebInputEventTraits::CanCoalesce(other.event, event); |
- } |
- |
- void CoalesceWith(const EventWithLatencyInfo& other) { |
- // |other| should be a newer event than |this|. |
- if (other.latency.trace_id() >= 0 && latency.trace_id() >= 0) |
- DCHECK_GT(other.latency.trace_id(), latency.trace_id()); |
- WebInputEventTraits::Coalesce(other.event, &event); |
- // When coalescing two input events, we keep the oldest LatencyInfo |
- // for Telemetry latency tests, since it will represent the longest |
- // latency. |
- other.latency = latency; |
- other.latency.set_coalesced(); |
- } |
+ bool CanCoalesceWith(const EventWithLatencyInfo& other) const |
+ WARN_UNUSED_RESULT; |
+ void CoalesceWith(const EventWithLatencyInfo& other); |
}; |
+// The required types are known beforehand, so avoid compiling the required |
+// template in each translation unit that instantiates one by declaring them |
+// extern. This also allows some internals to be deferred to the .cc. If another |
+// type is instantiated, the compiler will generate code for everything except |
+// [Can]CoalesceWith(): If those methods are also _invoked_ there will be a link |
+// error unless they're defined somewhere as well. |
+extern template class EXPORT_TEMPLATE_DECLARE(CONTENT_EXPORT) |
+ EventWithLatencyInfo<blink::WebGestureEvent>; |
+extern template class EXPORT_TEMPLATE_DECLARE(CONTENT_EXPORT) |
+ EventWithLatencyInfo<blink::WebMouseWheelEvent>; |
+extern template class EXPORT_TEMPLATE_DECLARE(CONTENT_EXPORT) |
+ EventWithLatencyInfo<blink::WebMouseEvent>; |
+extern template class EXPORT_TEMPLATE_DECLARE(CONTENT_EXPORT) |
+ EventWithLatencyInfo<blink::WebTouchEvent>; |
+ |
typedef EventWithLatencyInfo<blink::WebGestureEvent> |
GestureEventWithLatencyInfo; |
typedef EventWithLatencyInfo<blink::WebMouseWheelEvent> |