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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_browsertest.cc

Issue 445013002: media: Optimize HW Video to 2D Canvas copy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/message_loop/message_loop_proxy.h" 6 #include "base/message_loop/message_loop_proxy.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "cc/resources/media/skcanvas_video_renderer.h"
9 #include "content/browser/gpu/compositor_util.h" 10 #include "content/browser/gpu/compositor_util.h"
10 #include "content/browser/gpu/gpu_data_manager_impl.h" 11 #include "content/browser/gpu/gpu_data_manager_impl.h"
11 #include "content/browser/renderer_host/dip_util.h" 12 #include "content/browser/renderer_host/dip_util.h"
12 #include "content/browser/renderer_host/render_widget_host_impl.h" 13 #include "content/browser/renderer_host/render_widget_host_impl.h"
13 #include "content/browser/renderer_host/render_widget_host_view_base.h" 14 #include "content/browser/renderer_host/render_widget_host_view_base.h"
14 #include "content/public/browser/gpu_data_manager.h" 15 #include "content/public/browser/gpu_data_manager.h"
15 #include "content/public/browser/render_view_host.h" 16 #include "content/public/browser/render_view_host.h"
16 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" 17 #include "content/public/browser/render_widget_host_view_frame_subscriber.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
18 #include "content/public/common/content_paths.h" 19 #include "content/public/common/content_paths.h"
19 #include "content/public/common/content_switches.h" 20 #include "content/public/common/content_switches.h"
20 #include "content/public/common/url_constants.h" 21 #include "content/public/common/url_constants.h"
21 #include "content/public/test/browser_test_utils.h" 22 #include "content/public/test/browser_test_utils.h"
22 #include "content/public/test/content_browser_test.h" 23 #include "content/public/test/content_browser_test.h"
23 #include "content/public/test/content_browser_test_utils.h" 24 #include "content/public/test/content_browser_test_utils.h"
24 #include "content/shell/browser/shell.h" 25 #include "content/shell/browser/shell.h"
25 #include "media/base/video_frame.h" 26 #include "media/base/video_frame.h"
26 #include "media/filters/skcanvas_video_renderer.h"
27 #include "net/base/filename_util.h" 27 #include "net/base/filename_util.h"
28 #include "third_party/skia/include/core/SkBitmap.h" 28 #include "third_party/skia/include/core/SkBitmap.h"
29 #include "third_party/skia/include/core/SkCanvas.h" 29 #include "third_party/skia/include/core/SkCanvas.h"
30 #include "ui/base/layout.h" 30 #include "ui/base/layout.h"
31 #include "ui/base/ui_base_switches.h" 31 #include "ui/base/ui_base_switches.h"
32 #include "ui/gfx/size_conversions.h" 32 #include "ui/gfx/size_conversions.h"
33 #include "ui/gfx/switches.h" 33 #include "ui/gfx/switches.h"
34 #include "ui/gl/gl_switches.h" 34 #include "ui/gl/gl_switches.h"
35 35
36 #if defined(OS_WIN) 36 #if defined(OS_WIN)
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 void CopyFromCompositingSurfaceCallbackForVideo( 479 void CopyFromCompositingSurfaceCallbackForVideo(
480 scoped_refptr<media::VideoFrame> video_frame, 480 scoped_refptr<media::VideoFrame> video_frame,
481 base::Closure quit_callback, 481 base::Closure quit_callback,
482 bool result) { 482 bool result) {
483 EXPECT_EQ(expected_copy_from_compositing_surface_result_, result); 483 EXPECT_EQ(expected_copy_from_compositing_surface_result_, result);
484 if (!result) { 484 if (!result) {
485 quit_callback.Run(); 485 quit_callback.Run();
486 return; 486 return;
487 } 487 }
488 488
489 media::SkCanvasVideoRenderer video_renderer; 489 cc::SkCanvasVideoRenderer video_renderer;
490 490
491 SkBitmap bitmap; 491 SkBitmap bitmap;
492 bitmap.allocN32Pixels(video_frame->visible_rect().width(), 492 bitmap.allocN32Pixels(video_frame->visible_rect().width(),
493 video_frame->visible_rect().height()); 493 video_frame->visible_rect().height());
494 bitmap.eraseColor(SK_ColorTRANSPARENT); 494 bitmap.eraseColor(SK_ColorTRANSPARENT);
495 SkCanvas canvas(bitmap); 495 SkCanvas canvas(bitmap);
496 496
497 video_renderer.Paint(video_frame.get(), 497 video_renderer.Paint(video_frame.get(),
498 &canvas, 498 &canvas,
499 video_frame->visible_rect(), 499 video_frame->visible_rect(),
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 CompositingRenderWidgetHostViewBrowserTestTabCapture, 854 CompositingRenderWidgetHostViewBrowserTestTabCapture,
855 testing::ValuesIn(kAllCompositingModes)); 855 testing::ValuesIn(kAllCompositingModes));
856 INSTANTIATE_TEST_CASE_P(GLAndSoftwareCompositing, 856 INSTANTIATE_TEST_CASE_P(GLAndSoftwareCompositing,
857 CompositingRenderWidgetHostViewTabCaptureHighDPI, 857 CompositingRenderWidgetHostViewTabCaptureHighDPI,
858 testing::ValuesIn(kAllCompositingModes)); 858 testing::ValuesIn(kAllCompositingModes));
859 859
860 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) 860 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
861 861
862 } // namespace 862 } // namespace
863 } // namespace content 863 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698