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

Side by Side Diff: media/cast/test/utility/standalone_cast_environment.h

Issue 436673004: Fix flaky cast_unittests where threads were being joined incorrectly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef MEDIA_CAST_TEST_UTILITY_STANDALONE_CAST_ENVIRONMENT_H_ 5 #ifndef MEDIA_CAST_TEST_UTILITY_STANDALONE_CAST_ENVIRONMENT_H_
6 #define MEDIA_CAST_TEST_UTILITY_STANDALONE_CAST_ENVIRONMENT_H_ 6 #define MEDIA_CAST_TEST_UTILITY_STANDALONE_CAST_ENVIRONMENT_H_
7 7
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "base/threading/thread_checker.h" 9 #include "base/threading/thread_checker.h"
10 #include "media/cast/cast_environment.h" 10 #include "media/cast/cast_environment.h"
11 11
12 namespace media { 12 namespace media {
13 namespace cast { 13 namespace cast {
14 14
15 // A complete CastEnvironment where all task runners are spurned from 15 // A complete CastEnvironment where all task runners are spurned from
16 // internally-owned threads. Uses base::DefaultTickClock as a clock. 16 // internally-owned threads. Uses base::DefaultTickClock as a clock.
17 //
18 // A user of StandaloneCastEnvironment *must* call Shutdown() on the same thread
19 // that constructed the instance before the ref-count reaches zero.
20 // http://crbug.com/396480
17 class StandaloneCastEnvironment : public CastEnvironment, 21 class StandaloneCastEnvironment : public CastEnvironment,
18 public base::ThreadChecker { 22 public base::ThreadChecker {
19 public: 23 public:
20 StandaloneCastEnvironment(); 24 StandaloneCastEnvironment();
21 25
22 // Stops all threads backing the task runners, blocking the caller until 26 // Stops all threads backing the task runners, blocking the caller until
23 // complete. 27 // complete.
24 void Shutdown(); 28 void Shutdown();
25 29
26 protected: 30 protected:
27 virtual ~StandaloneCastEnvironment(); 31 virtual ~StandaloneCastEnvironment();
28 32
29 base::Thread main_thread_; 33 base::Thread main_thread_;
30 base::Thread audio_thread_; 34 base::Thread audio_thread_;
31 base::Thread video_thread_; 35 base::Thread video_thread_;
32 36
33 DISALLOW_COPY_AND_ASSIGN(StandaloneCastEnvironment); 37 DISALLOW_COPY_AND_ASSIGN(StandaloneCastEnvironment);
34 }; 38 };
35 39
36 } // namespace cast 40 } // namespace cast
37 } // namespace media 41 } // namespace media
38 42
39 #endif // MEDIA_CAST_TEST_UTILITY_STANDALONE_CAST_ENVIRONMENT_H_ 43 #endif // MEDIA_CAST_TEST_UTILITY_STANDALONE_CAST_ENVIRONMENT_H_
OLDNEW
« no previous file with comments | « media/cast/receiver/video_decoder_unittest.cc ('k') | media/cast/test/utility/standalone_cast_environment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698