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

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

Issue 10692174: Use reference instead of pointer for media stream device request (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1180/src/
Patch Set: Created 8 years, 5 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 | « chrome/browser/ui/media_stream_infobar_delegate.cc ('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_device_settings.cc
===================================================================
--- content/browser/renderer_host/media/media_stream_device_settings.cc (revision 146197)
+++ content/browser/renderer_host/media/media_stream_device_settings.cc (working copy)
@@ -112,14 +112,14 @@
// Sends the request to the appropriate WebContents.
void DoDeviceRequest(
- const MediaStreamDeviceSettingsRequest* request,
+ const MediaStreamDeviceSettingsRequest& request,
const content::MediaResponseCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Send the permission request to the web contents.
content::RenderViewHostImpl* host =
- content::RenderViewHostImpl::FromID(request->render_process_id,
- request->render_view_id);
+ content::RenderViewHostImpl::FromID(request.render_process_id,
+ request.render_view_id);
// Tab may have gone away.
if (!host || !host->GetDelegate()) {
@@ -127,7 +127,7 @@
return;
}
- host->GetDelegate()->RequestMediaAccessPermission(request, callback);
+ host->GetDelegate()->RequestMediaAccessPermission(&request, callback);
tommi (sloooow) - chröme 2012/07/12 08:38:53 Thanks for the quick fix - qq - should we also cha
}
} // namespace
@@ -166,7 +166,17 @@
SettingsRequests::iterator request_it = requests_.find(label);
if (request_it != requests_.end()) {
+ // Proceed the next pending request for the same page.
MediaStreamDeviceSettingsRequest* request = request_it->second;
+ std::string new_label = FindReadyRequestForView(request->render_view_id,
+ request->render_process_id);
+ if (!new_label.empty()) {
+ PostRequestToUi(new_label);
+ }
+
+ // TODO(xians): Post a cancel request on UI thread to dismiss the infobar
+ // if request has been sent to the UI.
+ // Remove the request from the queue.
requests_.erase(request_it);
delete request;
}
@@ -252,6 +262,10 @@
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
SettingsRequests::iterator req = requests_.find(label);
+ // Return if the request has been removed.
+ if (req == requests_.end())
+ return;
+
DCHECK(req != requests_.end()) << "Invalid request label.";
DCHECK(requester_);
MediaStreamDeviceSettingsRequest* request = req->second;
@@ -356,7 +370,7 @@
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- base::Bind(&DoDeviceRequest, request, callback));
+ base::Bind(&DoDeviceRequest, *request, callback));
}
} // namespace media_stream
« no previous file with comments | « chrome/browser/ui/media_stream_infobar_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698