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

Side by Side Diff: content/renderer/media/video_capture_impl_manager.cc

Issue 10071038: RefCounted types should not have public destructors, content/browser part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Copyright bump Created 8 years, 7 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) 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/renderer/media/video_capture_impl_manager.h" 5 #include "content/renderer/media/video_capture_impl_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "content/renderer/media/video_capture_impl.h" 9 #include "content/renderer/media/video_capture_impl.h"
10 #include "content/renderer/media/video_capture_message_filter.h" 10 #include "content/renderer/media/video_capture_message_filter.h"
11 11
12 VideoCaptureImplManager::VideoCaptureImplManager() 12 VideoCaptureImplManager::VideoCaptureImplManager()
13 : thread_("VC manager") { 13 : thread_("VC manager") {
14 thread_.Start(); 14 thread_.Start();
15 message_loop_proxy_ = thread_.message_loop_proxy(); 15 message_loop_proxy_ = thread_.message_loop_proxy();
16 filter_ = new VideoCaptureMessageFilter(); 16 filter_ = new VideoCaptureMessageFilter();
17 } 17 }
18 18
19 VideoCaptureImplManager::~VideoCaptureImplManager() {
20 STLDeleteContainerPairSecondPointers(devices_.begin(), devices_.end());
21 thread_.Stop();
22 }
23
24 media::VideoCapture* VideoCaptureImplManager::AddDevice( 19 media::VideoCapture* VideoCaptureImplManager::AddDevice(
25 media::VideoCaptureSessionId id, 20 media::VideoCaptureSessionId id,
26 media::VideoCapture::EventHandler* handler) { 21 media::VideoCapture::EventHandler* handler) {
27 DCHECK(handler); 22 DCHECK(handler);
28 23
29 base::AutoLock auto_lock(lock_); 24 base::AutoLock auto_lock(lock_);
30 Devices::iterator it = devices_.find(id); 25 Devices::iterator it = devices_.find(id);
31 if (it == devices_.end()) { 26 if (it == devices_.end()) {
32 VideoCaptureImpl* vc = 27 VideoCaptureImpl* vc =
33 new VideoCaptureImpl(id, message_loop_proxy_, filter_); 28 new VideoCaptureImpl(id, message_loop_proxy_, filter_);
(...skipping 25 matching lines...) Expand all
59 devices_[id]->vc->DeInit(base::Bind(&VideoCaptureImplManager::FreeDevice, 54 devices_[id]->vc->DeInit(base::Bind(&VideoCaptureImplManager::FreeDevice,
60 this, devices_[id]->vc)); 55 this, devices_[id]->vc));
61 delete devices_[id]; 56 delete devices_[id];
62 devices_.erase(id); 57 devices_.erase(id);
63 } 58 }
64 59
65 void VideoCaptureImplManager::FreeDevice(VideoCaptureImpl* vc) { 60 void VideoCaptureImplManager::FreeDevice(VideoCaptureImpl* vc) {
66 delete vc; 61 delete vc;
67 } 62 }
68 63
64 VideoCaptureImplManager::~VideoCaptureImplManager() {
65 STLDeleteContainerPairSecondPointers(devices_.begin(), devices_.end());
66 thread_.Stop();
67 }
68
69 VideoCaptureImplManager::Device::Device( 69 VideoCaptureImplManager::Device::Device(
70 VideoCaptureImpl* device, 70 VideoCaptureImpl* device,
71 media::VideoCapture::EventHandler* handler) 71 media::VideoCapture::EventHandler* handler)
72 : vc(device) { 72 : vc(device) {
73 clients.push_front(handler); 73 clients.push_front(handler);
74 } 74 }
75 75
76 VideoCaptureImplManager::Device::~Device() {} 76 VideoCaptureImplManager::Device::~Device() {}
OLDNEW
« no previous file with comments | « content/renderer/media/video_capture_impl_manager.h ('k') | content/renderer/media/video_capture_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698