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

Unified Diff: ui/events/event.cc

Issue 231883003: [stash] 20140404-crbug-312961-mac-views-bridge-C-wholegrid Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/cocoa/events_mac.mm ('k') | ui/events/event_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/event.cc
diff --git a/ui/events/event.cc b/ui/events/event.cc
index 41f4ca69ebb8a010a748cb70e4404fdfcb42d0ce..0f2403d2152db1a672414896f5679f0943b831b2 100644
--- a/ui/events/event.cc
+++ b/ui/events/event.cc
@@ -29,24 +29,6 @@
namespace {
-base::NativeEvent CopyNativeEvent(const base::NativeEvent& event) {
-#if defined(USE_X11)
- if (!event || event->type == GenericEvent)
- return NULL;
- XEvent* copy = new XEvent;
- *copy = *event;
- return copy;
-#elif defined(OS_WIN)
- return event;
-#elif defined(USE_OZONE)
- return NULL;
-#else
- NOTREACHED() <<
- "Don't know how to copy base::NativeEvent for this platform";
- return NULL;
-#endif
-}
-
std::string EventTypeName(ui::EventType type) {
#define RETURN_IF_TYPE(t) if (type == ui::t) return #t
#define CASE_TYPE(t) case ui::t: return #t
@@ -119,10 +101,9 @@ namespace ui {
// Event
Event::~Event() {
-#if defined(USE_X11)
- if (delete_native_event_)
- delete native_event_;
-#endif
+ if (!delete_native_event_)
+ return;
+ ReleaseCopiedNativeEvent(native_event_);
}
bool Event::HasNativeEvent() const {
@@ -198,7 +179,7 @@ Event::Event(const Event& copy)
time_stamp_(copy.time_stamp_),
latency_(copy.latency_),
flags_(copy.flags_),
- native_event_(::CopyNativeEvent(copy.native_event_)),
+ native_event_(CopyNativeEvent(copy.native_event_)),
delete_native_event_(false),
cancelable_(true),
target_(NULL),
@@ -206,7 +187,7 @@ Event::Event(const Event& copy)
result_(ER_UNHANDLED) {
if (type_ < ET_LAST)
name_ = EventTypeName(type_);
-#if defined(USE_X11)
+#if defined(USE_X11) || defined(OS_MACOSX)
if (native_event_)
delete_native_event_ = true;
#endif
« no previous file with comments | « ui/events/cocoa/events_mac.mm ('k') | ui/events/event_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698