| OLD | NEW |
| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 default: \ | 107 default: \ |
| 108 defaultCase; \ | 108 defaultCase; \ |
| 109 } \ | 109 } \ |
| 110 } | 110 } |
| 111 | 111 |
| 112 // Concrete event type (T) implementation procedures: size, write, read, log. | 112 // Concrete event type (T) implementation procedures: size, write, read, log. |
| 113 #define SIZE_EVENT(T) ParamTraits<T>::GetSize(s, *static_cast<T*>(p.get())); | 113 #define SIZE_EVENT(T) ParamTraits<T>::GetSize(s, *static_cast<T*>(p.get())); |
| 114 #define WRITE_EVENT(T) \ | 114 #define WRITE_EVENT(T) \ |
| 115 ParamTraits<T>::Write(m, *static_cast<T*>(p.get())); \ | 115 ParamTraits<T>::Write(m, *static_cast<T*>(p.get())); \ |
| 116 break; | 116 break; |
| 117 #define READ_EVENT(T) \ | 117 #define READ_EVENT(T) \ |
| 118 { \ | 118 { \ |
| 119 scoped_ptr<T> event(new T(type, time_stamp, flags)); \ | 119 std::unique_ptr<T> event(new T(type, time_stamp, flags)); \ |
| 120 if (!ParamTraits<T>::Read(m, iter, event.get())) { \ | 120 if (!ParamTraits<T>::Read(m, iter, event.get())) { \ |
| 121 p->reset(); \ | 121 p->reset(); \ |
| 122 return false; \ | 122 return false; \ |
| 123 } else { \ | 123 } else { \ |
| 124 *p = std::move(event); \ | 124 *p = std::move(event); \ |
| 125 return true; \ | 125 return true; \ |
| 126 } \ | 126 } \ |
| 127 } | 127 } |
| 128 #define LOG_EVENT(T) return ParamTraits<T>::Log(*static_cast<T*>(p.get()), l); | 128 #define LOG_EVENT(T) return ParamTraits<T>::Log(*static_cast<T*>(p.get()), l); |
| 129 | 129 |
| 130 // void SizeEvent(ui::EventType type, int flags, base::PickleSizer* s, | 130 // void SizeEvent(ui::EventType type, int flags, base::PickleSizer* s, |
| 131 // const ui::ScopedEvent& p) { ... } | 131 // const ui::ScopedEvent& p) { ... } |
| 132 EVENT_IMPL(void, | 132 EVENT_IMPL(void, |
| 133 SizeEvent, | 133 SizeEvent, |
| 134 SIZE_EVENT, | 134 SIZE_EVENT, |
| 135 /* default switch/case: no-op */, | 135 /* default switch/case: no-op */, |
| 136 base::PickleSizer* s, | 136 base::PickleSizer* s, |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |