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

Unified Diff: content/renderer/media/video_capture_impl_manager.cc

Issue 2377163002: VideoCaptureImpl cleanup: merge ctor+Init() and DeInit()+dtor. (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/video_capture_impl_manager.cc
diff --git a/content/renderer/media/video_capture_impl_manager.cc b/content/renderer/media/video_capture_impl_manager.cc
index 1c052d70415517084a8a689cf3e868421d39d8fe..1293df831d4b6ff62e08fe8c524fa9f37a2c412c 100644
--- a/content/renderer/media/video_capture_impl_manager.cc
+++ b/content/renderer/media/video_capture_impl_manager.cc
@@ -48,9 +48,6 @@ VideoCaptureImplManager::~VideoCaptureImplManager() {
// Forcibly release all video capture resources.
for (const auto& device : devices_) {
VideoCaptureImpl* const impl = device.second.second;
- ChildProcess::current()->io_task_runner()->PostTask(
- FROM_HERE,
- base::Bind(&VideoCaptureImpl::DeInit, base::Unretained(impl)));
ChildProcess::current()->io_task_runner()->DeleteSoon(FROM_HERE, impl);
}
devices_.clear();
@@ -63,11 +60,11 @@ base::Closure VideoCaptureImplManager::UseDevice(
const VideoCaptureDeviceMap::iterator it = devices_.find(id);
if (it == devices_.end()) {
impl = CreateVideoCaptureImplForTesting(id, filter_.get());
- if (!impl)
- impl = new VideoCaptureImpl(id, filter_.get());
+ if (!impl) {
+ impl = new VideoCaptureImpl(id, filter_.get(),
+ ChildProcess::current()->io_task_runner());
+ }
devices_[id] = std::make_pair(1, impl);
- ChildProcess::current()->io_task_runner()->PostTask(
- FROM_HERE, base::Bind(&VideoCaptureImpl::Init, base::Unretained(impl)));
} else {
++it->second.first;
}
@@ -162,9 +159,6 @@ void VideoCaptureImplManager::UnrefDevice(
--it->second.first;
if (!it->second.first) {
devices_.erase(id);
- ChildProcess::current()->io_task_runner()->PostTask(
- FROM_HERE,
- base::Bind(&VideoCaptureImpl::DeInit, base::Unretained(impl)));
ChildProcess::current()->io_task_runner()->DeleteSoon(FROM_HERE, impl);
}
}

Powered by Google App Engine
This is Rietveld 408576698