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

Unified Diff: chrome/browser/search/hotword_service_factory.h

Issue 654613004: [Hotword] Delay checking for audio devices until needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: redoing logic 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search/hotword_service_factory.h
diff --git a/chrome/browser/search/hotword_service_factory.h b/chrome/browser/search/hotword_service_factory.h
index c07b6510819f0ea80dac27a8e23a048a786611a3..cc26b48180afd8dcde6afe137354267934a64f9f 100644
--- a/chrome/browser/search/hotword_service_factory.h
+++ b/chrome/browser/search/hotword_service_factory.h
@@ -35,6 +35,11 @@ class HotwordServiceFactory : public MediaCaptureDevicesDispatcher::Observer,
// is browser (not profile) specific, it resides in the factory.
static bool IsMicrophoneAvailable();
+ // Returns whether the state of the audio devices has been updated.
+ // Essentially it indicates the validity of the return value from
+ // IsMicrophoneAvailable().
+ static bool IsAudioDeviceStateUpdated();
+
// Overridden from MediaCaptureDevicesDispatcher::Observer
virtual void OnUpdateAudioDevices(
const content::MediaStreamDevices& devices) override;
@@ -67,6 +72,13 @@ class HotwordServiceFactory : public MediaCaptureDevicesDispatcher::Observer,
bool microphone_available_;
+ // Indicates if the check for audio devices has been run such that it can be
+ // included in the error checking. Audio checking is not done immediately
+ // upon start up because of the negative impact on performance.
+ bool audio_device_state_updated_;
+
+ bool audio_device_state_updated() { return audio_device_state_updated_; }
+
DISALLOW_COPY_AND_ASSIGN(HotwordServiceFactory);
};

Powered by Google App Engine
This is Rietveld 408576698