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

Side by Side Diff: components/display_compositor/gl_helper_benchmark.cc

Issue 2286873003: Provide TaskRunner to ContextCacheController (Closed)
Patch Set: feedback Created 4 years, 3 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) 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 // This file looks like a unit test, but it contains benchmarks and test 5 // This file looks like a unit test, but it contains benchmarks and test
6 // utilities intended for manual evaluation of the scalers in 6 // utilities intended for manual evaluation of the scalers in
7 // gl_helper*. These tests produce output in the form of files and printouts, 7 // gl_helper*. These tests produce output in the form of files and printouts,
8 // but cannot really "fail". There is no point in making these tests part 8 // but cannot really "fail". There is no point in making these tests part
9 // of any test automation run. 9 // of any test automation run.
10 10
11 #include <stddef.h> 11 #include <stddef.h>
12 #include <stdio.h> 12 #include <stdio.h>
13 #include <cmath> 13 #include <cmath>
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include <GLES2/gl2.h> 17 #include <GLES2/gl2.h>
18 #include <GLES2/gl2ext.h> 18 #include <GLES2/gl2ext.h>
19 #include <GLES2/gl2extchromium.h> 19 #include <GLES2/gl2extchromium.h>
20 20
21 #include "base/at_exit.h" 21 #include "base/at_exit.h"
22 #include "base/command_line.h" 22 #include "base/command_line.h"
23 #include "base/files/file_util.h" 23 #include "base/files/file_util.h"
24 #include "base/macros.h" 24 #include "base/macros.h"
25 #include "base/strings/stringprintf.h" 25 #include "base/strings/stringprintf.h"
26 #include "base/threading/thread_task_runner_handle.h"
26 #include "base/time/time.h" 27 #include "base/time/time.h"
27 #include "components/display_compositor/gl_helper.h" 28 #include "components/display_compositor/gl_helper.h"
28 #include "components/display_compositor/gl_helper_scaling.h" 29 #include "components/display_compositor/gl_helper_scaling.h"
29 #include "gpu/command_buffer/client/gl_in_process_context.h" 30 #include "gpu/command_buffer/client/gl_in_process_context.h"
30 #include "gpu/command_buffer/client/gles2_implementation.h" 31 #include "gpu/command_buffer/client/gles2_implementation.h"
31 #include "gpu/command_buffer/client/shared_memory_limits.h" 32 #include "gpu/command_buffer/client/shared_memory_limits.h"
32 #include "testing/gtest/include/gtest/gtest.h" 33 #include "testing/gtest/include/gtest/gtest.h"
33 #include "third_party/skia/include/core/SkBitmap.h" 34 #include "third_party/skia/include/core/SkBitmap.h"
34 #include "third_party/skia/include/core/SkTypes.h" 35 #include "third_party/skia/include/core/SkTypes.h"
35 #include "ui/gfx/codec/png_codec.h" 36 #include "ui/gfx/codec/png_codec.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 attributes.gpu_preference = gl::PreferDiscreteGpu; 68 attributes.gpu_preference = gl::PreferDiscreteGpu;
68 69
69 context_.reset(gpu::GLInProcessContext::Create( 70 context_.reset(gpu::GLInProcessContext::Create(
70 nullptr, /* service */ 71 nullptr, /* service */
71 nullptr, /* surface */ 72 nullptr, /* surface */
72 true, /* offscreen */ 73 true, /* offscreen */
73 gfx::kNullAcceleratedWidget, /* window */ 74 gfx::kNullAcceleratedWidget, /* window */
74 nullptr, /* share_context */ 75 nullptr, /* share_context */
75 attributes, gpu::SharedMemoryLimits(), 76 attributes, gpu::SharedMemoryLimits(),
76 nullptr, /* gpu_memory_buffer_manager */ 77 nullptr, /* gpu_memory_buffer_manager */
77 nullptr /* image_factory */)); 78 nullptr, /* image_factory */
79 base::ThreadTaskRunnerHandle::Get()));
78 gl_ = context_->GetImplementation(); 80 gl_ = context_->GetImplementation();
79 gpu::ContextSupport* support = context_->GetImplementation(); 81 gpu::ContextSupport* support = context_->GetImplementation();
80 82
81 helper_.reset(new display_compositor::GLHelper(gl_, support)); 83 helper_.reset(new display_compositor::GLHelper(gl_, support));
82 helper_scaling_.reset( 84 helper_scaling_.reset(
83 new display_compositor::GLHelperScaling(gl_, helper_.get())); 85 new display_compositor::GLHelperScaling(gl_, helper_.get()));
84 } 86 }
85 87
86 void TearDown() override { 88 void TearDown() override {
87 helper_scaling_.reset(NULL); 89 helper_scaling_.reset(NULL);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 kQualityNames[q], percents[p]); 245 kQualityNames[q], percents[p]);
244 VLOG(0) << "Writing " << filename; 246 VLOG(0) << "Writing " << filename;
245 SaveToFile(&output_pixels, base::FilePath::FromUTF8Unsafe(filename)); 247 SaveToFile(&output_pixels, base::FilePath::FromUTF8Unsafe(filename));
246 } 248 }
247 } 249 }
248 gl_->DeleteTextures(1, &src_texture); 250 gl_->DeleteTextures(1, &src_texture);
249 gl_->DeleteFramebuffers(1, &framebuffer); 251 gl_->DeleteFramebuffers(1, &framebuffer);
250 } 252 }
251 253
252 } // namespace display_compositor 254 } // namespace display_compositor
OLDNEW
« no previous file with comments | « cc/test/test_in_process_context_provider.cc ('k') | components/display_compositor/gl_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698