| OLD | NEW |
| 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 #ifndef CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 6 #define CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 18 #include "media/audio/audio_logging.h" | 18 #include "media/audio/audio_logging.h" |
| 19 #include "media/base/media_log.h" |
| 19 #include "media/video/capture/video_capture_device_info.h" | 20 #include "media/video/capture/video_capture_device_info.h" |
| 20 | 21 |
| 21 namespace media { | 22 namespace media { |
| 22 class AudioParameters; | 23 class AudioParameters; |
| 23 struct MediaLogEvent; | 24 struct MediaLogEvent; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace content { | 27 namespace content { |
| 27 | 28 |
| 28 // This class stores information about currently active media. | 29 // This class stores information about currently active media. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 52 void SendVideoCaptureDeviceCapabilities(); | 53 void SendVideoCaptureDeviceCapabilities(); |
| 53 | 54 |
| 54 // Called to inform of the capabilities enumerated for video devices. | 55 // Called to inform of the capabilities enumerated for video devices. |
| 55 void UpdateVideoCaptureDeviceCapabilities( | 56 void UpdateVideoCaptureDeviceCapabilities( |
| 56 const media::VideoCaptureDeviceInfos& video_capture_device_infos); | 57 const media::VideoCaptureDeviceInfos& video_capture_device_infos); |
| 57 | 58 |
| 58 // AudioLogFactory implementation. Safe to call from any thread. | 59 // AudioLogFactory implementation. Safe to call from any thread. |
| 59 scoped_ptr<media::AudioLog> CreateAudioLog(AudioComponent component) override; | 60 scoped_ptr<media::AudioLog> CreateAudioLog(AudioComponent component) override; |
| 60 | 61 |
| 61 private: | 62 private: |
| 63 // Inner class to handle reporting pipelinestatus to UMA |
| 64 class MediaInternalsUMAHandler; |
| 65 |
| 62 friend class AudioLogImpl; | 66 friend class AudioLogImpl; |
| 63 friend class MediaInternalsTest; | 67 friend class MediaInternalsTest; |
| 64 friend struct base::DefaultLazyInstanceTraits<MediaInternals>; | 68 friend struct base::DefaultLazyInstanceTraits<MediaInternals>; |
| 65 | 69 |
| 66 MediaInternals(); | 70 MediaInternals(); |
| 67 | 71 |
| 68 // Sends |update| to each registered UpdateCallback. Safe to call from any | 72 // Sends |update| to each registered UpdateCallback. Safe to call from any |
| 69 // thread, but will forward to the IO thread. | 73 // thread, but will forward to the IO thread. |
| 70 void SendUpdate(const base::string16& update); | 74 void SendUpdate(const base::string16& update); |
| 71 | 75 |
| 72 // Caches |value| under |cache_key| so that future SendAudioStreamData() calls | 76 // Caches |value| under |cache_key| so that future SendAudioStreamData() calls |
| 73 // will include the current data. Calls JavaScript |function|(|value|) for | 77 // will include the current data. Calls JavaScript |function|(|value|) for |
| 74 // each registered UpdateCallback. SendUpdateAndPurgeCache() is similar but | 78 // each registered UpdateCallback. SendUpdateAndPurgeCache() is similar but |
| 75 // purges the cache entry after completion instead. | 79 // purges the cache entry after completion instead. |
| 76 void SendUpdateAndCacheAudioStreamKey(const std::string& cache_key, | 80 void SendUpdateAndCacheAudioStreamKey(const std::string& cache_key, |
| 77 const std::string& function, | 81 const std::string& function, |
| 78 const base::DictionaryValue* value); | 82 const base::DictionaryValue* value); |
| 79 void SendUpdateAndPurgeAudioStreamCache(const std::string& cache_key, | 83 void SendUpdateAndPurgeAudioStreamCache(const std::string& cache_key, |
| 80 const std::string& function, | 84 const std::string& function, |
| 81 const base::DictionaryValue* value); | 85 const base::DictionaryValue* value); |
| 82 | 86 |
| 83 // Must only be accessed on the IO thread. | 87 // Must only be accessed on the IO thread. |
| 84 std::vector<UpdateCallback> update_callbacks_; | 88 std::vector<UpdateCallback> update_callbacks_; |
| 85 base::ListValue video_capture_capabilities_cached_data_; | 89 base::ListValue video_capture_capabilities_cached_data_; |
| 86 | 90 |
| 87 // All variables below must be accessed under |lock_|. | 91 // All variables below must be accessed under |lock_|. |
| 88 base::Lock lock_; | 92 base::Lock lock_; |
| 89 base::DictionaryValue audio_streams_cached_data_; | 93 base::DictionaryValue audio_streams_cached_data_; |
| 90 int owner_ids_[AUDIO_COMPONENT_MAX]; | 94 int owner_ids_[AUDIO_COMPONENT_MAX]; |
| 95 scoped_ptr<MediaInternalsUMAHandler> uma_handler_; |
| 91 | 96 |
| 92 DISALLOW_COPY_AND_ASSIGN(MediaInternals); | 97 DISALLOW_COPY_AND_ASSIGN(MediaInternals); |
| 93 }; | 98 }; |
| 94 | 99 |
| 95 } // namespace content | 100 } // namespace content |
| 96 | 101 |
| 97 #endif // CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 102 #endif // CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
| OLD | NEW |