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

Side by Side Diff: webkit/glue/webmediaplayer_impl.cc

Issue 6581012: Fix progress event not firing when load has completed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only change state to 'loaded' if we were previously 'loading'. Created 9 years, 10 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 | « no previous file | no next file » | 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) 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/webmediaplayer_impl.h" 5 #include "webkit/glue/webmediaplayer_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 818
819 void WebMediaPlayerImpl::OnNetworkEvent() { 819 void WebMediaPlayerImpl::OnNetworkEvent() {
820 DCHECK(MessageLoop::current() == main_loop_); 820 DCHECK(MessageLoop::current() == main_loop_);
821 if (pipeline_->GetError() == media::PIPELINE_OK) { 821 if (pipeline_->GetError() == media::PIPELINE_OK) {
822 if (pipeline_->IsNetworkActive()) { 822 if (pipeline_->IsNetworkActive()) {
823 SetNetworkState(WebKit::WebMediaPlayer::Loading); 823 SetNetworkState(WebKit::WebMediaPlayer::Loading);
824 } else { 824 } else {
825 // If we are inactive because we just finished receiving all the data, 825 // If we are inactive because we just finished receiving all the data,
826 // do one final repaint to show final progress. 826 // do one final repaint to show final progress.
827 if (bytesLoaded() == totalBytes() && 827 if (bytesLoaded() == totalBytes() &&
828 network_state_ != WebKit::WebMediaPlayer::Idle) 828 network_state_ != WebKit::WebMediaPlayer::Idle) {
829 Repaint(); 829 Repaint();
830 }
831 if (network_state_ == WebKit::WebMediaPlayer::Loading) {
832 SetNetworkState(WebKit::WebMediaPlayer::Loaded);
acolwell GONE FROM CHROMIUM 2011/02/24 19:19:08 Shouldn't this be inside the condition with the Re
sjl 2011/02/24 21:24:41 Good point. Fixed.
833 }
830 SetNetworkState(WebKit::WebMediaPlayer::Idle); 834 SetNetworkState(WebKit::WebMediaPlayer::Idle);
acolwell GONE FROM CHROMIUM 2011/02/24 19:19:08 Why is there an immediate transition from Loaded t
sjl 2011/02/24 21:24:41 We need to switch to idle when we've finished down
831 } 835 }
832 } 836 }
833 } 837 }
834 838
835 void WebMediaPlayerImpl::SetNetworkState( 839 void WebMediaPlayerImpl::SetNetworkState(
836 WebKit::WebMediaPlayer::NetworkState state) { 840 WebKit::WebMediaPlayer::NetworkState state) {
837 DCHECK(MessageLoop::current() == main_loop_); 841 DCHECK(MessageLoop::current() == main_loop_);
838 // Always notify to ensure client has the latest value. 842 // Always notify to ensure client has the latest value.
839 network_state_ = state; 843 network_state_ = state;
840 GetClient()->networkStateChanged(); 844 GetClient()->networkStateChanged();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 pipeline_stopped_.Signal(); 882 pipeline_stopped_.Signal();
879 } 883 }
880 884
881 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { 885 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() {
882 DCHECK(MessageLoop::current() == main_loop_); 886 DCHECK(MessageLoop::current() == main_loop_);
883 DCHECK(client_); 887 DCHECK(client_);
884 return client_; 888 return client_;
885 } 889 }
886 890
887 } // namespace webkit_glue 891 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698