| 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 "content/renderer/media/webmediaplayer_impl.h" | 5 #include "content/renderer/media/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 return duration(); | 524 return duration(); |
| 525 } | 525 } |
| 526 | 526 |
| 527 bool WebMediaPlayerImpl::didLoadingProgress() { | 527 bool WebMediaPlayerImpl::didLoadingProgress() { |
| 528 DCHECK(main_loop_->BelongsToCurrentThread()); | 528 DCHECK(main_loop_->BelongsToCurrentThread()); |
| 529 bool pipeline_progress = pipeline_.DidLoadingProgress(); | 529 bool pipeline_progress = pipeline_.DidLoadingProgress(); |
| 530 bool data_progress = buffered_data_source_host_.DidLoadingProgress(); | 530 bool data_progress = buffered_data_source_host_.DidLoadingProgress(); |
| 531 return pipeline_progress || data_progress; | 531 return pipeline_progress || data_progress; |
| 532 } | 532 } |
| 533 | 533 |
| 534 void WebMediaPlayerImpl::paint(WebCanvas* canvas, | 534 void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas, |
| 535 const WebRect& rect, | 535 const blink::WebRect& rect, |
| 536 unsigned char alpha) { | 536 unsigned char alpha) { |
| 537 paint(canvas, rect, alpha, SkXfermode::kSrcOver_Mode); |
| 538 } |
| 539 |
| 540 void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas, |
| 541 const blink::WebRect& rect, |
| 542 unsigned char alpha, |
| 543 SkXfermode::Mode mode) { |
| 537 DCHECK(main_loop_->BelongsToCurrentThread()); | 544 DCHECK(main_loop_->BelongsToCurrentThread()); |
| 538 TRACE_EVENT0("media", "WebMediaPlayerImpl:paint"); | 545 TRACE_EVENT0("media", "WebMediaPlayerImpl:paint"); |
| 539 | 546 |
| 540 // TODO(scherkus): Clarify paint() API contract to better understand when and | 547 // TODO(scherkus): Clarify paint() API contract to better understand when and |
| 541 // why it's being called. For example, today paint() is called when: | 548 // why it's being called. For example, today paint() is called when: |
| 542 // - We haven't reached HAVE_CURRENT_DATA and need to paint black | 549 // - We haven't reached HAVE_CURRENT_DATA and need to paint black |
| 543 // - We're painting to a canvas | 550 // - We're painting to a canvas |
| 544 // See http://crbug.com/341225 http://crbug.com/342621 for details. | 551 // See http://crbug.com/341225 http://crbug.com/342621 for details. |
| 545 scoped_refptr<media::VideoFrame> video_frame = | 552 scoped_refptr<media::VideoFrame> video_frame = |
| 546 GetCurrentFrameFromCompositor(); | 553 GetCurrentFrameFromCompositor(); |
| 547 | 554 |
| 548 gfx::Rect gfx_rect(rect); | 555 gfx::Rect gfx_rect(rect); |
| 549 | 556 |
| 550 skcanvas_video_renderer_.Paint(video_frame.get(), | 557 skcanvas_video_renderer_.Paint(video_frame.get(), |
| 551 canvas, | 558 canvas, |
| 552 gfx_rect, | 559 gfx_rect, |
| 553 alpha, | 560 alpha, |
| 561 mode, |
| 554 pipeline_metadata_.video_rotation); | 562 pipeline_metadata_.video_rotation); |
| 555 } | 563 } |
| 556 | 564 |
| 557 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const { | 565 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const { |
| 558 if (data_source_) | 566 if (data_source_) |
| 559 return data_source_->HasSingleOrigin(); | 567 return data_source_->HasSingleOrigin(); |
| 560 return true; | 568 return true; |
| 561 } | 569 } |
| 562 | 570 |
| 563 bool WebMediaPlayerImpl::didPassCORSAccessCheck() const { | 571 bool WebMediaPlayerImpl::didPassCORSAccessCheck() const { |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1337 compositor_task_runner_->PostTask(FROM_HERE, | 1345 compositor_task_runner_->PostTask(FROM_HERE, |
| 1338 base::Bind(&GetCurrentFrameAndSignal, | 1346 base::Bind(&GetCurrentFrameAndSignal, |
| 1339 base::Unretained(compositor_), | 1347 base::Unretained(compositor_), |
| 1340 &video_frame, | 1348 &video_frame, |
| 1341 &event)); | 1349 &event)); |
| 1342 event.Wait(); | 1350 event.Wait(); |
| 1343 return video_frame; | 1351 return video_frame; |
| 1344 } | 1352 } |
| 1345 | 1353 |
| 1346 } // namespace content | 1354 } // namespace content |
| OLD | NEW |