OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/threading/thread.h" | 5 #include "base/threading/thread.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 virtual void Run() { | 37 virtual void Run() { |
38 base::PlatformThread::Sleep(msec_); | 38 base::PlatformThread::Sleep(msec_); |
39 } | 39 } |
40 private: | 40 private: |
41 int msec_; | 41 int msec_; |
42 }; | 42 }; |
43 | 43 |
44 class SleepInsideInitThread : public Thread { | 44 class SleepInsideInitThread : public Thread { |
45 public: | 45 public: |
46 SleepInsideInitThread() : Thread("none") { init_called_ = false; } | 46 SleepInsideInitThread() : Thread("none") { |
| 47 init_called_ = false; |
| 48 ANNOTATE_BENIGN_RACE(this, "http://crbug.com/98219"); |
| 49 } |
47 virtual ~SleepInsideInitThread() { } | 50 virtual ~SleepInsideInitThread() { } |
48 | 51 |
49 virtual void Init() { | 52 virtual void Init() { |
50 base::PlatformThread::Sleep(500); | 53 base::PlatformThread::Sleep(500); |
51 init_called_ = true; | 54 init_called_ = true; |
52 } | 55 } |
53 bool InitCalled() { return init_called_; } | 56 bool InitCalled() { return init_called_; } |
54 private: | 57 private: |
55 bool init_called_; | 58 bool init_called_; |
56 }; | 59 }; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 248 |
246 // Upon leaving this scope, the thread is deleted. | 249 // Upon leaving this scope, the thread is deleted. |
247 } | 250 } |
248 | 251 |
249 // Check the order of events during shutdown. | 252 // Check the order of events during shutdown. |
250 ASSERT_EQ(static_cast<size_t>(THREAD_NUM_EVENTS), captured_events.size()); | 253 ASSERT_EQ(static_cast<size_t>(THREAD_NUM_EVENTS), captured_events.size()); |
251 EXPECT_EQ(THREAD_EVENT_INIT, captured_events[0]); | 254 EXPECT_EQ(THREAD_EVENT_INIT, captured_events[0]); |
252 EXPECT_EQ(THREAD_EVENT_CLEANUP, captured_events[1]); | 255 EXPECT_EQ(THREAD_EVENT_CLEANUP, captured_events[1]); |
253 EXPECT_EQ(THREAD_EVENT_MESSAGE_LOOP_DESTROYED, captured_events[2]); | 256 EXPECT_EQ(THREAD_EVENT_MESSAGE_LOOP_DESTROYED, captured_events[2]); |
254 } | 257 } |
OLD | NEW |