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

Side by Side Diff: media/base/composite_filter.cc

Issue 6609008: Change other usages of .size() to .empty() when applicable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter nits Created 9 years, 9 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
« no previous file with comments | « jingle/notifier/communicator/connection_settings.cc ('k') | net/base/cookie_monster.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "media/base/composite_filter.h" 5 #include "media/base/composite_filter.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/stl_util-inl.h" 8 #include "base/stl_util-inl.h"
9 #include "media/base/callback.h" 9 #include "media/base/callback.h"
10 10
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 227
228 void CompositeFilter::ChangeState(State new_state) { 228 void CompositeFilter::ChangeState(State new_state) {
229 DCHECK_EQ(message_loop_, MessageLoop::current()); 229 DCHECK_EQ(message_loop_, MessageLoop::current());
230 state_ = new_state; 230 state_ = new_state;
231 } 231 }
232 232
233 void CompositeFilter::StartSerialCallSequence() { 233 void CompositeFilter::StartSerialCallSequence() {
234 DCHECK_EQ(message_loop_, MessageLoop::current()); 234 DCHECK_EQ(message_loop_, MessageLoop::current());
235 error_ = PIPELINE_OK; 235 error_ = PIPELINE_OK;
236 236
237 if (filters_.size() > 0) { 237 if (!filters_.empty()) {
238 sequence_index_ = 0; 238 sequence_index_ = 0;
239 CallFilter(filters_[sequence_index_], 239 CallFilter(filters_[sequence_index_],
240 NewThreadSafeCallback(&CompositeFilter::SerialCallback)); 240 NewThreadSafeCallback(&CompositeFilter::SerialCallback));
241 } else { 241 } else {
242 sequence_index_ = 0; 242 sequence_index_ = 0;
243 SerialCallback(); 243 SerialCallback();
244 } 244 }
245 } 245 }
246 246
247 void CompositeFilter::StartParallelCallSequence() { 247 void CompositeFilter::StartParallelCallSequence() {
248 DCHECK_EQ(message_loop_, MessageLoop::current()); 248 DCHECK_EQ(message_loop_, MessageLoop::current());
249 error_ = PIPELINE_OK; 249 error_ = PIPELINE_OK;
250 250
251 if (filters_.size() > 0) { 251 if (!filters_.empty()) {
252 sequence_index_ = 0; 252 sequence_index_ = 0;
253 for (size_t i = 0; i < filters_.size(); i++) { 253 for (size_t i = 0; i < filters_.size(); i++) {
254 CallFilter(filters_[i], 254 CallFilter(filters_[i],
255 NewThreadSafeCallback(&CompositeFilter::ParallelCallback)); 255 NewThreadSafeCallback(&CompositeFilter::ParallelCallback));
256 } 256 }
257 } else { 257 } else {
258 sequence_index_ = 0; 258 sequence_index_ = 0;
259 ParallelCallback(); 259 ParallelCallback();
260 } 260 }
261 } 261 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 333
334 void CompositeFilter::SerialCallback() { 334 void CompositeFilter::SerialCallback() {
335 DCHECK_EQ(message_loop_, MessageLoop::current()); 335 DCHECK_EQ(message_loop_, MessageLoop::current());
336 if (error_ != PIPELINE_OK) { 336 if (error_ != PIPELINE_OK) {
337 // We encountered an error. Terminate the sequence now. 337 // We encountered an error. Terminate the sequence now.
338 ChangeState(kError); 338 ChangeState(kError);
339 HandleError(error_); 339 HandleError(error_);
340 return; 340 return;
341 } 341 }
342 342
343 if (filters_.size() > 0) 343 if (!filters_.empty())
344 sequence_index_++; 344 sequence_index_++;
345 345
346 if (sequence_index_ == filters_.size()) { 346 if (sequence_index_ == filters_.size()) {
347 // All filters have been successfully called without error. 347 // All filters have been successfully called without error.
348 OnCallSequenceDone(); 348 OnCallSequenceDone();
349 } else if (GetNextState(state_) == kStopPending) { 349 } else if (GetNextState(state_) == kStopPending) {
350 // Abort sequence early and start issuing Stop() calls. 350 // Abort sequence early and start issuing Stop() calls.
351 ChangeState(kStopPending); 351 ChangeState(kStopPending);
352 StartSerialCallSequence(); 352 StartSerialCallSequence();
353 } else { 353 } else {
354 // We aren't done with the sequence. Call the next filter. 354 // We aren't done with the sequence. Call the next filter.
355 CallFilter(filters_[sequence_index_], 355 CallFilter(filters_[sequence_index_],
356 NewThreadSafeCallback(&CompositeFilter::SerialCallback)); 356 NewThreadSafeCallback(&CompositeFilter::SerialCallback));
357 } 357 }
358 } 358 }
359 359
360 void CompositeFilter::ParallelCallback() { 360 void CompositeFilter::ParallelCallback() {
361 DCHECK_EQ(message_loop_, MessageLoop::current()); 361 DCHECK_EQ(message_loop_, MessageLoop::current());
362 362
363 if (filters_.size() > 0) 363 if (!filters_.empty())
364 sequence_index_++; 364 sequence_index_++;
365 365
366 if (sequence_index_ == filters_.size()) { 366 if (sequence_index_ == filters_.size()) {
367 if (error_ != PIPELINE_OK) { 367 if (error_ != PIPELINE_OK) {
368 // We encountered an error. 368 // We encountered an error.
369 ChangeState(kError); 369 ChangeState(kError);
370 HandleError(error_); 370 HandleError(error_);
371 return; 371 return;
372 } 372 }
373 373
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 542
543 void CompositeFilter::FilterHostImpl::SetCurrentReadPosition(int64 offset) { 543 void CompositeFilter::FilterHostImpl::SetCurrentReadPosition(int64 offset) {
544 host_->SetCurrentReadPosition(offset); 544 host_->SetCurrentReadPosition(offset);
545 } 545 }
546 546
547 int64 CompositeFilter::FilterHostImpl::GetCurrentReadPosition() { 547 int64 CompositeFilter::FilterHostImpl::GetCurrentReadPosition() {
548 return host_->GetCurrentReadPosition(); 548 return host_->GetCurrentReadPosition();
549 } 549 }
550 550
551 } // namespace media 551 } // namespace media
OLDNEW
« no previous file with comments | « jingle/notifier/communicator/connection_settings.cc ('k') | net/base/cookie_monster.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698