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

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

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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/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 "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/browser_main_loop.h" 10 #include "content/browser/browser_main_loop.h"
(...skipping 14 matching lines...) Expand all
25 25
26 VideoCaptureHost::VideoCaptureHost() {} 26 VideoCaptureHost::VideoCaptureHost() {}
27 27
28 VideoCaptureHost::~VideoCaptureHost() {} 28 VideoCaptureHost::~VideoCaptureHost() {}
29 29
30 void VideoCaptureHost::OnChannelClosing() { 30 void VideoCaptureHost::OnChannelClosing() {
31 BrowserMessageFilter::OnChannelClosing(); 31 BrowserMessageFilter::OnChannelClosing();
32 32
33 // Since the IPC channel is gone, close all requested VideCaptureDevices. 33 // Since the IPC channel is gone, close all requested VideCaptureDevices.
34 for (EntryMap::iterator it = entries_.begin(); it != entries_.end(); it++) { 34 for (EntryMap::iterator it = entries_.begin(); it != entries_.end(); it++) {
35 VideoCaptureController* controller = it->second->controller; 35 VideoCaptureController* controller = it->second->controller.get();
36 if (controller) { 36 if (controller) {
37 VideoCaptureControllerID controller_id(it->first); 37 VideoCaptureControllerID controller_id(it->first);
38 controller->StopCapture(controller_id, this); 38 controller->StopCapture(controller_id, this);
39 GetVideoCaptureManager()->RemoveController(controller, this); 39 GetVideoCaptureManager()->RemoveController(controller, this);
40 } 40 }
41 } 41 }
42 STLDeleteValues(&entries_); 42 STLDeleteValues(&entries_);
43 } 43 }
44 44
45 void VideoCaptureHost::OnDestruct() const { 45 void VideoCaptureHost::OnDestruct() const {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 Send(new VideoCaptureMsg_StateChanged(device_id, VIDEO_CAPTURE_STATE_ERROR)); 248 Send(new VideoCaptureMsg_StateChanged(device_id, VIDEO_CAPTURE_STATE_ERROR));
249 } 249 }
250 250
251 void VideoCaptureHost::OnReceiveEmptyBuffer(int device_id, int buffer_id) { 251 void VideoCaptureHost::OnReceiveEmptyBuffer(int device_id, int buffer_id) {
252 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 252 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
253 253
254 VideoCaptureControllerID controller_id(device_id); 254 VideoCaptureControllerID controller_id(device_id);
255 EntryMap::iterator it = entries_.find(controller_id); 255 EntryMap::iterator it = entries_.find(controller_id);
256 if (it != entries_.end()) { 256 if (it != entries_.end()) {
257 scoped_refptr<VideoCaptureController> controller = it->second->controller; 257 scoped_refptr<VideoCaptureController> controller = it->second->controller;
258 if (controller) 258 if (controller.get())
259 controller->ReturnBuffer(controller_id, this, buffer_id); 259 controller->ReturnBuffer(controller_id, this, buffer_id);
260 } 260 }
261 } 261 }
262 262
263 void VideoCaptureHost::DeleteVideoCaptureControllerOnIOThread( 263 void VideoCaptureHost::DeleteVideoCaptureControllerOnIOThread(
264 const VideoCaptureControllerID& controller_id) { 264 const VideoCaptureControllerID& controller_id) {
265 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 265 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
266 266
267 EntryMap::iterator it = entries_.find(controller_id); 267 EntryMap::iterator it = entries_.find(controller_id);
268 if (it == entries_.end()) 268 if (it == entries_.end())
269 return; 269 return;
270 270
271 VideoCaptureController* controller = it->second->controller; 271 VideoCaptureController* controller = it->second->controller.get();
272 if (controller) { 272 if (controller) {
273 controller->StopCapture(controller_id, this); 273 controller->StopCapture(controller_id, this);
274 GetVideoCaptureManager()->RemoveController(controller, this); 274 GetVideoCaptureManager()->RemoveController(controller, this);
275 } 275 }
276 delete it->second; 276 delete it->second;
277 entries_.erase(controller_id); 277 entries_.erase(controller_id);
278 } 278 }
279 279
280 VideoCaptureManager* VideoCaptureHost::GetVideoCaptureManager() { 280 VideoCaptureManager* VideoCaptureHost::GetVideoCaptureManager() {
281 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 281 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
282 return BrowserMainLoop::GetMediaStreamManager()->video_capture_manager(); 282 return BrowserMainLoop::GetMediaStreamManager()->video_capture_manager();
283 } 283 }
284 284
285 } // namespace content 285 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698