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

Unified Diff: ui/events/cocoa/events_mac.mm

Issue 1975533002: Change ui::Event::time_stamp from TimeDelta to TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix gesture recognizer tests Created 4 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/cocoa/events_mac.mm
diff --git a/ui/events/cocoa/events_mac.mm b/ui/events/cocoa/events_mac.mm
index 55edba342f2f0091c27161563da98bed34b0eeba..6c6d874e2dd25452753b87e5801a6886f47a16ee 100644
--- a/ui/events/cocoa/events_mac.mm
+++ b/ui/events/cocoa/events_mac.mm
@@ -12,8 +12,10 @@
#import "base/mac/sdk_forward_declarations.h"
#include "base/time/time.h"
#include "build/build_config.h"
+#include "ui/events/base_event_utils.h"
#include "ui/events/cocoa/cocoa_event_utils.h"
#include "ui/events/event_utils.h"
+
miu 2016/05/16 20:05:35 Please remove blank line here.
majidvp 2016/05/21 01:38:00 Done.
#import "ui/events/keycodes/keyboard_code_conversion_mac.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/vector2d.h"
@@ -77,14 +79,14 @@ int EventFlagsFromNative(const base::NativeEvent& event) {
return EventFlagsFromNSEventWithModifiers(event, modifiers);
}
-base::TimeDelta EventTimeFromNative(const base::NativeEvent& native_event) {
+base::TimeTicks EventTimeFromNative(const base::NativeEvent& native_event) {
NSTimeInterval since_system_startup = [native_event timestamp];
// Truncate to extract seconds before doing floating point arithmetic.
int64_t seconds = since_system_startup;
since_system_startup -= seconds;
int64_t microseconds = since_system_startup * 1000000;
- return base::TimeDelta::FromSeconds(seconds) +
- base::TimeDelta::FromMicroseconds(microseconds);
+ return ui::EventTimeStampFromSeconds(seconds) +
miu 2016/05/16 20:05:35 This feels brittle. How will you ensure this remai
majidvp 2016/05/21 01:38:00 Good point. I added a DCHECK to ensure it is withi
+ base::TimeDelta::FromMicroseconds(microseconds);
}
gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) {

Powered by Google App Engine
This is Rietveld 408576698