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

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

Issue 7948004: Removing singelton property of MediaStreamManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "content/browser/renderer_host/media/media_stream_manager.h"
10 #include "content/browser/resource_context.h"
9 #include "content/common/media/video_capture_messages.h" 11 #include "content/common/media/video_capture_messages.h"
10 12
11 VideoCaptureHost::VideoCaptureHost() {} 13 VideoCaptureHost::VideoCaptureHost(
14 const content::ResourceContext* resource_context)
15 : resource_context_(resource_context) {
16 }
12 17
13 VideoCaptureHost::~VideoCaptureHost() {} 18 VideoCaptureHost::~VideoCaptureHost() {}
14 19
15 void VideoCaptureHost::OnChannelClosing() { 20 void VideoCaptureHost::OnChannelClosing() {
16 BrowserMessageFilter::OnChannelClosing(); 21 BrowserMessageFilter::OnChannelClosing();
17 22
18 // Since the IPC channel is gone, close all requested VideCaptureDevices. 23 // Since the IPC channel is gone, close all requested VideCaptureDevices.
19 for (EntryMap::iterator it = entries_.begin(); it != entries_.end(); it++) { 24 for (EntryMap::iterator it = entries_.begin(); it != entries_.end(); it++) {
20 VideoCaptureController* controller = it->second; 25 VideoCaptureController* controller = it->second;
21 // Since the channel is closing we need a task to make sure VideoCaptureHost 26 // Since the channel is closing we need a task to make sure VideoCaptureHost
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 145
141 void VideoCaptureHost::OnStartCapture(int device_id, 146 void VideoCaptureHost::OnStartCapture(int device_id,
142 const media::VideoCaptureParams& params) { 147 const media::VideoCaptureParams& params) {
143 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
144 149
145 VideoCaptureControllerID controller_id(device_id); 150 VideoCaptureControllerID controller_id(device_id);
146 151
147 DCHECK(entries_.find(controller_id) == entries_.end()); 152 DCHECK(entries_.find(controller_id) == entries_.end());
148 153
149 scoped_refptr<VideoCaptureController> controller = 154 scoped_refptr<VideoCaptureController> controller =
150 new VideoCaptureController(controller_id, peer_handle(), this); 155 new VideoCaptureController(
156 controller_id, peer_handle(), this,
157 resource_context_->media_stream_manager()->video_capture_manager());
151 entries_.insert(std::make_pair(controller_id, controller)); 158 entries_.insert(std::make_pair(controller_id, controller));
152 controller->StartCapture(params); 159 controller->StartCapture(params);
153 } 160 }
154 161
155 void VideoCaptureHost::OnStopCapture(int device_id) { 162 void VideoCaptureHost::OnStopCapture(int device_id) {
156 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 163 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
157 164
158 VideoCaptureControllerID controller_id(device_id); 165 VideoCaptureControllerID controller_id(device_id);
159 EntryMap::iterator it = entries_.find(controller_id); 166 EntryMap::iterator it = entries_.find(controller_id);
160 if (it != entries_.end()) { 167 if (it != entries_.end()) {
(...skipping 26 matching lines...) Expand all
187 194
188 void VideoCaptureHost::DoDeleteVideoCaptureController( 195 void VideoCaptureHost::DoDeleteVideoCaptureController(
189 const VideoCaptureControllerID& id) { 196 const VideoCaptureControllerID& id) {
190 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 197 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
191 198
192 // Report that the device have successfully been stopped. 199 // Report that the device have successfully been stopped.
193 Send(new VideoCaptureMsg_StateChanged(id.device_id, 200 Send(new VideoCaptureMsg_StateChanged(id.device_id,
194 media::VideoCapture::kStopped)); 201 media::VideoCapture::kStopped));
195 entries_.erase(id); 202 entries_.erase(id);
196 } 203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698