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

Side by Side Diff: content/browser/renderer_host/media/media_stream_dispatcher_host.cc

Issue 63673006: Fix cancelling of device enumeration requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" 5 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h"
6 6
7 #include "content/browser/browser_main_loop.h" 7 #include "content/browser/browser_main_loop.h"
8 #include "content/browser/renderer_host/media/web_contents_capture_util.h" 8 #include "content/browser/renderer_host/media/web_contents_capture_util.h"
9 #include "content/common/media/media_stream_messages.h" 9 #include "content/common/media/media_stream_messages.h"
10 #include "content/common/media/media_stream_options.h" 10 #include "content/common/media/media_stream_options.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 const IPC::Message& message, bool* message_was_ok) { 88 const IPC::Message& message, bool* message_was_ok) {
89 bool handled = true; 89 bool handled = true;
90 IPC_BEGIN_MESSAGE_MAP_EX(MediaStreamDispatcherHost, message, *message_was_ok) 90 IPC_BEGIN_MESSAGE_MAP_EX(MediaStreamDispatcherHost, message, *message_was_ok)
91 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_GenerateStream, OnGenerateStream) 91 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_GenerateStream, OnGenerateStream)
92 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_CancelGenerateStream, 92 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_CancelGenerateStream,
93 OnCancelGenerateStream) 93 OnCancelGenerateStream)
94 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_StopStreamDevice, 94 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_StopStreamDevice,
95 OnStopStreamDevice) 95 OnStopStreamDevice)
96 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_EnumerateDevices, 96 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_EnumerateDevices,
97 OnEnumerateDevices) 97 OnEnumerateDevices)
98 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_CancelEnumerateDevices,
99 OnCancelEnumerateDevices)
98 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_OpenDevice, 100 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_OpenDevice,
99 OnOpenDevice) 101 OnOpenDevice)
100 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_CloseDevice, 102 IPC_MESSAGE_HANDLER(MediaStreamHostMsg_CloseDevice,
101 OnCloseDevice) 103 OnCloseDevice)
102 IPC_MESSAGE_UNHANDLED(handled = false) 104 IPC_MESSAGE_UNHANDLED(handled = false)
103 IPC_END_MESSAGE_MAP_EX() 105 IPC_END_MESSAGE_MAP_EX()
104 return handled; 106 return handled;
105 } 107 }
106 108
107 void MediaStreamDispatcherHost::OnChannelClosing() { 109 void MediaStreamDispatcherHost::OnChannelClosing() {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 StoreRequest(render_view_id, page_request_id, label); 187 StoreRequest(render_view_id, page_request_id, label);
186 } 188 }
187 189
188 void MediaStreamDispatcherHost::OnCancelEnumerateDevices( 190 void MediaStreamDispatcherHost::OnCancelEnumerateDevices(
189 int render_view_id, 191 int render_view_id,
190 const std::string& label) { 192 const std::string& label) {
191 DVLOG(1) << "MediaStreamDispatcherHost::OnCancelEnumerateDevices(" 193 DVLOG(1) << "MediaStreamDispatcherHost::OnCancelEnumerateDevices("
192 << render_view_id << ", " 194 << render_view_id << ", "
193 << label << ")"; 195 << label << ")";
194 196
197 if (streams_.find(label) == streams_.end()) {
198 // According to the comments in MediaStreamDispatcher::OnDevicesEnumerated,
199 // OnCancelEnumerateDevices can be called several times with the same label.
tommi (sloooow) - chröme 2013/11/18 10:01:50 is this worth a DVLOG(1)?
200 return;
201 }
195 media_stream_manager_->CancelRequest(label); 202 media_stream_manager_->CancelRequest(label);
196 PopRequest(label); 203 PopRequest(label);
197 } 204 }
198 205
199 void MediaStreamDispatcherHost::OnOpenDevice( 206 void MediaStreamDispatcherHost::OnOpenDevice(
200 int render_view_id, 207 int render_view_id,
201 int page_request_id, 208 int page_request_id,
202 const std::string& device_id, 209 const std::string& device_id,
203 MediaStreamType type, 210 MediaStreamType type,
204 const GURL& security_origin) { 211 const GURL& security_origin) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 MediaStreamDispatcherHost::StreamRequest 244 MediaStreamDispatcherHost::StreamRequest
238 MediaStreamDispatcherHost::PopRequest(const std::string& label) { 245 MediaStreamDispatcherHost::PopRequest(const std::string& label) {
239 StreamMap::iterator it = streams_.find(label); 246 StreamMap::iterator it = streams_.find(label);
240 CHECK(it != streams_.end()); 247 CHECK(it != streams_.end());
241 StreamRequest request = it->second; 248 StreamRequest request = it->second;
242 streams_.erase(it); 249 streams_.erase(it);
243 return request; 250 return request;
244 } 251 }
245 252
246 } // namespace content 253 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698