| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "media/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 | 749 |
| 750 bool WebMediaPlayerImpl::didLoadingProgress() { | 750 bool WebMediaPlayerImpl::didLoadingProgress() { |
| 751 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 751 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 752 bool pipeline_progress = pipeline_.DidLoadingProgress(); | 752 bool pipeline_progress = pipeline_.DidLoadingProgress(); |
| 753 bool data_progress = buffered_data_source_host_.DidLoadingProgress(); | 753 bool data_progress = buffered_data_source_host_.DidLoadingProgress(); |
| 754 return pipeline_progress || data_progress; | 754 return pipeline_progress || data_progress; |
| 755 } | 755 } |
| 756 | 756 |
| 757 void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas, | 757 void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas, |
| 758 const blink::WebRect& rect, | 758 const blink::WebRect& rect, |
| 759 unsigned char alpha, | 759 const SkPaint* paint) { |
| 760 SkXfermode::Mode mode) { | |
| 761 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 760 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 762 TRACE_EVENT0("media", "WebMediaPlayerImpl:paint"); | 761 TRACE_EVENT0("media", "WebMediaPlayerImpl:paint"); |
| 763 | 762 |
| 764 if (is_cdm_attached_) | 763 if (is_cdm_attached_) |
| 765 return; | 764 return; |
| 766 | 765 |
| 767 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); | 766 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); |
| 768 | 767 |
| 769 gfx::Rect gfx_rect(rect); | 768 gfx::Rect gfx_rect(rect); |
| 770 Context3D context_3d; | 769 Context3D context_3d; |
| 771 if (video_frame.get() && video_frame->HasTextures()) { | 770 if (video_frame.get() && video_frame->HasTextures()) { |
| 772 if (!context_3d_cb_.is_null()) | 771 if (!context_3d_cb_.is_null()) |
| 773 context_3d = context_3d_cb_.Run(); | 772 context_3d = context_3d_cb_.Run(); |
| 774 if (!context_3d.gl) | 773 if (!context_3d.gl) |
| 775 return; // Unable to get/create a shared main thread context. | 774 return; // Unable to get/create a shared main thread context. |
| 776 if (!context_3d.gr_context) | 775 if (!context_3d.gr_context) |
| 777 return; // The context has been lost since and can't setup a GrContext. | 776 return; // The context has been lost since and can't setup a GrContext. |
| 778 } | 777 } |
| 779 skcanvas_video_renderer_.Paint(video_frame, canvas, gfx::RectF(gfx_rect), | 778 skcanvas_video_renderer_.Paint(video_frame, canvas, gfx::RectF(gfx_rect), |
| 780 alpha, mode, pipeline_metadata_.video_rotation, | 779 paint, pipeline_metadata_.video_rotation, |
| 781 context_3d); | 780 context_3d); |
| 782 } | 781 } |
| 783 | 782 |
| 784 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const { | 783 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const { |
| 785 if (data_source_) | 784 if (data_source_) |
| 786 return data_source_->HasSingleOrigin(); | 785 return data_source_->HasSingleOrigin(); |
| 787 return true; | 786 return true; |
| 788 } | 787 } |
| 789 | 788 |
| 790 bool WebMediaPlayerImpl::didPassCORSAccessCheck() const { | 789 bool WebMediaPlayerImpl::didPassCORSAccessCheck() const { |
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1790 pipeline_metadata_.natural_size, | 1789 pipeline_metadata_.natural_size, |
| 1791 base::Bind(&GetCurrentTimeInternal, this))); | 1790 base::Bind(&GetCurrentTimeInternal, this))); |
| 1792 watch_time_reporter_->OnVolumeChange(volume_); | 1791 watch_time_reporter_->OnVolumeChange(volume_); |
| 1793 if (delegate_ && delegate_->IsHidden()) | 1792 if (delegate_ && delegate_->IsHidden()) |
| 1794 watch_time_reporter_->OnHidden(); | 1793 watch_time_reporter_->OnHidden(); |
| 1795 else | 1794 else |
| 1796 watch_time_reporter_->OnShown(); | 1795 watch_time_reporter_->OnShown(); |
| 1797 } | 1796 } |
| 1798 | 1797 |
| 1799 } // namespace media | 1798 } // namespace media |
| OLD | NEW |