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

Side by Side Diff: components/mus/common/event_param_traits.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
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 "components/mus/common/event_param_traits.h" 5 #include "components/mus/common/event_param_traits.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "ipc/ipc_message_utils.h" 9 #include "ipc/ipc_message_utils.h"
10 #include "ipc/ipc_param_traits.h" 10 #include "ipc/ipc_param_traits.h"
(...skipping 26 matching lines...) Expand all
37 37
38 namespace IPC { 38 namespace IPC {
39 39
40 // Implements (Write|Read|Log)Event for event type-qualified functions. Every 40 // Implements (Write|Read|Log)Event for event type-qualified functions. Every
41 // such function invokes an implementation according to the event type and 41 // such function invokes an implementation according to the event type and
42 // flags, or else invokes a default implementation. Event constructors require 42 // flags, or else invokes a default implementation. Event constructors require
43 // |type|, |time_stamp|, and |flags| (hence the common arguments passed to each 43 // |type|, |time_stamp|, and |flags| (hence the common arguments passed to each
44 // implementation). 44 // implementation).
45 #define EVENT_IMPL(ReturnType, methodName, implName, defaultCase, ...) \ 45 #define EVENT_IMPL(ReturnType, methodName, implName, defaultCase, ...) \
46 ReturnType ParamTraits<ui::ScopedEvent>::methodName( \ 46 ReturnType ParamTraits<ui::ScopedEvent>::methodName( \
47 ui::EventType type, base::TimeDelta time_stamp, int flags, \ 47 ui::EventType type, base::TimeTicks time_stamp, int flags, \
48 ##__VA_ARGS__) { \ 48 ##__VA_ARGS__) { \
49 switch (type) { \ 49 switch (type) { \
50 case ui::EventType::ET_MOUSE_PRESSED: \ 50 case ui::EventType::ET_MOUSE_PRESSED: \
51 case ui::EventType::ET_MOUSE_DRAGGED: \ 51 case ui::EventType::ET_MOUSE_DRAGGED: \
52 case ui::EventType::ET_MOUSE_RELEASED: \ 52 case ui::EventType::ET_MOUSE_RELEASED: \
53 case ui::EventType::ET_MOUSE_MOVED: \ 53 case ui::EventType::ET_MOUSE_MOVED: \
54 case ui::EventType::ET_MOUSE_ENTERED: \ 54 case ui::EventType::ET_MOUSE_ENTERED: \
55 case ui::EventType::ET_MOUSE_EXITED: \ 55 case ui::EventType::ET_MOUSE_EXITED: \
56 case ui::EventType::ET_MOUSE_CAPTURE_CHANGED: \ 56 case ui::EventType::ET_MOUSE_CAPTURE_CHANGED: \
57 implName(ui::MouseEvent) \ 57 implName(ui::MouseEvent) \
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 196 }
197 197
198 bool ParamTraits<ui::ScopedEvent>::Read(const base::Pickle* m, 198 bool ParamTraits<ui::ScopedEvent>::Read(const base::Pickle* m,
199 base::PickleIterator* iter, 199 base::PickleIterator* iter,
200 param_type* p) { 200 param_type* p) {
201 // Expect: valid ui::ScopedEvent that does not (yet) point to anything. 201 // Expect: valid ui::ScopedEvent that does not (yet) point to anything.
202 DCHECK(p && !*p); 202 DCHECK(p && !*p);
203 203
204 ui::EventType type; 204 ui::EventType type;
205 std::string name; 205 std::string name;
206 base::TimeDelta time_stamp; 206 base::TimeTicks time_stamp;
207 int flags; 207 int flags;
208 ui::EventPhase phase; 208 ui::EventPhase phase;
209 ui::EventResult result; 209 ui::EventResult result;
210 bool cancelable; 210 bool cancelable;
211 211
212 // Read initial params, then invoke ReadEvent which will reset() |p| to an 212 // Read initial params, then invoke ReadEvent which will reset() |p| to an
213 // instance of the correct concrete event type. 213 // instance of the correct concrete event type.
214 if (!ReadParam(m, iter, &type) || !ReadParam(m, iter, &name) || 214 if (!ReadParam(m, iter, &type) || !ReadParam(m, iter, &name) ||
215 !ReadParam(m, iter, &time_stamp) || !ReadParam(m, iter, &flags) || 215 !ReadParam(m, iter, &time_stamp) || !ReadParam(m, iter, &flags) ||
216 !ReadParam(m, iter, &phase) || !ReadParam(m, iter, &result) || 216 !ReadParam(m, iter, &phase) || !ReadParam(m, iter, &result) ||
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 memcpy(p, data, sizeof(param_type)); 275 memcpy(p, data, sizeof(param_type));
276 return true; 276 return true;
277 } 277 }
278 278
279 void ParamTraits<ui::GestureEventDetails::Details>::Log(const param_type& p, 279 void ParamTraits<ui::GestureEventDetails::Details>::Log(const param_type& p,
280 std::string* l) { 280 std::string* l) {
281 l->append("<ui::GestureEventDetails::Details>"); 281 l->append("<ui::GestureEventDetails::Details>");
282 } 282 }
283 283
284 } // namespace IPC 284 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698