Index: ui/aura/window_event_dispatcher_unittest.cc |
diff --git a/ui/aura/window_event_dispatcher_unittest.cc b/ui/aura/window_event_dispatcher_unittest.cc |
index b2cffaf6cd6a2001f294e8fe1a581dc10d8c25d6..ef6ecda0800508fc2981861ab4b848554ca9a037 100644 |
--- a/ui/aura/window_event_dispatcher_unittest.cc |
+++ b/ui/aura/window_event_dispatcher_unittest.cc |
@@ -1622,14 +1622,17 @@ class WindowEventDispatcherTestWithMessageLoop |
// Start a nested message-loop, post an event to be dispatched, and then |
// terminate the message-loop. When the message-loop unwinds and gets back, |
// the reposted event should not have fired. |
- ui::MouseEvent mouse(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), |
- gfx::Point(10, 10), ui::EF_NONE, ui::EF_NONE); |
- message_loop()->PostTask(FROM_HERE, |
- base::Bind(&WindowEventDispatcher::RepostEvent, |
- base::Unretained(host()->dispatcher()), |
- mouse)); |
- message_loop()->PostTask(FROM_HERE, |
- message_loop()->QuitClosure()); |
+ scoped_ptr<ui::MouseEvent> mouse(new ui::MouseEvent(ui::ET_MOUSE_PRESSED, |
+ gfx::Point(10, 10), |
+ gfx::Point(10, 10), |
+ ui::EF_NONE, |
+ ui::EF_NONE)); |
+ message_loop()->PostTask( |
+ FROM_HERE, |
+ base::Bind(&WindowEventDispatcherTestWithMessageLoop::RepostEventHelper, |
+ host()->dispatcher(), |
+ base::Passed(&mouse))); |
+ message_loop()->PostTask(FROM_HERE, message_loop()->QuitClosure()); |
base::MessageLoop::ScopedNestableTaskAllower allow(message_loop()); |
base::RunLoop loop; |
@@ -1657,6 +1660,12 @@ class WindowEventDispatcherTestWithMessageLoop |
} |
private: |
+ // Used to avoid a copying |event| when binding to a closure. |
+ static void RepostEventHelper(WindowEventDispatcher* dispatcher, |
+ scoped_ptr<ui::MouseEvent> event) { |
+ dispatcher->RepostEvent(*event); |
+ } |
+ |
scoped_ptr<Window> window_; |
ExitMessageLoopOnMousePress handler_; |