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

Side by Side Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Clean up comments, fix mac build Created 3 years, 11 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
OLDNEW
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/android/webmediaplayer_android.h" 5 #include "content/renderer/media/android/webmediaplayer_android.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
11 #include "base/android/build_info.h" 11 #include "base/android/build_info.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback_helpers.h" 13 #include "base/callback_helpers.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/metrics/histogram_macros.h" 17 #include "base/metrics/histogram_macros.h"
18 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
19 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "base/threading/thread_task_runner_handle.h" 21 #include "base/threading/thread_task_runner_handle.h"
22 #include "cc/blink/web_layer_impl.h" 22 #include "cc/blink/web_layer_impl.h"
23 #include "cc/layers/video_layer.h" 23 #include "cc/layers/video_layer.h"
24 #include "cc/paint/paint_flags.h"
24 #include "content/public/common/content_client.h" 25 #include "content/public/common/content_client.h"
25 #include "content/public/common/content_switches.h" 26 #include "content/public/common/content_switches.h"
26 #include "content/public/common/renderer_preferences.h" 27 #include "content/public/common/renderer_preferences.h"
27 #include "content/public/renderer/render_frame.h" 28 #include "content/public/renderer/render_frame.h"
28 #include "content/renderer/media/android/renderer_media_player_manager.h" 29 #include "content/renderer/media/android/renderer_media_player_manager.h"
29 #include "content/renderer/render_frame_impl.h" 30 #include "content/renderer/render_frame_impl.h"
30 #include "content/renderer/render_thread_impl.h" 31 #include "content/renderer/render_thread_impl.h"
31 #include "content/renderer/render_view_impl.h" 32 #include "content/renderer/render_view_impl.h"
32 #include "gpu/GLES2/gl2extchromium.h" 33 #include "gpu/GLES2/gl2extchromium.h"
33 #include "gpu/command_buffer/client/gles2_interface.h" 34 #include "gpu/command_buffer/client/gles2_interface.h"
(...skipping 23 matching lines...) Expand all
57 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient. h" 58 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient. h"
58 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h" 59 #include "third_party/WebKit/public/platform/WebMediaPlayerSource.h"
59 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 60 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
60 #include "third_party/WebKit/public/platform/WebString.h" 61 #include "third_party/WebKit/public/platform/WebString.h"
61 #include "third_party/WebKit/public/platform/WebURL.h" 62 #include "third_party/WebKit/public/platform/WebURL.h"
62 #include "third_party/WebKit/public/web/WebDocument.h" 63 #include "third_party/WebKit/public/web/WebDocument.h"
63 #include "third_party/WebKit/public/web/WebFrame.h" 64 #include "third_party/WebKit/public/web/WebFrame.h"
64 #include "third_party/WebKit/public/web/WebView.h" 65 #include "third_party/WebKit/public/web/WebView.h"
65 #include "third_party/skia/include/core/SkCanvas.h" 66 #include "third_party/skia/include/core/SkCanvas.h"
66 #include "third_party/skia/include/core/SkImage.h" 67 #include "third_party/skia/include/core/SkImage.h"
67 #include "third_party/skia/include/core/SkPaint.h"
68 #include "third_party/skia/include/core/SkTypeface.h" 68 #include "third_party/skia/include/core/SkTypeface.h"
69 #include "ui/gfx/image/image.h" 69 #include "ui/gfx/image/image.h"
70 #include "url/gurl.h" 70 #include "url/gurl.h"
71 #include "url/origin.h" 71 #include "url/origin.h"
72 72
73 static const uint32_t kGLTextureExternalOES = 0x8D65; 73 static const uint32_t kGLTextureExternalOES = 0x8D65;
74 static const int kSDKVersionToSupportSecurityOriginCheck = 20; 74 static const int kSDKVersionToSupportSecurityOriginCheck = 20;
75 75
76 using blink::WebMediaPlayer; 76 using blink::WebMediaPlayer;
77 using blink::WebSize; 77 using blink::WebSize;
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 } 503 }
504 504
505 bool WebMediaPlayerAndroid::didLoadingProgress() { 505 bool WebMediaPlayerAndroid::didLoadingProgress() {
506 bool ret = did_loading_progress_; 506 bool ret = did_loading_progress_;
507 did_loading_progress_ = false; 507 did_loading_progress_ = false;
508 return ret; 508 return ret;
509 } 509 }
510 510
511 void WebMediaPlayerAndroid::paint(blink::WebCanvas* canvas, 511 void WebMediaPlayerAndroid::paint(blink::WebCanvas* canvas,
512 const blink::WebRect& rect, 512 const blink::WebRect& rect,
513 SkPaint& paint) { 513 cc::PaintFlags& paint) {
514 DCHECK(main_thread_checker_.CalledOnValidThread()); 514 DCHECK(main_thread_checker_.CalledOnValidThread());
515 std::unique_ptr<blink::WebGraphicsContext3DProvider> provider( 515 std::unique_ptr<blink::WebGraphicsContext3DProvider> provider(
516 blink::Platform::current() 516 blink::Platform::current()
517 ->createSharedOffscreenGraphicsContext3DProvider()); 517 ->createSharedOffscreenGraphicsContext3DProvider());
518 if (!provider) 518 if (!provider)
519 return; 519 return;
520 gpu::gles2::GLES2Interface* gl = provider->contextGL(); 520 gpu::gles2::GLES2Interface* gl = provider->contextGL();
521 521
522 scoped_refptr<VideoFrame> video_frame; 522 scoped_refptr<VideoFrame> video_frame;
523 { 523 {
(...skipping 27 matching lines...) Expand all
551 kOpaque_SkAlphaType)); 551 kOpaque_SkAlphaType));
552 if (!image) 552 if (!image)
553 return; 553 return;
554 554
555 // Draw the texture based image onto the Canvas. If the canvas is 555 // Draw the texture based image onto the Canvas. If the canvas is
556 // hardware based, this will do a GPU-GPU texture copy. 556 // hardware based, this will do a GPU-GPU texture copy.
557 // If the canvas is software based, the texture based bitmap will be 557 // If the canvas is software based, the texture based bitmap will be
558 // readbacked to system memory then draw onto the canvas. 558 // readbacked to system memory then draw onto the canvas.
559 SkRect dest; 559 SkRect dest;
560 dest.set(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height); 560 dest.set(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height);
561 SkPaint video_paint; 561 cc::PaintFlags video_paint;
562 video_paint.setAlpha(paint.getAlpha()); 562 video_paint.setAlpha(paint.getAlpha());
563 video_paint.setBlendMode(paint.getBlendMode()); 563 video_paint.setBlendMode(paint.getBlendMode());
564 // It is not necessary to pass the dest into the drawBitmap call since all 564 // It is not necessary to pass the dest into the drawBitmap call since all
565 // the context have been set up before calling paintCurrentFrameInContext. 565 // the context have been set up before calling paintCurrentFrameInContext.
566 canvas->drawImageRect(image, dest, &video_paint); 566 canvas->drawImageRect(image, dest, &video_paint);
567 567
568 // Ensure the Skia draw of the GL texture is flushed to GL, delete the 568 // Ensure the Skia draw of the GL texture is flushed to GL, delete the
569 // mailboxed texture from this context, and then signal that we're done with 569 // mailboxed texture from this context, and then signal that we're done with
570 // the video frame. 570 // the video frame.
571 canvas->flush(); 571 canvas->flush();
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 switches::kDisableMediaSuspend)) { 1339 switches::kDisableMediaSuspend)) {
1340 return false; 1340 return false;
1341 } 1341 }
1342 1342
1343 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) && 1343 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) &&
1344 hasAudio() && !isRemote() && delegate_ && delegate_->IsFrameHidden() && 1344 hasAudio() && !isRemote() && delegate_ && delegate_->IsFrameHidden() &&
1345 !delegate_->IsFrameClosed(); 1345 !delegate_->IsFrameClosed();
1346 } 1346 }
1347 1347
1348 } // namespace content 1348 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698