OLD | NEW |
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_data_source.h" | 5 #include "webkit/media/buffered_data_source.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "media/base/media_log.h" | 10 #include "media/base/media_log.h" |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 | 450 |
451 if (assume_fully_buffered_) | 451 if (assume_fully_buffered_) |
452 return; | 452 return; |
453 | 453 |
454 bool is_downloading_data; | 454 bool is_downloading_data; |
455 switch (state) { | 455 switch (state) { |
456 case BufferedResourceLoader::kLoading: | 456 case BufferedResourceLoader::kLoading: |
457 is_downloading_data = true; | 457 is_downloading_data = true; |
458 break; | 458 break; |
459 case BufferedResourceLoader::kLoadingDeferred: | 459 case BufferedResourceLoader::kLoadingDeferred: |
| 460 case BufferedResourceLoader::kLoadingFinished: |
460 is_downloading_data = false; | 461 is_downloading_data = false; |
461 break; | 462 break; |
462 | 463 |
463 // TODO(scherkus): we don't signal network activity changes when loads | 464 // TODO(scherkus): we don't signal network activity changes when loads |
464 // complete or fail to preserve existing behaviour when deferring is | 465 // fail to preserve existing behaviour when deferring is toggled, however |
465 // toggled, however we considering changing DownloadingCB to also | 466 // we should consider changing DownloadingCB to also propagate loading |
466 // propagate loading state. For example there isn't any signal today | 467 // state. For example there isn't any signal today to notify the client that |
467 // to notify the client that loading has failed/finished (we only get | 468 // loading has failed (we only get errors on subsequent reads). |
468 // errors on subsequent reads). | |
469 case BufferedResourceLoader::kLoadingFailed: | 469 case BufferedResourceLoader::kLoadingFailed: |
470 case BufferedResourceLoader::kLoadingFinished: | |
471 return; | 470 return; |
472 } | 471 } |
473 | 472 |
474 downloading_cb_.Run(is_downloading_data); | 473 downloading_cb_.Run(is_downloading_data); |
475 } | 474 } |
476 | 475 |
477 void BufferedDataSource::ProgressCallback(int64 position) { | 476 void BufferedDataSource::ProgressCallback(int64 position) { |
478 DCHECK(MessageLoop::current() == render_loop_); | 477 DCHECK(MessageLoop::current() == render_loop_); |
479 | 478 |
480 if (assume_fully_buffered_) | 479 if (assume_fully_buffered_) |
(...skipping 18 matching lines...) Expand all Loading... |
499 if (total_bytes_ == kPositionNotSpecified) | 498 if (total_bytes_ == kPositionNotSpecified) |
500 return; | 499 return; |
501 | 500 |
502 host()->SetTotalBytes(total_bytes_); | 501 host()->SetTotalBytes(total_bytes_); |
503 | 502 |
504 if (assume_fully_buffered_) | 503 if (assume_fully_buffered_) |
505 host()->AddBufferedByteRange(0, total_bytes_); | 504 host()->AddBufferedByteRange(0, total_bytes_); |
506 } | 505 } |
507 | 506 |
508 } // namespace webkit_media | 507 } // namespace webkit_media |
OLD | NEW |