Index: media/base/composite_filter.cc |
diff --git a/media/base/composite_filter.cc b/media/base/composite_filter.cc |
index 5c4b1c5c2be1fbdffb8a03dc6c62c26d692fc460..d6e45df20b245932140a2f41db2eae3c8755a9a0 100644 |
--- a/media/base/composite_filter.cc |
+++ b/media/base/composite_filter.cc |
@@ -57,6 +57,8 @@ CompositeFilter::~CompositeFilter() { |
} |
bool CompositeFilter::AddFilter(scoped_refptr<Filter> filter) { |
+ // TODO(fischman,scherkus): s/bool/void/ the return type and CHECK on failure |
scherkus (not reviewing)
2011/12/09 23:13:55
woah woah woah!
Ami GONE FROM CHROMIUM
2011/12/10 00:03:15
Whaaaaat? You asked for a TODO, you got a TODO.
|
+ // of the sanity-checks that return false today. |
DCHECK_EQ(message_loop_, MessageLoop::current()); |
if (!filter.get() || state_ != kCreated || !host()) |
return false; |
@@ -67,6 +69,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); |
+ found = true; |
+ } |
+ } |
+ filter->clear_host(); |
+ CHECK(found); |
+} |
+ |
void CompositeFilter::set_host(FilterHost* host) { |
DCHECK_EQ(message_loop_, MessageLoop::current()); |
DCHECK(host); |
@@ -337,7 +356,6 @@ void CompositeFilter::SerialCallback() { |
DispatchPendingCallback(status_); |
return; |
} |
- |
if (!filters_.empty()) |
sequence_index_++; |
@@ -375,7 +393,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); |