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/pending_task.h" | 14 #include "base/pending_task.h" |
14 #include "base/posix/eintr_wrapper.h" | 15 #include "base/posix/eintr_wrapper.h" |
15 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
16 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
17 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
18 #include "base/threading/platform_thread.h" | 19 #include "base/threading/platform_thread.h" |
19 #include "base/threading/thread.h" | 20 #include "base/threading/thread.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
21 | 22 |
22 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
23 #include "base/message_loop/message_pump_win.h" | 24 #include "base/message_loop/message_pump_win.h" |
24 #include "base/win/scoped_handle.h" | 25 #include "base/win/scoped_handle.h" |
25 #endif | 26 #endif |
26 | 27 |
27 namespace base { | 28 namespace base { |
28 | 29 |
29 class MessageLoopLockTest { | 30 class MessageLoopLockTest { |
30 public: | 31 public: |
31 static void LockWaitUnLock(MessageLoop* loop, | 32 static void LockWaitUnLock(MessageLoop* loop, |
32 WaitableEvent* caller_wait, | 33 WaitableEvent* caller_wait, |
33 WaitableEvent* caller_signal) { | 34 WaitableEvent* caller_signal) { |
34 | 35 |
35 loop->incoming_queue_lock_.Acquire(); | 36 loop->message_loop_proxy_->message_loop_lock_.Acquire(); |
36 caller_wait->Signal(); | 37 caller_wait->Signal(); |
37 caller_signal->Wait(); | 38 caller_signal->Wait(); |
38 loop->incoming_queue_lock_.Release(); | 39 loop->message_loop_proxy_->message_loop_lock_.Release(); |
39 } | 40 } |
40 }; | 41 }; |
41 | 42 |
42 // TODO(darin): Platform-specific MessageLoop tests should be grouped together | 43 // TODO(darin): Platform-specific MessageLoop tests should be grouped together |
43 // to avoid chopping this file up with so many #ifdefs. | 44 // to avoid chopping this file up with so many #ifdefs. |
44 | 45 |
45 namespace { | 46 namespace { |
46 | 47 |
47 class Foo : public RefCounted<Foo> { | 48 class Foo : public RefCounted<Foo> { |
48 public: | 49 public: |
(...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2107 // On Linux, the pipe buffer size is 64KiB by default. The bug caused one | 2108 // On Linux, the pipe buffer size is 64KiB by default. The bug caused one |
2108 // byte accumulated in the pipe per two posts, so we should repeat 128K | 2109 // byte accumulated in the pipe per two posts, so we should repeat 128K |
2109 // times to reproduce the bug. | 2110 // times to reproduce the bug. |
2110 const int kNumTimes = 1 << 17; | 2111 const int kNumTimes = 1 << 17; |
2111 RunTest_RecursivePosts(MessageLoop::TYPE_DEFAULT, kNumTimes); | 2112 RunTest_RecursivePosts(MessageLoop::TYPE_DEFAULT, kNumTimes); |
2112 RunTest_RecursivePosts(MessageLoop::TYPE_UI, kNumTimes); | 2113 RunTest_RecursivePosts(MessageLoop::TYPE_UI, kNumTimes); |
2113 RunTest_RecursivePosts(MessageLoop::TYPE_IO, kNumTimes); | 2114 RunTest_RecursivePosts(MessageLoop::TYPE_IO, kNumTimes); |
2114 } | 2115 } |
2115 | 2116 |
2116 } // namespace base | 2117 } // namespace base |
OLD | NEW |