| OLD | NEW |
| 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 "ui/events/event.h" | 5 #include "ui/events/event.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "ui/events/keycodes/keyboard_code_conversion_x.h" // nogncheck | 37 #include "ui/events/keycodes/keyboard_code_conversion_x.h" // nogncheck |
| 38 #elif defined(USE_OZONE) | 38 #elif defined(USE_OZONE) |
| 39 #include "ui/events/ozone/layout/keyboard_layout_engine.h" // nogncheck | 39 #include "ui/events/ozone/layout/keyboard_layout_engine.h" // nogncheck |
| 40 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" // nogncheck | 40 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" // nogncheck |
| 41 #endif | 41 #endif |
| 42 | 42 |
| 43 #if defined(OS_WIN) | 43 #if defined(OS_WIN) |
| 44 #include "ui/events/keycodes/platform_key_map_win.h" | 44 #include "ui/events/keycodes/platform_key_map_win.h" |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 // Support a collection of histograms, perhaps one for each entry in an | |
| 48 // enumeration. This macro manages a block of pointers, adding to a specific | |
| 49 // one by its index. | |
| 50 // | |
| 51 // A typical instantiation looks something like this: | |
| 52 // STATIC_HISTOGRAM_POINTER_GROUP( | |
| 53 // GetHistogramNameForIndex(histogram_index), | |
| 54 // histogram_index, MAXIMUM_HISTOGRAM_INDEX, Add(some_delta), | |
| 55 // base::Histogram::FactoryGet( | |
| 56 // GetHistogramNameForType(histogram_index), | |
| 57 // MINIMUM_SAMPLE, MAXIMUM_SAMPLE, BUCKET_COUNT, | |
| 58 // base::HistogramBase::kUmaTargetedHistogramFlag)); | |
| 59 // | |
| 60 // Though it seems inefficient to generate the name twice, the first | |
| 61 // instance will be used only for DCHECK builds and the second will | |
| 62 // execute only during the first access to the given index, after which | |
| 63 // the pointer is cached and the name never needed again. | |
| 64 // | |
| 65 // This is defined in this way so that it can be moved unchanged into | |
| 66 // base/metrics/histogram_macros.h if it is useful in other files. | |
| 67 #define STATIC_HISTOGRAM_POINTER_GROUP(constant_histogram_name, index, \ | |
| 68 constant_maximum, \ | |
| 69 histogram_add_method_invocation, \ | |
| 70 histogram_factory_get_invocation) \ | |
| 71 do { \ | |
| 72 static base::subtle::AtomicWord atomic_histograms[constant_maximum]; \ | |
| 73 DCHECK_LE(0, index); \ | |
| 74 DCHECK_LT(index, constant_maximum); \ | |
| 75 HISTOGRAM_POINTER_USE(&atomic_histograms[index], constant_histogram_name, \ | |
| 76 histogram_add_method_invocation, \ | |
| 77 histogram_factory_get_invocation); \ | |
| 78 } while (0) | |
| 79 | |
| 80 namespace { | 47 namespace { |
| 81 | 48 |
| 82 std::string EventTypeName(ui::EventType type) { | 49 std::string EventTypeName(ui::EventType type) { |
| 83 #define RETURN_IF_TYPE(t) if (type == ui::t) return #t | 50 #define RETURN_IF_TYPE(t) if (type == ui::t) return #t |
| 84 #define CASE_TYPE(t) case ui::t: return #t | 51 #define CASE_TYPE(t) case ui::t: return #t |
| 85 switch (type) { | 52 switch (type) { |
| 86 CASE_TYPE(ET_UNKNOWN); | 53 CASE_TYPE(ET_UNKNOWN); |
| 87 CASE_TYPE(ET_MOUSE_PRESSED); | 54 CASE_TYPE(ET_MOUSE_PRESSED); |
| 88 CASE_TYPE(ET_MOUSE_DRAGGED); | 55 CASE_TYPE(ET_MOUSE_DRAGGED); |
| 89 CASE_TYPE(ET_MOUSE_RELEASED); | 56 CASE_TYPE(ET_MOUSE_RELEASED); |
| (...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1424 flags | EF_FROM_TOUCH), | 1391 flags | EF_FROM_TOUCH), |
| 1425 details_(details), | 1392 details_(details), |
| 1426 unique_touch_event_id_(unique_touch_event_id) { | 1393 unique_touch_event_id_(unique_touch_event_id) { |
| 1427 latency()->set_source_event_type(ui::SourceEventType::TOUCH); | 1394 latency()->set_source_event_type(ui::SourceEventType::TOUCH); |
| 1428 } | 1395 } |
| 1429 | 1396 |
| 1430 GestureEvent::~GestureEvent() { | 1397 GestureEvent::~GestureEvent() { |
| 1431 } | 1398 } |
| 1432 | 1399 |
| 1433 } // namespace ui | 1400 } // namespace ui |
| OLD | NEW |