| 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 "base/message_loop_proxy.h" | 5 #include "base/message_loop_proxy.h" |
| 6 | 6 |
| 7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/debug/leak_annotations.h" | 9 #include "base/debug/leak_annotations.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 | 89 |
| 90 void UnblockTaskThread() { | 90 void UnblockTaskThread() { |
| 91 thread_sync_.Signal(); | 91 thread_sync_.Signal(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void BlockTaskThreadHelper() { | 94 void BlockTaskThreadHelper() { |
| 95 thread_sync_.Wait(); | 95 thread_sync_.Wait(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 static AtomicSequenceNumber g_order; | 98 static StaticAtomicSequenceNumber g_order; |
| 99 | 99 |
| 100 scoped_ptr<MessageLoop> current_loop_; | 100 scoped_ptr<MessageLoop> current_loop_; |
| 101 Thread task_thread_; | 101 Thread task_thread_; |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 base::WaitableEvent thread_sync_; | 104 base::WaitableEvent thread_sync_; |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 AtomicSequenceNumber MessageLoopProxyTest::g_order(LINKER_INITIALIZED); | 107 StaticAtomicSequenceNumber MessageLoopProxyTest::g_order; |
| 108 | 108 |
| 109 TEST_F(MessageLoopProxyTest, PostTaskAndReply_Basic) { | 109 TEST_F(MessageLoopProxyTest, PostTaskAndReply_Basic) { |
| 110 MessageLoop* task_run_on = NULL; | 110 MessageLoop* task_run_on = NULL; |
| 111 MessageLoop* task_deleted_on = NULL; | 111 MessageLoop* task_deleted_on = NULL; |
| 112 int task_delete_order = -1; | 112 int task_delete_order = -1; |
| 113 MessageLoop* reply_run_on = NULL; | 113 MessageLoop* reply_run_on = NULL; |
| 114 MessageLoop* reply_deleted_on = NULL; | 114 MessageLoop* reply_deleted_on = NULL; |
| 115 int reply_delete_order = -1; | 115 int reply_delete_order = -1; |
| 116 | 116 |
| 117 scoped_refptr<LoopRecorder> task_recoder = | 117 scoped_refptr<LoopRecorder> task_recoder = |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 // it, we cannot just delete it because PostTaskAndReplyRelay's destructor | 257 // it, we cannot just delete it because PostTaskAndReplyRelay's destructor |
| 258 // checks that MessageLoop::current() is the the same as when the | 258 // checks that MessageLoop::current() is the the same as when the |
| 259 // PostTaskAndReplyRelay object was constructed. However, this loop must have | 259 // PostTaskAndReplyRelay object was constructed. However, this loop must have |
| 260 // aleady been deleted in order to perform this test. See | 260 // aleady been deleted in order to perform this test. See |
| 261 // http://crbug.com/86301. | 261 // http://crbug.com/86301. |
| 262 } | 262 } |
| 263 | 263 |
| 264 } // namespace | 264 } // namespace |
| 265 | 265 |
| 266 } // namespace base | 266 } // namespace base |
| OLD | NEW |