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

Unified Diff: content/renderer/media/video_capture_message_filter.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, 8 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_message_filter.cc
diff --git a/content/renderer/media/video_capture_message_filter.cc b/content/renderer/media/video_capture_message_filter.cc
index 2ec4110bd35ace189c5c4a902ee54e7096721345..dabbcae7976c597eb924fd834f232c5f43ef66b9 100644
--- a/content/renderer/media/video_capture_message_filter.cc
+++ b/content/renderer/media/video_capture_message_filter.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,7 +12,35 @@ VideoCaptureMessageFilter::VideoCaptureMessageFilter()
channel_(NULL) {
}
-VideoCaptureMessageFilter::~VideoCaptureMessageFilter() {
+void VideoCaptureMessageFilter::AddDelegate(Delegate* delegate) {
+ if (++last_device_id_ <= 0)
+ last_device_id_ = 1;
+ while (delegates_.find(last_device_id_) != delegates_.end())
+ last_device_id_++;
+
+ if (channel_) {
+ delegates_[last_device_id_] = delegate;
+ delegate->OnDelegateAdded(last_device_id_);
+ } else {
+ pending_delegates_[last_device_id_] = delegate;
+ }
+}
+
+void VideoCaptureMessageFilter::RemoveDelegate(Delegate* delegate) {
+ for (Delegates::iterator it = delegates_.begin();
+ it != delegates_.end(); it++) {
+ if (it->second == delegate) {
+ delegates_.erase(it);
+ break;
+ }
+ }
+ for (Delegates::iterator it = pending_delegates_.begin();
+ it != pending_delegates_.end(); it++) {
+ if (it->second == delegate) {
+ pending_delegates_.erase(it);
+ break;
+ }
+ }
}
bool VideoCaptureMessageFilter::Send(IPC::Message* message) {
@@ -58,6 +86,8 @@ void VideoCaptureMessageFilter::OnChannelClosing() {
channel_ = NULL;
}
+VideoCaptureMessageFilter::~VideoCaptureMessageFilter() {}
+
void VideoCaptureMessageFilter::OnBufferCreated(
int device_id,
base::SharedMemoryHandle handle,
@@ -129,34 +159,3 @@ void VideoCaptureMessageFilter::OnDeviceInfoReceived(
}
delegate->OnDeviceInfoReceived(params);
}
-
-void VideoCaptureMessageFilter::AddDelegate(Delegate* delegate) {
- if (++last_device_id_ <= 0)
- last_device_id_ = 1;
- while (delegates_.find(last_device_id_) != delegates_.end())
- last_device_id_++;
-
- if (channel_) {
- delegates_[last_device_id_] = delegate;
- delegate->OnDelegateAdded(last_device_id_);
- } else {
- pending_delegates_[last_device_id_] = delegate;
- }
-}
-
-void VideoCaptureMessageFilter::RemoveDelegate(Delegate* delegate) {
- for (Delegates::iterator it = delegates_.begin();
- it != delegates_.end(); it++) {
- if (it->second == delegate) {
- delegates_.erase(it);
- break;
- }
- }
- for (Delegates::iterator it = pending_delegates_.begin();
- it != pending_delegates_.end(); it++) {
- if (it->second == delegate) {
- pending_delegates_.erase(it);
- break;
- }
- }
-}
« no previous file with comments | « content/renderer/media/video_capture_message_filter.h ('k') | content/renderer/p2p/p2p_transport_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698