OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <cmath> | 9 #include <cmath> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include <GLES2/gl2.h> | 13 #include <GLES2/gl2.h> |
14 #include <GLES2/gl2ext.h> | 14 #include <GLES2/gl2ext.h> |
15 #include <GLES2/gl2extchromium.h> | 15 #include <GLES2/gl2extchromium.h> |
16 | 16 |
17 #include "base/at_exit.h" | 17 #include "base/at_exit.h" |
18 #include "base/bind.h" | 18 #include "base/bind.h" |
19 #include "base/command_line.h" | 19 #include "base/command_line.h" |
20 #include "base/files/file_util.h" | 20 #include "base/files/file_util.h" |
21 #include "base/json/json_reader.h" | 21 #include "base/json/json_reader.h" |
22 #include "base/macros.h" | 22 #include "base/macros.h" |
23 #include "base/memory/ref_counted_memory.h" | 23 #include "base/memory/ref_counted_memory.h" |
24 #include "base/message_loop/message_loop.h" | 24 #include "base/message_loop/message_loop.h" |
25 #include "base/run_loop.h" | 25 #include "base/run_loop.h" |
26 #include "base/strings/stringprintf.h" | 26 #include "base/strings/stringprintf.h" |
27 #include "base/synchronization/waitable_event.h" | 27 #include "base/synchronization/waitable_event.h" |
28 #include "base/test/launcher/unit_test_launcher.h" | 28 #include "base/test/launcher/unit_test_launcher.h" |
29 #include "base/test/test_suite.h" | 29 #include "base/test/test_suite.h" |
| 30 #include "base/threading/thread_task_runner_handle.h" |
30 #include "base/time/time.h" | 31 #include "base/time/time.h" |
31 #include "base/trace_event/trace_event.h" | 32 #include "base/trace_event/trace_event.h" |
32 #include "components/display_compositor/gl_helper.h" | 33 #include "components/display_compositor/gl_helper.h" |
33 #include "components/display_compositor/gl_helper_readback_support.h" | 34 #include "components/display_compositor/gl_helper_readback_support.h" |
34 #include "components/display_compositor/gl_helper_scaling.h" | 35 #include "components/display_compositor/gl_helper_scaling.h" |
35 #include "gpu/command_buffer/client/gl_in_process_context.h" | 36 #include "gpu/command_buffer/client/gl_in_process_context.h" |
36 #include "gpu/command_buffer/client/gles2_implementation.h" | 37 #include "gpu/command_buffer/client/gles2_implementation.h" |
37 #include "gpu/command_buffer/client/shared_memory_limits.h" | 38 #include "gpu/command_buffer/client/shared_memory_limits.h" |
38 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
39 #include "third_party/skia/include/core/SkBitmap.h" | 40 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 27 matching lines...) Expand all Loading... |
67 attributes.bind_generates_resource = false; | 68 attributes.bind_generates_resource = false; |
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(nullptr); | 89 helper_scaling_.reset(nullptr); |
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 } | 1428 } |
1427 } | 1429 } |
1428 } | 1430 } |
1429 | 1431 |
1430 TEST_F(GLHelperTest, CheckOptimizations) { | 1432 TEST_F(GLHelperTest, CheckOptimizations) { |
1431 // Test in baseclass since it is friends with GLHelperScaling | 1433 // Test in baseclass since it is friends with GLHelperScaling |
1432 CheckOptimizationsTest(); | 1434 CheckOptimizationsTest(); |
1433 } | 1435 } |
1434 | 1436 |
1435 } // namespace display_compositor | 1437 } // namespace display_compositor |
OLD | NEW |