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 |
70 scoped_ptr<MediaInternalsUMAHandler> uma_handler; | |
DaleCurtis
2014/11/11 19:24:01
Needs underscore_ should be at the end of the clas
prabhur1
2014/11/12 21:32:37
Done.
| |
71 | |
66 MediaInternals(); | 72 MediaInternals(); |
67 | 73 |
68 // Sends |update| to each registered UpdateCallback. Safe to call from any | 74 // Sends |update| to each registered UpdateCallback. Safe to call from any |
69 // thread, but will forward to the IO thread. | 75 // thread, but will forward to the IO thread. |
70 void SendUpdate(const base::string16& update); | 76 void SendUpdate(const base::string16& update); |
71 | 77 |
72 // Caches |value| under |cache_key| so that future SendAudioStreamData() calls | 78 // Caches |value| under |cache_key| so that future SendAudioStreamData() calls |
73 // will include the current data. Calls JavaScript |function|(|value|) for | 79 // will include the current data. Calls JavaScript |function|(|value|) for |
74 // each registered UpdateCallback. SendUpdateAndPurgeCache() is similar but | 80 // each registered UpdateCallback. SendUpdateAndPurgeCache() is similar but |
75 // purges the cache entry after completion instead. | 81 // purges the cache entry after completion instead. |
76 void SendUpdateAndCacheAudioStreamKey(const std::string& cache_key, | 82 void SendUpdateAndCacheAudioStreamKey(const std::string& cache_key, |
77 const std::string& function, | 83 const std::string& function, |
78 const base::DictionaryValue* value); | 84 const base::DictionaryValue* value); |
79 void SendUpdateAndPurgeAudioStreamCache(const std::string& cache_key, | 85 void SendUpdateAndPurgeAudioStreamCache(const std::string& cache_key, |
80 const std::string& function, | 86 const std::string& function, |
81 const base::DictionaryValue* value); | 87 const base::DictionaryValue* value); |
82 | 88 |
83 // Must only be accessed on the IO thread. | 89 // Must only be accessed on the IO thread. |
84 std::vector<UpdateCallback> update_callbacks_; | 90 std::vector<UpdateCallback> update_callbacks_; |
85 base::ListValue video_capture_capabilities_cached_data_; | 91 base::ListValue video_capture_capabilities_cached_data_; |
86 | 92 |
87 // All variables below must be accessed under |lock_|. | 93 // All variables below must be accessed under |lock_|. |
88 base::Lock lock_; | 94 base::Lock lock_; |
89 base::DictionaryValue audio_streams_cached_data_; | 95 base::DictionaryValue audio_streams_cached_data_; |
90 int owner_ids_[AUDIO_COMPONENT_MAX]; | 96 int owner_ids_[AUDIO_COMPONENT_MAX]; |
91 | 97 |
92 DISALLOW_COPY_AND_ASSIGN(MediaInternals); | 98 DISALLOW_COPY_AND_ASSIGN(MediaInternals); |
93 }; | 99 }; |
94 | 100 |
95 } // namespace content | 101 } // namespace content |
96 | 102 |
97 #endif // CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 103 #endif // CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
OLD | NEW |