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

Unified Diff: content/browser/renderer_host/media/media_stream_manager.cc

Issue 345713005: Make sure MediaStreamManager handles requests in order. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comment. Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/media/media_stream_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/media_stream_manager.cc
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc
index 9a2779ba604c63ddf4024415f13cd94b90d56fc4..2b337cafa7849329481813673e58f75d98338f05 100644
--- a/content/browser/renderer_host/media/media_stream_manager.cc
+++ b/content/browser/renderer_host/media/media_stream_manager.cc
@@ -1100,24 +1100,34 @@ std::string MediaStreamManager::AddRequest(DeviceRequest* request) {
std::string unique_label;
do {
unique_label = RandomLabel();
- } while (requests_.find(unique_label) != requests_.end());
+ } while (FindRequest(unique_label) != NULL);
- requests_.insert(std::make_pair(unique_label, request));
+ requests_.push_back(std::make_pair(unique_label, request));
return unique_label;
}
MediaStreamManager::DeviceRequest*
MediaStreamManager::FindRequest(const std::string& label) const {
- DeviceRequests::const_iterator request_it = requests_.find(label);
- return request_it == requests_.end() ? NULL : request_it->second;
+ for (DeviceRequests::const_iterator request_it = requests_.begin();
+ request_it != requests_.end(); ++request_it) {
+ if (request_it->first == label)
+ return request_it->second;
+ }
+ return NULL;
}
void MediaStreamManager::DeleteRequest(const std::string& label) {
DVLOG(1) << "DeleteRequest({label= " << label << "})";
- DeviceRequests::iterator it = requests_.find(label);
- scoped_ptr<DeviceRequest> request(it->second);
- requests_.erase(it);
+ for (DeviceRequests::iterator request_it = requests_.begin();
+ request_it != requests_.end(); ++request_it) {
+ if (request_it->first == label) {
+ scoped_ptr<DeviceRequest> request(request_it->second);
+ requests_.erase(request_it);
+ return;
+ }
+ }
+ NOTREACHED();
}
void MediaStreamManager::PostRequestToUI(const std::string& label,
@@ -1648,7 +1658,7 @@ void MediaStreamManager::DevicesEnumerated(
// to be invalid so that the next media request will trigger the
// enumeration again. See issue/317673.
cache->valid = !devices.empty();
- }
+ }
if (need_update_clients && monitoring_started_)
NotifyDevicesChanged(stream_type, devices);
« no previous file with comments | « content/browser/renderer_host/media/media_stream_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698