Index: media/base/composite_filter.cc |
diff --git a/media/base/composite_filter.cc b/media/base/composite_filter.cc |
index 5c4b1c5c2be1fbdffb8a03dc6c62c26d692fc460..194ad903ea32367ac67f4709ddb7eba20eb99e02 100644 |
--- a/media/base/composite_filter.cc |
+++ b/media/base/composite_filter.cc |
@@ -67,6 +67,23 @@ bool CompositeFilter::AddFilter(scoped_refptr<Filter> filter) { |
return true; |
} |
+void CompositeFilter::RemoveFilter(scoped_refptr<Filter> filter) { |
+ DCHECK_EQ(message_loop_, MessageLoop::current()); |
+ if (!filter.get() || state_ != kCreated || !host()) |
+ LOG(FATAL) << "Unknown filter, or in unexpected state."; |
+ |
+ bool found = false; |
+ for (FilterVector::iterator it = filters_.begin(); |
+ it != filters_.end() && !found; ++it) { |
+ if (it->get() == filter.get()) { |
+ filters_.erase(it); |
scherkus (not reviewing)
2011/12/09 00:26:20
nit: doesn't filters_.erase(filters_.find(filter))
Ami GONE FROM CHROMIUM
2011/12/09 22:55:50
filters_ is a vector so no find() for you.
Could u
|
+ found = true; |
+ } |
+ } |
+ filter->clear_host(); |
+ CHECK(found); |
+} |
+ |
void CompositeFilter::set_host(FilterHost* host) { |
DCHECK_EQ(message_loop_, MessageLoop::current()); |
DCHECK(host); |
@@ -337,7 +354,6 @@ void CompositeFilter::SerialCallback() { |
DispatchPendingCallback(status_); |
return; |
} |
- |
if (!filters_.empty()) |
sequence_index_++; |
@@ -375,7 +391,6 @@ void CompositeFilter::ParallelCallback() { |
void CompositeFilter::OnCallSequenceDone() { |
State next_state = GetNextState(state_); |
- |
if (next_state == kInvalid) { |
// We somehow got into an unexpected state. |
ChangeState(kError); |