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

Side by Side Diff: content/browser/renderer_host/media/audio_output_device_enumerator.h

Issue 1505353007: Disable enumeration caching for output devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « no previous file | content/browser/renderer_host/media/audio_output_device_enumerator.cc » ('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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 // AudioOutputDeviceEnumerator is used to enumerate audio output devices. 5 // AudioOutputDeviceEnumerator is used to enumerate audio output devices.
6 // It can return cached results of previous enumerations in order to boost 6 // It can return cached results of previous enumerations in order to boost
7 // performance. 7 // performance.
8 // All its public methods must be called on the thread where the object is 8 // All its public methods must be called on the thread where the object is
9 // created. 9 // created.
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // provides default parameters, even if there are no devices. 65 // provides default parameters, even if there are no devices.
66 // See https://crbug.com/549125. 66 // See https://crbug.com/549125.
67 void Enumerate(const AudioOutputDeviceEnumerationCB& callback); 67 void Enumerate(const AudioOutputDeviceEnumerationCB& callback);
68 68
69 // Invalidates the current cache. 69 // Invalidates the current cache.
70 void InvalidateCache(); 70 void InvalidateCache();
71 71
72 // Sets the cache policy. 72 // Sets the cache policy.
73 void SetCachePolicy(CachePolicy cache_policy); 73 void SetCachePolicy(CachePolicy cache_policy);
74 74
75 // Returns true if the caching policy is different from
76 // CACHE_POLICY_NO_CACHING, false otherwise.
77 bool IsCacheEnabled();
78
75 private: 79 private:
76 void InitializeOnIOThread(); 80 void InitializeOnIOThread();
77 void DoEnumerateDevices(); 81 void DoEnumerateDevices();
78 AudioOutputDeviceEnumeration DoEnumerateDevicesOnDeviceThread(); 82 AudioOutputDeviceEnumeration DoEnumerateDevicesOnDeviceThread();
79 void DevicesEnumerated(const AudioOutputDeviceEnumeration& snapshot); 83 void DevicesEnumerated(const AudioOutputDeviceEnumeration& snapshot);
80 int64_t NewEventSequence(); 84 int64_t NewEventSequence();
81 bool IsLastEnumerationValid() const; 85 bool IsLastEnumerationValid() const;
82 86
83 media::AudioManager* const audio_manager_; 87 media::AudioManager* const audio_manager_;
84 CachePolicy cache_policy_; 88 CachePolicy cache_policy_;
85 AudioOutputDeviceEnumeration cache_; 89 AudioOutputDeviceEnumeration cache_;
86 std::list<AudioOutputDeviceEnumerationCB> pending_callbacks_; 90 std::list<AudioOutputDeviceEnumerationCB> pending_callbacks_;
87 91
88 // sequential number that serves as logical clock 92 // sequential number that serves as logical clock
89 int64_t current_event_sequence_; 93 int64_t current_event_sequence_;
90 94
91 int64_t seq_last_enumeration_; 95 int64_t seq_last_enumeration_;
92 int64_t seq_last_invalidation_; 96 int64_t seq_last_invalidation_;
93 bool is_enumeration_ongoing_; 97 bool is_enumeration_ongoing_;
94 98
95 base::ThreadChecker thread_checker_; 99 base::ThreadChecker thread_checker_;
96 base::WeakPtrFactory<AudioOutputDeviceEnumerator> weak_factory_; 100 base::WeakPtrFactory<AudioOutputDeviceEnumerator> weak_factory_;
97 101
98 DISALLOW_COPY_AND_ASSIGN(AudioOutputDeviceEnumerator); 102 DISALLOW_COPY_AND_ASSIGN(AudioOutputDeviceEnumerator);
99 }; 103 };
100 104
101 } // namespace content 105 } // namespace content
102 106
103 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_DEVICE_ENUMERATOR_H_ 107 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_DEVICE_ENUMERATOR_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/audio_output_device_enumerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698