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

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

Issue 184743002: don't create SkDevice directly, use SkBitmap or (better) SkCanvas::NewRaster factory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert changes to media unittests til we understand valgrind errors Created 6 years, 9 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 | Annotate | Revision Log
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 "content/browser/gpu/compositor_util.h" 9 #include "content/browser/gpu/compositor_util.h"
10 #include "content/browser/gpu/gpu_data_manager_impl.h" 10 #include "content/browser/gpu/gpu_data_manager_impl.h"
11 #include "content/browser/renderer_host/dip_util.h" 11 #include "content/browser/renderer_host/dip_util.h"
12 #include "content/browser/renderer_host/render_widget_host_impl.h" 12 #include "content/browser/renderer_host/render_widget_host_impl.h"
13 #include "content/port/browser/render_widget_host_view_frame_subscriber.h" 13 #include "content/port/browser/render_widget_host_view_frame_subscriber.h"
14 #include "content/port/browser/render_widget_host_view_port.h" 14 #include "content/port/browser/render_widget_host_view_port.h"
15 #include "content/public/browser/gpu_data_manager.h" 15 #include "content/public/browser/gpu_data_manager.h"
16 #include "content/public/browser/render_view_host.h" 16 #include "content/public/browser/render_view_host.h"
17 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "content/public/common/content_paths.h" 18 #include "content/public/common/content_paths.h"
19 #include "content/public/common/content_switches.h" 19 #include "content/public/common/content_switches.h"
20 #include "content/public/common/url_constants.h" 20 #include "content/public/common/url_constants.h"
21 #include "content/public/test/browser_test_utils.h" 21 #include "content/public/test/browser_test_utils.h"
22 #include "content/shell/browser/shell.h" 22 #include "content/shell/browser/shell.h"
23 #include "content/test/content_browser_test.h" 23 #include "content/test/content_browser_test.h"
24 #include "content/test/content_browser_test_utils.h" 24 #include "content/test/content_browser_test_utils.h"
25 #include "media/base/video_frame.h" 25 #include "media/base/video_frame.h"
26 #include "media/filters/skcanvas_video_renderer.h" 26 #include "media/filters/skcanvas_video_renderer.h"
27 #include "net/base/net_util.h" 27 #include "net/base/net_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/SkBitmapDevice.h"
30 #include "third_party/skia/include/core/SkCanvas.h" 29 #include "third_party/skia/include/core/SkCanvas.h"
31 #include "ui/base/ui_base_switches.h" 30 #include "ui/base/ui_base_switches.h"
32 #include "ui/gfx/size_conversions.h" 31 #include "ui/gfx/size_conversions.h"
33 #include "ui/gfx/switches.h" 32 #include "ui/gfx/switches.h"
34 #include "ui/gl/gl_switches.h" 33 #include "ui/gl/gl_switches.h"
35 34
36 #if defined(OS_MACOSX) 35 #if defined(OS_MACOSX)
37 #include "ui/gl/io_surface_support_mac.h" 36 #include "ui/gl/io_surface_support_mac.h"
38 #endif 37 #endif
39 38
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 bool result) { 574 bool result) {
576 EXPECT_EQ(expected_copy_from_compositing_surface_result_, result); 575 EXPECT_EQ(expected_copy_from_compositing_surface_result_, result);
577 if (!result) { 576 if (!result) {
578 quit_callback.Run(); 577 quit_callback.Run();
579 return; 578 return;
580 } 579 }
581 580
582 media::SkCanvasVideoRenderer video_renderer; 581 media::SkCanvasVideoRenderer video_renderer;
583 582
584 SkBitmap bitmap; 583 SkBitmap bitmap;
585 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 584 bitmap.allocPixels(SkImageInfo::Make(video_frame->visible_rect().width(),
586 video_frame->visible_rect().width(), 585 video_frame->visible_rect().height(),
587 video_frame->visible_rect().height(), 586 kPMColor_SkColorType,
588 0, kOpaque_SkAlphaType); 587 kOpaque_SkAlphaType));
589 bitmap.allocPixels(); 588 bitmap.allocPixels();
590 589 SkCanvas canvas(bitmap);
591 SkBitmapDevice device(bitmap);
592 SkCanvas canvas(&device);
593 590
594 video_renderer.Paint(video_frame.get(), 591 video_renderer.Paint(video_frame.get(),
595 &canvas, 592 &canvas,
596 video_frame->visible_rect(), 593 video_frame->visible_rect(),
597 0xff); 594 0xff);
598 595
599 CopyFromCompositingSurfaceCallback(quit_callback, 596 CopyFromCompositingSurfaceCallback(quit_callback,
600 result, 597 result,
601 bitmap); 598 bitmap);
602 } 599 }
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 CompositingRenderWidgetHostViewBrowserTestTabCapture, 944 CompositingRenderWidgetHostViewBrowserTestTabCapture,
948 testing::ValuesIn(kAllCompositingModes)); 945 testing::ValuesIn(kAllCompositingModes));
949 INSTANTIATE_TEST_CASE_P(GLAndSoftwareCompositing, 946 INSTANTIATE_TEST_CASE_P(GLAndSoftwareCompositing,
950 CompositingRenderWidgetHostViewTabCaptureHighDPI, 947 CompositingRenderWidgetHostViewTabCaptureHighDPI,
951 testing::ValuesIn(kAllCompositingModes)); 948 testing::ValuesIn(kAllCompositingModes));
952 949
953 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) 950 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
954 951
955 } // namespace 952 } // namespace
956 } // namespace content 953 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/software_output_device_ozone.cc ('k') | content/renderer/skia_benchmarking_extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698