| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/events/ozone/evdev/libgestures_glue/gesture_feedback.h" | 5 #include "ui/events/ozone/evdev/libgestures_glue/gesture_feedback.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <time.h> | 8 #include <time.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 for (size_t j = 0; j < names.size(); ++j) { | 162 for (size_t j = 0; j < names.size(); ++j) { |
| 163 status->append(base::StringPrintf("\t%s (%zu):", names[j].c_str(), j)); | 163 status->append(base::StringPrintf("\t%s (%zu):", names[j].c_str(), j)); |
| 164 GesturesProp* property = provider->GetProperty(ids[i], names[j]); | 164 GesturesProp* property = provider->GetProperty(ids[i], names[j]); |
| 165 status->append("\t" + DumpGesturePropertyValue(property) + '\n'); | 165 status->append("\t" + DumpGesturePropertyValue(property) + '\n'); |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 | 169 |
| 170 // Dump touch event logs. | 170 // Dump touch event logs. |
| 171 void DumpTouchEventLog( | 171 void DumpTouchEventLog( |
| 172 std::map<base::FilePath, EventConverterEvdev*>& converters, | 172 const std::map<base::FilePath, std::unique_ptr<EventConverterEvdev>>& |
| 173 converters, |
| 173 GesturePropertyProvider* provider, | 174 GesturePropertyProvider* provider, |
| 174 const base::FilePath& out_dir, | 175 const base::FilePath& out_dir, |
| 175 std::unique_ptr<std::vector<base::FilePath>> log_paths, | 176 std::unique_ptr<std::vector<base::FilePath>> log_paths, |
| 176 const GetTouchEventLogReply& reply) { | 177 const GetTouchEventLogReply& reply) { |
| 177 // Get device ids. | 178 // Get device ids. |
| 178 std::vector<int> ids; | 179 std::vector<int> ids; |
| 179 provider->GetDeviceIdsByType(DT_ALL, &ids); | 180 provider->GetDeviceIdsByType(DT_ALL, &ids); |
| 180 | 181 |
| 181 // Get current time stamp. | 182 // Get current time stamp. |
| 182 std::string now = GetCurrentTimeForLogging(); | 183 std::string now = GetCurrentTimeForLogging(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 212 base::FilePath(evdev_log_filename)); | 213 base::FilePath(evdev_log_filename)); |
| 213 | 214 |
| 214 // Historically, we compress touchpad/mouse logs with gzip before tarring | 215 // Historically, we compress touchpad/mouse logs with gzip before tarring |
| 215 // them up. We DONT compress touchscreen logs though. | 216 // them up. We DONT compress touchscreen logs though. |
| 216 log_paths_to_be_compressed->push_back(gesture_log_filename); | 217 log_paths_to_be_compressed->push_back(gesture_log_filename); |
| 217 log_paths->push_back(base::FilePath(gesture_log_filename)); | 218 log_paths->push_back(base::FilePath(gesture_log_filename)); |
| 218 log_paths_to_be_compressed->push_back(evdev_log_filename); | 219 log_paths_to_be_compressed->push_back(evdev_log_filename); |
| 219 log_paths->push_back(base::FilePath(evdev_log_filename)); | 220 log_paths->push_back(base::FilePath(evdev_log_filename)); |
| 220 } | 221 } |
| 221 | 222 |
| 222 for (auto it = converters.begin(); it != converters.end(); ++it) { | 223 for (const auto& converter_pair : converters) { |
| 223 EventConverterEvdev* converter = it->second; | 224 EventConverterEvdev* converter = converter_pair.second.get(); |
| 224 if (converter->HasTouchscreen()) { | 225 if (converter->HasTouchscreen()) { |
| 225 converter->DumpTouchEventLog(kInputEventsLogFile); | 226 converter->DumpTouchEventLog(kInputEventsLogFile); |
| 226 std::string touch_evdev_log_filename = GenerateEventLogName( | 227 std::string touch_evdev_log_filename = GenerateEventLogName( |
| 227 out_dir, "evdev_input_events_", now, converter->id()); | 228 out_dir, "evdev_input_events_", now, converter->id()); |
| 228 base::Move(base::FilePath(kInputEventsLogFile), | 229 base::Move(base::FilePath(kInputEventsLogFile), |
| 229 base::FilePath(touch_evdev_log_filename)); | 230 base::FilePath(touch_evdev_log_filename)); |
| 230 log_paths->push_back(base::FilePath(touch_evdev_log_filename)); | 231 log_paths->push_back(base::FilePath(touch_evdev_log_filename)); |
| 231 } | 232 } |
| 232 } | 233 } |
| 233 | 234 |
| 234 // Compress touchpad/mouse logs on another thread and return. | 235 // Compress touchpad/mouse logs on another thread and return. |
| 235 base::WorkerPool::PostTaskAndReply( | 236 base::WorkerPool::PostTaskAndReply( |
| 236 FROM_HERE, | 237 FROM_HERE, |
| 237 base::Bind(&CompressDumpedLog, base::Passed(&log_paths_to_be_compressed)), | 238 base::Bind(&CompressDumpedLog, base::Passed(&log_paths_to_be_compressed)), |
| 238 base::Bind(reply, base::Passed(&log_paths)), true /* task_is_slow */); | 239 base::Bind(reply, base::Passed(&log_paths)), true /* task_is_slow */); |
| 239 } | 240 } |
| 240 | 241 |
| 241 } // namespace ui | 242 } // namespace ui |
| OLD | NEW |