Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/glue/media/buffered_data_source.h" | 5 #include "webkit/glue/media/buffered_data_source.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "media/base/filter_host.h" | 8 #include "media/base/filter_host.h" |
| 9 #include "media/base/media_log.h" | 9 #include "media/base/media_log.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 637 // this object when Stop() method is ever called. Locking this method is safe | 637 // this object when Stop() method is ever called. Locking this method is safe |
| 638 // because |lock_| is only acquired in tasks on render thread. | 638 // because |lock_| is only acquired in tasks on render thread. |
| 639 base::AutoLock auto_lock(lock_); | 639 base::AutoLock auto_lock(lock_); |
| 640 if (stop_signal_received_) | 640 if (stop_signal_received_) |
| 641 return; | 641 return; |
| 642 | 642 |
| 643 if (is_downloading_data != is_downloading_data_) { | 643 if (is_downloading_data != is_downloading_data_) { |
| 644 is_downloading_data_ = is_downloading_data; | 644 is_downloading_data_ = is_downloading_data; |
| 645 if (host()) | 645 if (host()) |
| 646 host()->SetNetworkActivity(is_downloading_data); | 646 host()->SetNetworkActivity(is_downloading_data); |
| 647 } | 647 } else if (media_is_paused_ && host()) |
|
scherkus (not reviewing)
2011/11/09 03:45:28
nit: if one if branch has {} then all branches get
DaleCurtis
2011/11/09 18:30:02
Done.
| |
| 648 // When paused forward all network events to ensure buffering progress is | |
| 649 // displayed properly. | |
| 650 host()->SetNetworkActivity(is_downloading_data); | |
| 648 | 651 |
| 649 buffered_bytes_ = buffered_position + 1; | 652 buffered_bytes_ = buffered_position + 1; |
| 650 if (host()) | 653 if (host()) |
| 651 host()->SetBufferedBytes(buffered_bytes_); | 654 host()->SetBufferedBytes(buffered_bytes_); |
| 652 } | 655 } |
| 653 | 656 |
| 654 void BufferedDataSource::UpdateHostState_Locked() { | 657 void BufferedDataSource::UpdateHostState_Locked() { |
| 655 // Called from various threads, under lock. | 658 // Called from various threads, under lock. |
| 656 lock_.AssertAcquired(); | 659 lock_.AssertAcquired(); |
| 657 | 660 |
| 658 media::FilterHost* filter_host = host(); | 661 media::FilterHost* filter_host = host(); |
| 659 if (!filter_host) | 662 if (!filter_host) |
| 660 return; | 663 return; |
| 661 | 664 |
| 662 filter_host->SetLoaded(loaded_); | 665 filter_host->SetLoaded(loaded_); |
| 663 | 666 |
| 664 if (streaming_) { | 667 if (streaming_) { |
| 665 filter_host->SetStreaming(true); | 668 filter_host->SetStreaming(true); |
| 666 } else { | 669 } else { |
| 667 filter_host->SetTotalBytes(total_bytes_); | 670 filter_host->SetTotalBytes(total_bytes_); |
| 668 filter_host->SetBufferedBytes(buffered_bytes_); | 671 filter_host->SetBufferedBytes(buffered_bytes_); |
| 669 } | 672 } |
| 670 } | 673 } |
| 671 | 674 |
| 672 } // namespace webkit_glue | 675 } // namespace webkit_glue |
| OLD | NEW |