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

Side by Side Diff: content/browser/media/media_internals.h

Issue 1169983003: media-internals: Store updates when cannot update. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
OLDNEW
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
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 // Add/remove update callbacks (see above). Must be called on the UI thread. 44 // Add/remove update callbacks (see above). Must be called on the UI thread.
45 // The callbacks must also be fired on UI thread. 45 // The callbacks must also be fired on UI thread.
46 void AddUpdateCallback(const UpdateCallback& callback); 46 void AddUpdateCallback(const UpdateCallback& callback);
47 void RemoveUpdateCallback(const UpdateCallback& callback); 47 void RemoveUpdateCallback(const UpdateCallback& callback);
48 48
49 // Whether there are any update callbacks available. Can be called on any 49 // Whether there are any update callbacks available. Can be called on any
50 // thread. 50 // thread.
51 bool CanUpdate(); 51 bool CanUpdate();
52 52
53 // Replay all saved media events.
54 void SendHistoricalMediaEvents();
55
53 // Sends all audio cached data to each registered UpdateCallback. 56 // Sends all audio cached data to each registered UpdateCallback.
54 void SendAudioStreamData(); 57 void SendAudioStreamData();
55 58
56 // Sends all video capture capabilities cached data to each registered 59 // Sends all video capture capabilities cached data to each registered
57 // UpdateCallback. 60 // UpdateCallback.
58 void SendVideoCaptureDeviceCapabilities(); 61 void SendVideoCaptureDeviceCapabilities();
59 62
60 // Called to inform of the capabilities enumerated for video devices. 63 // Called to inform of the capabilities enumerated for video devices.
61 void UpdateVideoCaptureDeviceCapabilities( 64 void UpdateVideoCaptureDeviceCapabilities(
62 const media::VideoCaptureDeviceInfos& video_capture_device_infos); 65 const media::VideoCaptureDeviceInfos& video_capture_device_infos);
(...skipping 16 matching lines...) Expand all
79 friend class AudioLogImpl; 82 friend class AudioLogImpl;
80 friend class MediaInternalsTest; 83 friend class MediaInternalsTest;
81 friend struct base::DefaultLazyInstanceTraits<MediaInternals>; 84 friend struct base::DefaultLazyInstanceTraits<MediaInternals>;
82 85
83 MediaInternals(); 86 MediaInternals();
84 87
85 // Sends |update| to each registered UpdateCallback. Safe to call from any 88 // Sends |update| to each registered UpdateCallback. Safe to call from any
86 // thread, but will forward to the IO thread. 89 // thread, but will forward to the IO thread.
87 void SendUpdate(const base::string16& update); 90 void SendUpdate(const base::string16& update);
88 91
92 // Saves |update| so that they can be sent when there are UpdateCallback
93 // registered.
94 void SaveUpdate(const base::string16& update);
95
89 // Caches |value| under |cache_key| so that future SendAudioLogUpdate() calls 96 // Caches |value| under |cache_key| so that future SendAudioLogUpdate() calls
90 // will include the current data. Calls JavaScript |function|(|value|) for 97 // will include the current data. Calls JavaScript |function|(|value|) for
91 // each registered UpdateCallback. 98 // each registered UpdateCallback.
92 enum AudioLogUpdateType { 99 enum AudioLogUpdateType {
93 CREATE, // Creates a new AudioLog cache entry. 100 CREATE, // Creates a new AudioLog cache entry.
94 UPDATE_IF_EXISTS, // Updates an existing AudioLog cache entry, does 101 UPDATE_IF_EXISTS, // Updates an existing AudioLog cache entry, does
95 // nothing if it doesn't exist. 102 // nothing if it doesn't exist.
96 UPDATE_AND_DELETE, // Deletes an existing AudioLog cache entry. 103 UPDATE_AND_DELETE, // Deletes an existing AudioLog cache entry.
97 }; 104 };
98 void SendAudioLogUpdate(AudioLogUpdateType type, 105 void SendAudioLogUpdate(AudioLogUpdateType type,
99 const std::string& cache_key, 106 const std::string& cache_key,
100 const std::string& function, 107 const std::string& function,
101 const base::DictionaryValue* value); 108 const base::DictionaryValue* value);
102 109
103 // Must only be accessed on the UI thread. 110 // Must only be accessed on the UI thread.
104 std::vector<UpdateCallback> update_callbacks_; 111 std::vector<UpdateCallback> update_callbacks_;
105 112
106 // Must only be accessed on the IO thread. 113 // Must only be accessed on the IO thread.
107 base::ListValue video_capture_capabilities_cached_data_; 114 base::ListValue video_capture_capabilities_cached_data_;
108 115
109 // All variables below must be accessed under |lock_|. 116 // All variables below must be accessed under |lock_|.
110 base::Lock lock_; 117 base::Lock lock_;
111 bool can_update_; 118 bool can_update_;
119 std::list<base::string16> pending_updates_;
112 base::DictionaryValue audio_streams_cached_data_; 120 base::DictionaryValue audio_streams_cached_data_;
113 int owner_ids_[AUDIO_COMPONENT_MAX]; 121 int owner_ids_[AUDIO_COMPONENT_MAX];
114 scoped_ptr<MediaInternalsUMAHandler> uma_handler_; 122 scoped_ptr<MediaInternalsUMAHandler> uma_handler_;
115 123
116 DISALLOW_COPY_AND_ASSIGN(MediaInternals); 124 DISALLOW_COPY_AND_ASSIGN(MediaInternals);
117 }; 125 };
118 126
119 } // namespace content 127 } // namespace content
120 128
121 #endif // CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_ 129 #endif // CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/media_internals.cc » ('j') | content/browser/media/media_internals.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698