| OLD | NEW |
| 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/video_capture_host.h" | 5 #include "content/browser/renderer_host/media/video_capture_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/browser/browser_main_loop.h" | 9 #include "content/browser/browser_main_loop.h" |
| 10 #include "content/browser/renderer_host/media/media_stream_manager.h" | 10 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 11 #include "content/browser/renderer_host/media/video_capture_manager.h" | 11 #include "content/browser/renderer_host/media/video_capture_manager.h" |
| 12 #include "content/common/media/video_capture_messages.h" | 12 #include "content/common/media/video_capture_messages.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 VideoCaptureHost::VideoCaptureHost(MediaStreamManager* media_stream_manager) | 16 VideoCaptureHost::VideoCaptureHost(MediaStreamManager* media_stream_manager) |
| 17 : media_stream_manager_(media_stream_manager) { | 17 : media_stream_manager_(media_stream_manager) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 VideoCaptureHost::~VideoCaptureHost() {} | 20 VideoCaptureHost::~VideoCaptureHost() {} |
| 21 | 21 |
| 22 void VideoCaptureHost::OnChannelClosing() { | 22 void VideoCaptureHost::OnChannelClosing() { |
| 23 BrowserMessageFilter::OnChannelClosing(); | |
| 24 | |
| 25 // Since the IPC channel is gone, close all requested VideoCaptureDevices. | 23 // Since the IPC channel is gone, close all requested VideoCaptureDevices. |
| 26 for (EntryMap::iterator it = entries_.begin(); it != entries_.end(); it++) { | 24 for (EntryMap::iterator it = entries_.begin(); it != entries_.end(); it++) { |
| 27 const base::WeakPtr<VideoCaptureController>& controller = it->second; | 25 const base::WeakPtr<VideoCaptureController>& controller = it->second; |
| 28 if (controller) { | 26 if (controller) { |
| 29 VideoCaptureControllerID controller_id(it->first); | 27 VideoCaptureControllerID controller_id(it->first); |
| 30 media_stream_manager_->video_capture_manager()->StopCaptureForClient( | 28 media_stream_manager_->video_capture_manager()->StopCaptureForClient( |
| 31 controller.get(), controller_id, this); | 29 controller.get(), controller_id, this); |
| 32 } | 30 } |
| 33 } | 31 } |
| 34 } | 32 } |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 return; | 288 return; |
| 291 | 289 |
| 292 if (it->second) { | 290 if (it->second) { |
| 293 media_stream_manager_->video_capture_manager()->StopCaptureForClient( | 291 media_stream_manager_->video_capture_manager()->StopCaptureForClient( |
| 294 it->second.get(), controller_id, this); | 292 it->second.get(), controller_id, this); |
| 295 } | 293 } |
| 296 entries_.erase(it); | 294 entries_.erase(it); |
| 297 } | 295 } |
| 298 | 296 |
| 299 } // namespace content | 297 } // namespace content |
| OLD | NEW |