OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/message_loop/message_loop_proxy_impl.h" | 13 #include "base/message_loop/message_loop_proxy_impl.h" |
14 #include "base/message_loop/message_loop_test.h" | 14 #include "base/message_loop/message_loop_test.h" |
| 15 #include "base/message_loop/message_pump_dispatcher.h" |
15 #include "base/pending_task.h" | 16 #include "base/pending_task.h" |
16 #include "base/posix/eintr_wrapper.h" | 17 #include "base/posix/eintr_wrapper.h" |
17 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
18 #include "base/synchronization/waitable_event.h" | 19 #include "base/synchronization/waitable_event.h" |
19 #include "base/thread_task_runner_handle.h" | 20 #include "base/thread_task_runner_handle.h" |
20 #include "base/threading/platform_thread.h" | 21 #include "base/threading/platform_thread.h" |
21 #include "base/threading/thread.h" | 22 #include "base/threading/thread.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
23 | 24 |
24 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 MessageLoop::current()->PostTask( | 439 MessageLoop::current()->PostTask( |
439 FROM_HERE, | 440 FROM_HERE, |
440 Bind(&PostNTasksThenQuit, posts_remaining - 1)); | 441 Bind(&PostNTasksThenQuit, posts_remaining - 1)); |
441 } else { | 442 } else { |
442 MessageLoop::current()->QuitWhenIdle(); | 443 MessageLoop::current()->QuitWhenIdle(); |
443 } | 444 } |
444 } | 445 } |
445 | 446 |
446 #if defined(OS_WIN) | 447 #if defined(OS_WIN) |
447 | 448 |
448 class DispatcherImpl : public MessageLoopForUI::Dispatcher { | 449 class DispatcherImpl : public MessagePumpDispatcher { |
449 public: | 450 public: |
450 DispatcherImpl() : dispatch_count_(0) {} | 451 DispatcherImpl() : dispatch_count_(0) {} |
451 | 452 |
452 virtual bool Dispatch(const NativeEvent& msg) OVERRIDE { | 453 virtual bool Dispatch(const NativeEvent& msg) OVERRIDE { |
453 ::TranslateMessage(&msg); | 454 ::TranslateMessage(&msg); |
454 ::DispatchMessage(&msg); | 455 ::DispatchMessage(&msg); |
455 // Do not count WM_TIMER since it is not what we post and it will cause | 456 // Do not count WM_TIMER since it is not what we post and it will cause |
456 // flakiness. | 457 // flakiness. |
457 if (msg.message != WM_TIMER) | 458 if (msg.message != WM_TIMER) |
458 ++dispatch_count_; | 459 ++dispatch_count_; |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 | 1039 |
1039 ASSERT_TRUE(PostMessage(message_hwnd, kSignalMsg, 0, 1)); | 1040 ASSERT_TRUE(PostMessage(message_hwnd, kSignalMsg, 0, 1)); |
1040 | 1041 |
1041 loop.Run(); | 1042 loop.Run(); |
1042 | 1043 |
1043 ASSERT_TRUE(UnregisterClass(MAKEINTATOM(atom), instance)); | 1044 ASSERT_TRUE(UnregisterClass(MAKEINTATOM(atom), instance)); |
1044 } | 1045 } |
1045 #endif // defined(OS_WIN) | 1046 #endif // defined(OS_WIN) |
1046 | 1047 |
1047 } // namespace base | 1048 } // namespace base |
OLD | NEW |