Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: base/threading/thread_unittest.cc

Issue 611153004: replace OVERRIDE and FINAL with override and final in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CC_ -> BASE_ Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/threading/thread_perftest.cc ('k') | base/threading/watchdog.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/threading/thread.h" 5 #include "base/threading/thread.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 17 matching lines...) Expand all
28 public: 28 public:
29 SleepInsideInitThread() : Thread("none") { 29 SleepInsideInitThread() : Thread("none") {
30 init_called_ = false; 30 init_called_ = false;
31 ANNOTATE_BENIGN_RACE( 31 ANNOTATE_BENIGN_RACE(
32 this, "Benign test-only data race on vptr - http://crbug.com/98219"); 32 this, "Benign test-only data race on vptr - http://crbug.com/98219");
33 } 33 }
34 virtual ~SleepInsideInitThread() { 34 virtual ~SleepInsideInitThread() {
35 Stop(); 35 Stop();
36 } 36 }
37 37
38 virtual void Init() OVERRIDE { 38 virtual void Init() override {
39 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(500)); 39 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(500));
40 init_called_ = true; 40 init_called_ = true;
41 } 41 }
42 bool InitCalled() { return init_called_; } 42 bool InitCalled() { return init_called_; }
43 private: 43 private:
44 bool init_called_; 44 bool init_called_;
45 }; 45 };
46 46
47 enum ThreadEvent { 47 enum ThreadEvent {
48 // Thread::Init() was called. 48 // Thread::Init() was called.
(...skipping 18 matching lines...) Expand all
67 // lifetime of this thread. 67 // lifetime of this thread.
68 explicit CaptureToEventList(EventList* event_list) 68 explicit CaptureToEventList(EventList* event_list)
69 : Thread("none"), 69 : Thread("none"),
70 event_list_(event_list) { 70 event_list_(event_list) {
71 } 71 }
72 72
73 virtual ~CaptureToEventList() { 73 virtual ~CaptureToEventList() {
74 Stop(); 74 Stop();
75 } 75 }
76 76
77 virtual void Init() OVERRIDE { 77 virtual void Init() override {
78 event_list_->push_back(THREAD_EVENT_INIT); 78 event_list_->push_back(THREAD_EVENT_INIT);
79 } 79 }
80 80
81 virtual void CleanUp() OVERRIDE { 81 virtual void CleanUp() override {
82 event_list_->push_back(THREAD_EVENT_CLEANUP); 82 event_list_->push_back(THREAD_EVENT_CLEANUP);
83 } 83 }
84 84
85 private: 85 private:
86 EventList* event_list_; 86 EventList* event_list_;
87 }; 87 };
88 88
89 // Observer that writes a value into |event_list| when a message loop has been 89 // Observer that writes a value into |event_list| when a message loop has been
90 // destroyed. 90 // destroyed.
91 class CapturingDestructionObserver 91 class CapturingDestructionObserver
92 : public base::MessageLoop::DestructionObserver { 92 : public base::MessageLoop::DestructionObserver {
93 public: 93 public:
94 // |event_list| must remain valid throughout the observer's lifetime. 94 // |event_list| must remain valid throughout the observer's lifetime.
95 explicit CapturingDestructionObserver(EventList* event_list) 95 explicit CapturingDestructionObserver(EventList* event_list)
96 : event_list_(event_list) { 96 : event_list_(event_list) {
97 } 97 }
98 98
99 // DestructionObserver implementation: 99 // DestructionObserver implementation:
100 virtual void WillDestroyCurrentMessageLoop() OVERRIDE { 100 virtual void WillDestroyCurrentMessageLoop() override {
101 event_list_->push_back(THREAD_EVENT_MESSAGE_LOOP_DESTROYED); 101 event_list_->push_back(THREAD_EVENT_MESSAGE_LOOP_DESTROYED);
102 event_list_ = NULL; 102 event_list_ = NULL;
103 } 103 }
104 104
105 private: 105 private:
106 EventList* event_list_; 106 EventList* event_list_;
107 }; 107 };
108 108
109 // Task that adds a destruction observer to the current message loop. 109 // Task that adds a destruction observer to the current message loop.
110 void RegisterDestructionObserver( 110 void RegisterDestructionObserver(
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 // Upon leaving this scope, the thread is deleted. 231 // Upon leaving this scope, the thread is deleted.
232 } 232 }
233 233
234 // Check the order of events during shutdown. 234 // Check the order of events during shutdown.
235 ASSERT_EQ(static_cast<size_t>(THREAD_NUM_EVENTS), captured_events.size()); 235 ASSERT_EQ(static_cast<size_t>(THREAD_NUM_EVENTS), captured_events.size());
236 EXPECT_EQ(THREAD_EVENT_INIT, captured_events[0]); 236 EXPECT_EQ(THREAD_EVENT_INIT, captured_events[0]);
237 EXPECT_EQ(THREAD_EVENT_CLEANUP, captured_events[1]); 237 EXPECT_EQ(THREAD_EVENT_CLEANUP, captured_events[1]);
238 EXPECT_EQ(THREAD_EVENT_MESSAGE_LOOP_DESTROYED, captured_events[2]); 238 EXPECT_EQ(THREAD_EVENT_MESSAGE_LOOP_DESTROYED, captured_events[2]);
239 } 239 }
OLDNEW
« no previous file with comments | « base/threading/thread_perftest.cc ('k') | base/threading/watchdog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698