OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/media/webmediaplayer_impl.h" | 5 #include "webkit/media/webmediaplayer_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 const WebKit::WebRect& rect) { | 494 const WebKit::WebRect& rect) { |
495 paint(canvas, rect, 0xFF); | 495 paint(canvas, rect, 0xFF); |
496 } | 496 } |
497 | 497 |
498 void WebMediaPlayerImpl::paint(WebCanvas* canvas, | 498 void WebMediaPlayerImpl::paint(WebCanvas* canvas, |
499 const WebRect& rect, | 499 const WebRect& rect, |
500 uint8_t alpha) { | 500 uint8_t alpha) { |
501 DCHECK_EQ(main_loop_, MessageLoop::current()); | 501 DCHECK_EQ(main_loop_, MessageLoop::current()); |
502 DCHECK(proxy_); | 502 DCHECK(proxy_); |
503 | 503 |
| 504 if (!accelerated_compositing_reported_) { |
| 505 accelerated_compositing_reported_ = true; |
| 506 DCHECK_EQ(frame_->view()->isAcceleratedCompositingActive(), false); |
| 507 UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", false); |
| 508 } |
| 509 |
504 proxy_->Paint(canvas, rect, alpha); | 510 proxy_->Paint(canvas, rect, alpha); |
505 } | 511 } |
506 | 512 |
507 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const { | 513 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const { |
508 if (proxy_) | 514 if (proxy_) |
509 return proxy_->HasSingleOrigin(); | 515 return proxy_->HasSingleOrigin(); |
510 return true; | 516 return true; |
511 } | 517 } |
512 | 518 |
513 WebMediaPlayer::MovieLoadType WebMediaPlayerImpl::movieLoadType() const { | 519 WebMediaPlayer::MovieLoadType WebMediaPlayerImpl::movieLoadType() const { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 proxy_->GetCurrentFrame(&video_frame); | 562 proxy_->GetCurrentFrame(&video_frame); |
557 if (video_frame.get()) | 563 if (video_frame.get()) |
558 return new WebVideoFrameImpl(video_frame); | 564 return new WebVideoFrameImpl(video_frame); |
559 return NULL; | 565 return NULL; |
560 } | 566 } |
561 | 567 |
562 void WebMediaPlayerImpl::putCurrentFrame( | 568 void WebMediaPlayerImpl::putCurrentFrame( |
563 WebKit::WebVideoFrame* web_video_frame) { | 569 WebKit::WebVideoFrame* web_video_frame) { |
564 if (!accelerated_compositing_reported_) { | 570 if (!accelerated_compositing_reported_) { |
565 accelerated_compositing_reported_ = true; | 571 accelerated_compositing_reported_ = true; |
566 UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", | 572 DCHECK_EQ(frame_->view()->isAcceleratedCompositingActive(), true); |
567 frame_->view()->isAcceleratedCompositingActive()); | 573 UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", true); |
568 } | 574 } |
569 if (web_video_frame) { | 575 if (web_video_frame) { |
570 scoped_refptr<media::VideoFrame> video_frame( | 576 scoped_refptr<media::VideoFrame> video_frame( |
571 WebVideoFrameImpl::toVideoFrame(web_video_frame)); | 577 WebVideoFrameImpl::toVideoFrame(web_video_frame)); |
572 proxy_->PutCurrentFrame(video_frame); | 578 proxy_->PutCurrentFrame(video_frame); |
573 delete web_video_frame; | 579 delete web_video_frame; |
574 } else { | 580 } else { |
575 proxy_->PutCurrentFrame(NULL); | 581 proxy_->PutCurrentFrame(NULL); |
576 } | 582 } |
577 } | 583 } |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 return audio_source_provider_; | 1021 return audio_source_provider_; |
1016 } | 1022 } |
1017 | 1023 |
1018 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 1024 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
1019 DCHECK_EQ(main_loop_, MessageLoop::current()); | 1025 DCHECK_EQ(main_loop_, MessageLoop::current()); |
1020 incremented_externally_allocated_memory_ = true; | 1026 incremented_externally_allocated_memory_ = true; |
1021 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 1027 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
1022 } | 1028 } |
1023 | 1029 |
1024 } // namespace webkit_media | 1030 } // namespace webkit_media |
OLD | NEW |