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

Side by Side Diff: webkit/media/buffered_resource_loader.cc

Issue 10700125: Fold RestartLoadingTask() into ReadCallback() as the method is called on the render thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/media/buffered_resource_loader.h" 5 #include "webkit/media/buffered_resource_loader.h"
6 6
7 #include "base/bits.h" 7 #include "base/bits.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 } 503 }
504 504
505 // If there is a start callback, run it. 505 // If there is a start callback, run it.
506 if (!start_cb_.is_null()) { 506 if (!start_cb_.is_null()) {
507 DCHECK(read_cb_.is_null()) 507 DCHECK(read_cb_.is_null())
508 << "Shouldn't have a read callback during start"; 508 << "Shouldn't have a read callback during start";
509 DoneStart(kOk); 509 DoneStart(kOk);
510 return; 510 return;
511 } 511 }
512 512
513 // If there is a pending read but the request has ended, return with what 513 // Don't leave read callbacks hanging around.
514 // we have.
515 if (HasPendingRead()) { 514 if (HasPendingRead()) {
516 // Try to fulfill with what is in the buffer. 515 // Try to fulfill with what is in the buffer.
517 if (CanFulfillRead()) 516 if (CanFulfillRead())
518 ReadInternal(); 517 ReadInternal();
519 else 518 else
520 DoneRead(kCacheMiss, 0); 519 DoneRead(kCacheMiss, 0);
521 } 520 }
522
523 // There must not be any outstanding read request.
524 DCHECK(!HasPendingRead());
525 } 521 }
526 522
527 void BufferedResourceLoader::didFail( 523 void BufferedResourceLoader::didFail(
528 WebURLLoader* loader, 524 WebURLLoader* loader,
529 const WebURLError& error) { 525 const WebURLError& error) {
530 DVLOG(1) << "didFail: reason=" << error.reason 526 DVLOG(1) << "didFail: reason=" << error.reason
531 << " isCancellation=" << error.isCancellation; 527 << " isCancellation=" << error.isCancellation;
532 DCHECK(active_loader_.get()); 528 DCHECK(active_loader_.get());
533 529
534 // We don't need to continue loading after failure. 530 // We don't need to continue loading after failure.
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 825
830 void BufferedResourceLoader::Log() { 826 void BufferedResourceLoader::Log() {
831 media_log_->AddEvent( 827 media_log_->AddEvent(
832 media_log_->CreateBufferedExtentsChangedEvent( 828 media_log_->CreateBufferedExtentsChangedEvent(
833 offset_ - buffer_.backward_bytes(), 829 offset_ - buffer_.backward_bytes(),
834 offset_, 830 offset_,
835 offset_ + buffer_.forward_bytes())); 831 offset_ + buffer_.forward_bytes()));
836 } 832 }
837 833
838 } // namespace webkit_media 834 } // namespace webkit_media
OLDNEW
« webkit/media/buffered_data_source.cc ('K') | « webkit/media/buffered_data_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698