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

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

Issue 9320070: Re-added OnChannelClosing in MediaStreamDispatcherHost to close open media devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Indentation after rebase. Created 8 years, 10 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 | Annotate | Revision Log
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/public/browser/resource_context.h" 7 #include "content/public/browser/resource_context.h"
8 #include "content/common/media/media_stream_messages.h" 8 #include "content/common/media/media_stream_messages.h"
9 #include "content/common/media/media_stream_options.h" 9 #include "content/common/media/media_stream_options.h"
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 OnOpenDevice) 50 OnOpenDevice)
51 IPC_MESSAGE_UNHANDLED(handled = false) 51 IPC_MESSAGE_UNHANDLED(handled = false)
52 IPC_END_MESSAGE_MAP_EX() 52 IPC_END_MESSAGE_MAP_EX()
53 return handled; 53 return handled;
54 } 54 }
55 55
56 void MediaStreamDispatcherHost::OnChannelClosing() { 56 void MediaStreamDispatcherHost::OnChannelClosing() {
57 BrowserMessageFilter::OnChannelClosing(); 57 BrowserMessageFilter::OnChannelClosing();
58 DVLOG(1) << "MediaStreamDispatcherHost::OnChannelClosing"; 58 DVLOG(1) << "MediaStreamDispatcherHost::OnChannelClosing";
59 59
60 // TODO(mflodman) Remove this temporary solution when shut-down issue is 60 // Since the IPC channel is gone, cancel pending requests and close all
61 // resolved, i.e. uncomment the code below. 61 // requested VideCaptureDevices.
62 // Since the IPC channel is gone, close all requested VideCaptureDevices and 62 manager()->CancelRequests(this);
63 // cancel pending requests. 63 for (StreamMap::iterator it = streams_.begin();
64 // manager()->CancelRequests(this); 64 it != streams_.end();
65 // for (StreamMap::iterator it = streams_.begin(); 65 it++) {
66 // it != streams_.end(); 66 std::string label = it->first;
tommi (sloooow) - chröme 2012/02/23 10:03:22 no need to create an extra string copy. should jus
67 // it++) { 67 manager()->StopGeneratedStream(label);
68 // std::string label = it->first; 68 }
69 // manager()->StopGeneratedStream(label);
70 // }
71 } 69 }
72 70
73 void MediaStreamDispatcherHost::OnGenerateStream( 71 void MediaStreamDispatcherHost::OnGenerateStream(
74 int render_view_id, 72 int render_view_id,
75 int page_request_id, 73 int page_request_id,
76 const media_stream::StreamOptions& components, 74 const media_stream::StreamOptions& components,
77 const std::string& security_origin) { 75 const std::string& security_origin) {
78 DVLOG(1) << "MediaStreamDispatcherHost::OnGenerateStream(" 76 DVLOG(1) << "MediaStreamDispatcherHost::OnGenerateStream("
79 << render_view_id << ", " 77 << render_view_id << ", "
80 << page_request_id << ", [ " 78 << page_request_id << ", [ "
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 StreamMap::iterator it = streams_.find(label); 257 StreamMap::iterator it = streams_.find(label);
260 DCHECK(it != streams_.end()); 258 DCHECK(it != streams_.end());
261 StreamRequest request = it->second; 259 StreamRequest request = it->second;
262 streams_.erase(it); 260 streams_.erase(it);
263 261
264 Send(new MediaStreamMsg_DeviceOpenFailed(request.render_view_id, 262 Send(new MediaStreamMsg_DeviceOpenFailed(request.render_view_id,
265 request.page_request_id)); 263 request.page_request_id));
266 } 264 }
267 265
268 } // namespace media_stream 266 } // namespace media_stream
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698