| OLD | NEW |
| 1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008-2009 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
| 9 #include "media/base/media_format.h" | 9 #include "media/base/media_format.h" |
| 10 #include "media/filters/ffmpeg_audio_decoder.h" | 10 #include "media/filters/ffmpeg_audio_decoder.h" |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 break; | 535 break; |
| 536 } | 536 } |
| 537 | 537 |
| 538 // Repaint to trigger UI update. | 538 // Repaint to trigger UI update. |
| 539 Repaint(); | 539 Repaint(); |
| 540 } | 540 } |
| 541 | 541 |
| 542 void WebMediaPlayerImpl::SetNetworkState( | 542 void WebMediaPlayerImpl::SetNetworkState( |
| 543 WebKit::WebMediaPlayer::NetworkState state) { | 543 WebKit::WebMediaPlayer::NetworkState state) { |
| 544 DCHECK(MessageLoop::current() == main_loop_); | 544 DCHECK(MessageLoop::current() == main_loop_); |
| 545 if (network_state_ != state) { | 545 // Always notify of any state change to ensure the client remains in sync. |
| 546 network_state_ = state; | 546 network_state_ = state; |
| 547 GetClient()->networkStateChanged(); | 547 GetClient()->networkStateChanged(); |
| 548 } | |
| 549 } | 548 } |
| 550 | 549 |
| 551 void WebMediaPlayerImpl::SetReadyState( | 550 void WebMediaPlayerImpl::SetReadyState( |
| 552 WebKit::WebMediaPlayer::ReadyState state) { | 551 WebKit::WebMediaPlayer::ReadyState state) { |
| 553 DCHECK(MessageLoop::current() == main_loop_); | 552 DCHECK(MessageLoop::current() == main_loop_); |
| 554 if (ready_state_ != state) { | 553 // Always notify of any state change to ensure the client remains in sync. |
| 555 ready_state_ = state; | 554 ready_state_ = state; |
| 556 GetClient()->readyStateChanged(); | 555 GetClient()->readyStateChanged(); |
| 557 } | |
| 558 } | 556 } |
| 559 | 557 |
| 560 void WebMediaPlayerImpl::Destroy() { | 558 void WebMediaPlayerImpl::Destroy() { |
| 561 DCHECK(MessageLoop::current() == main_loop_); | 559 DCHECK(MessageLoop::current() == main_loop_); |
| 562 | 560 |
| 563 // Make sure to kill the pipeline so there's no more media threads running. | 561 // Make sure to kill the pipeline so there's no more media threads running. |
| 564 // TODO(hclam): stopping the pipeline might block for a long time. | 562 // TODO(hclam): stopping the pipeline might block for a long time. |
| 565 pipeline_->Stop(NULL); | 563 pipeline_->Stop(NULL); |
| 566 pipeline_thread_.Stop(); | 564 pipeline_thread_.Stop(); |
| 567 | 565 |
| 568 // And then detach the proxy, it may live on the render thread for a little | 566 // And then detach the proxy, it may live on the render thread for a little |
| 569 // longer until all the tasks are finished. | 567 // longer until all the tasks are finished. |
| 570 if (proxy_) { | 568 if (proxy_) { |
| 571 proxy_->Detach(); | 569 proxy_->Detach(); |
| 572 proxy_ = NULL; | 570 proxy_ = NULL; |
| 573 } | 571 } |
| 574 } | 572 } |
| 575 | 573 |
| 576 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { | 574 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { |
| 577 DCHECK(MessageLoop::current() == main_loop_); | 575 DCHECK(MessageLoop::current() == main_loop_); |
| 578 DCHECK(client_); | 576 DCHECK(client_); |
| 579 return client_; | 577 return client_; |
| 580 } | 578 } |
| 581 | 579 |
| 582 } // namespace webkit_glue | 580 } // namespace webkit_glue |
| OLD | NEW |