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

Side by Side Diff: ui/events/win/events_win.cc

Issue 1975533002: Change ui::Event::time_stamp from TimeDelta to TimeTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
« no previous file with comments | « ui/events/test/events_test_utils_x11.cc ('k') | ui/events/x/events_x.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdint.h> 5 #include <stdint.h>
6 #include <windowsx.h> 6 #include <windowsx.h>
7 7
8 #include "ui/events/event_constants.h" 8 #include "ui/events/event_constants.h"
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 208 }
209 209
210 int EventFlagsFromNative(const base::NativeEvent& native_event) { 210 int EventFlagsFromNative(const base::NativeEvent& native_event) {
211 int flags = KeyStateFlagsFromNative(native_event); 211 int flags = KeyStateFlagsFromNative(native_event);
212 if (IsMouseEvent(native_event)) 212 if (IsMouseEvent(native_event))
213 flags |= MouseStateFlagsFromNative(native_event); 213 flags |= MouseStateFlagsFromNative(native_event);
214 214
215 return flags; 215 return flags;
216 } 216 }
217 217
218 base::TimeDelta EventTimeFromNative(const base::NativeEvent& native_event) { 218 base::TimeTicks EventTimeFromNative(const base::NativeEvent& native_event) {
219 // On Windows, the native input event timestamp (|native_event.time|) is 219 // On Windows, the native input event timestamp (|native_event.time|) is
220 // coming from |GetTickCount()| clock [1], while in platform independent code 220 // coming from |GetTickCount()| clock [1], while in platform independent code
221 // path we get timestamps by calling |TimeTicks::Now()|, which, if using high- 221 // path we get timestamps by calling |TimeTicks::Now()|, which, if using high-
222 // resolution timer as underlying implementation, could have different time 222 // resolution timer as underlying implementation, could have different time
223 // origin than |GetTickCount()|. To avoid the mismatching, we use 223 // origin than |GetTickCount()|. To avoid the mismatching, we use
224 // |TimeTicks::Now()| for event timestamp instead of the native timestamp to 224 // |TimeTicks::Now()| for event timestamp instead of the native timestamp to
225 // ensure computed input latency and web exposed timestamp is consistent with 225 // ensure computed input latency and web exposed timestamp is consistent with
226 // other components. 226 // other components.
227 // [1] http://blogs.msdn.com/b/oldnewthing/archive/2014/01/22/10491576.aspx 227 // [1] http://blogs.msdn.com/b/oldnewthing/archive/2014/01/22/10491576.aspx
228 return EventTimeForNow(); 228 return EventTimeForNow();
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 413 }
414 414
415 LPARAM GetLParamFromScanCode(uint16_t scan_code) { 415 LPARAM GetLParamFromScanCode(uint16_t scan_code) {
416 LPARAM l_param = static_cast<LPARAM>(scan_code & 0x00FF) << 16; 416 LPARAM l_param = static_cast<LPARAM>(scan_code & 0x00FF) << 16;
417 if ((scan_code & 0xE000) == 0xE000) 417 if ((scan_code & 0xE000) == 0xE000)
418 l_param |= (1 << 24); 418 l_param |= (1 << 24);
419 return l_param; 419 return l_param;
420 } 420 }
421 421
422 } // namespace ui 422 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/test/events_test_utils_x11.cc ('k') | ui/events/x/events_x.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698