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

Side by Side Diff: media/audio/audio_streams_tracker.h

Issue 2655413004: Strip out stream counting from AudioRendererHost. (Closed)
Patch Set: Add moar DCHECKs. Created 3 years, 10 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 | « media/audio/BUILD.gn ('k') | media/audio/audio_streams_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_AUDIO_AUDIO_STREAMS_TRACKER_H_
6 #define MEDIA_AUDIO_AUDIO_STREAMS_TRACKER_H_
7
8 #include <stddef.h>
9
10 #include "base/gtest_prod_util.h"
11 #include "base/macros.h"
12 #include "base/threading/thread_checker.h"
13 #include "media/base/media_export.h"
14
15 namespace media {
16
17 // Tracks the maximum number of simultaneous streams that was ever registered.
18 // All functions must be called on the same thread.
19 class MEDIA_EXPORT AudioStreamsTracker {
20 public:
21 AudioStreamsTracker();
22 ~AudioStreamsTracker();
23
24 // Increases/decreases current stream count. Updates max stream count if
25 // current count is larger.
26 void IncreaseStreamCount();
27 void DecreaseStreamCount(size_t count = 1);
28
29 // Resets the max stream count, i.e. sets it to the current stream count.
30 void ResetMaxStreamCount();
31
32 size_t max_stream_count() const;
33
34 private:
35 FRIEND_TEST_ALL_PREFIXES(AudioStreamsTrackerTest, IncreaseAndDecreaseOnce);
36 FRIEND_TEST_ALL_PREFIXES(AudioStreamsTrackerTest,
37 IncreaseAndDecreaseMultiple);
38
39 // Confirms single-threaded access.
40 base::ThreadChecker thread_checker_;
41
42 // Stores the current and maximum number of streams.
43 size_t current_stream_count_;
44 size_t max_stream_count_;
45
46 DISALLOW_COPY_AND_ASSIGN(AudioStreamsTracker);
47 };
48
49 } // namespace media
50
51 #endif // MEDIA_AUDIO_AUDIO_STREAMS_TRACKER_H_
OLDNEW
« no previous file with comments | « media/audio/BUILD.gn ('k') | media/audio/audio_streams_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698