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

Side by Side Diff: cc/test/pixel_test.cc

Issue 135213003: Ensure GL initialization only happens once, and provide common init path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initgl: compile3 Created 6 years, 10 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
« no previous file with comments | « cc/test/layer_tree_pixel_test.cc ('k') | chrome/browser/media/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "cc/test/pixel_test.h" 5 #include "cc/test/pixel_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "cc/base/switches.h" 10 #include "cc/base/switches.h"
11 #include "cc/output/compositor_frame_metadata.h" 11 #include "cc/output/compositor_frame_metadata.h"
12 #include "cc/output/copy_output_request.h" 12 #include "cc/output/copy_output_request.h"
13 #include "cc/output/copy_output_result.h" 13 #include "cc/output/copy_output_result.h"
14 #include "cc/output/gl_renderer.h" 14 #include "cc/output/gl_renderer.h"
15 #include "cc/output/output_surface_client.h" 15 #include "cc/output/output_surface_client.h"
16 #include "cc/output/software_renderer.h" 16 #include "cc/output/software_renderer.h"
17 #include "cc/resources/resource_provider.h" 17 #include "cc/resources/resource_provider.h"
18 #include "cc/resources/texture_mailbox_deleter.h" 18 #include "cc/resources/texture_mailbox_deleter.h"
19 #include "cc/test/fake_output_surface_client.h" 19 #include "cc/test/fake_output_surface_client.h"
20 #include "cc/test/paths.h" 20 #include "cc/test/paths.h"
21 #include "cc/test/pixel_test_output_surface.h" 21 #include "cc/test/pixel_test_output_surface.h"
22 #include "cc/test/pixel_test_software_output_device.h" 22 #include "cc/test/pixel_test_software_output_device.h"
23 #include "cc/test/pixel_test_utils.h" 23 #include "cc/test/pixel_test_utils.h"
24 #include "cc/test/test_in_process_context_provider.h" 24 #include "cc/test/test_in_process_context_provider.h"
25 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
26 #include "ui/gl/gl_implementation.h"
27 26
28 namespace cc { 27 namespace cc {
29 28
30 PixelTest::PixelTest() 29 PixelTest::PixelTest()
31 : device_viewport_size_(gfx::Size(200, 200)), 30 : device_viewport_size_(gfx::Size(200, 200)),
32 disable_picture_quad_image_filtering_(false), 31 disable_picture_quad_image_filtering_(false),
33 output_surface_client_(new FakeOutputSurfaceClient) {} 32 output_surface_client_(new FakeOutputSurfaceClient) {}
34 33
35 PixelTest::~PixelTest() {} 34 PixelTest::~PixelTest() {}
36 35
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 110
112 CommandLine* cmd = CommandLine::ForCurrentProcess(); 111 CommandLine* cmd = CommandLine::ForCurrentProcess();
113 if (cmd->HasSwitch(switches::kCCRebaselinePixeltests)) 112 if (cmd->HasSwitch(switches::kCCRebaselinePixeltests))
114 return WritePNGFile(*result_bitmap_, test_data_dir.Append(ref_file), true); 113 return WritePNGFile(*result_bitmap_, test_data_dir.Append(ref_file), true);
115 114
116 return MatchesPNGFile( 115 return MatchesPNGFile(
117 *result_bitmap_, test_data_dir.Append(ref_file), comparator); 116 *result_bitmap_, test_data_dir.Append(ref_file), comparator);
118 } 117 }
119 118
120 void PixelTest::SetUpGLRenderer(bool use_skia_gpu_backend) { 119 void PixelTest::SetUpGLRenderer(bool use_skia_gpu_backend) {
121 CHECK(gfx::InitializeStaticGLBindings(gfx::kGLImplementationOSMesaGL));
122
123 output_surface_.reset( 120 output_surface_.reset(
124 new PixelTestOutputSurface(new TestInProcessContextProvider)); 121 new PixelTestOutputSurface(new TestInProcessContextProvider));
125 output_surface_->BindToClient(output_surface_client_.get()); 122 output_surface_->BindToClient(output_surface_client_.get());
126 123
127 resource_provider_ = 124 resource_provider_ =
128 ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1); 125 ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1);
129 126
130 texture_mailbox_deleter_ = make_scoped_ptr(new TextureMailboxDeleter); 127 texture_mailbox_deleter_ = make_scoped_ptr(new TextureMailboxDeleter);
131 128
132 renderer_ = GLRenderer::Create(this, 129 renderer_ = GLRenderer::Create(this,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 output_surface_.reset(new PixelTestOutputSurface(device.Pass())); 162 output_surface_.reset(new PixelTestOutputSurface(device.Pass()));
166 output_surface_->BindToClient(output_surface_client_.get()); 163 output_surface_->BindToClient(output_surface_client_.get());
167 resource_provider_ = 164 resource_provider_ =
168 ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1); 165 ResourceProvider::Create(output_surface_.get(), NULL, 0, false, 1);
169 renderer_ = SoftwareRenderer::Create( 166 renderer_ = SoftwareRenderer::Create(
170 this, &settings_, output_surface_.get(), resource_provider_.get()) 167 this, &settings_, output_surface_.get(), resource_provider_.get())
171 .PassAs<DirectRenderer>(); 168 .PassAs<DirectRenderer>();
172 } 169 }
173 170
174 } // namespace cc 171 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_pixel_test.cc ('k') | chrome/browser/media/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698