OLD | NEW |
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 // The bulk of this file is support code; sorry about that. Here's an overview | 5 // The bulk of this file is support code; sorry about that. Here's an overview |
6 // to hopefully help readers of this code: | 6 // to hopefully help readers of this code: |
7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or | 7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or |
8 // Win/EGL. | 8 // Win/EGL. |
9 // - ClientState is an enum for the state of the decode client used by the test. | 9 // - ClientState is an enum for the state of the decode client used by the test. |
10 // - ClientStateNotification is a barrier abstraction that allows the test code | 10 // - ClientStateNotification is a barrier abstraction that allows the test code |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 224 |
225 void SetUp() override { | 225 void SetUp() override { |
226 rendering_thread_.Start(); | 226 rendering_thread_.Start(); |
227 | 227 |
228 base::WaitableEvent done(false, false); | 228 base::WaitableEvent done(false, false); |
229 rendering_thread_.task_runner()->PostTask( | 229 rendering_thread_.task_runner()->PostTask( |
230 FROM_HERE, base::Bind(&RenderingHelper::InitializeOneOff, &done)); | 230 FROM_HERE, base::Bind(&RenderingHelper::InitializeOneOff, &done)); |
231 done.Wait(); | 231 done.Wait(); |
232 | 232 |
233 #if defined(USE_OZONE) | 233 #if defined(USE_OZONE) |
| 234 gpu_helper_.reset(new ui::OzoneGpuTestHelper()); |
234 // Need to initialize after the rendering side since the rendering side | 235 // Need to initialize after the rendering side since the rendering side |
235 // initializes the "GPU" parts of Ozone. | 236 // initializes the "GPU" parts of Ozone. |
236 // | 237 // |
237 // This also needs to be done in the test environment since this shouldn't | 238 // This also needs to be done in the test environment since this shouldn't |
238 // be initialized multiple times for the same Ozone platform. | 239 // be initialized multiple times for the same Ozone platform. |
239 gpu_helper_.Initialize(base::ThreadTaskRunnerHandle::Get(), | 240 gpu_helper_->Initialize(base::ThreadTaskRunnerHandle::Get(), |
240 GetRenderingTaskRunner()); | 241 GetRenderingTaskRunner()); |
241 #endif | 242 #endif |
242 } | 243 } |
243 | 244 |
244 void TearDown() override { rendering_thread_.Stop(); } | 245 void TearDown() override { |
| 246 #if defined(USE_OZONE) |
| 247 gpu_helper_.reset(); |
| 248 #endif |
| 249 rendering_thread_.Stop(); |
| 250 } |
245 | 251 |
246 scoped_refptr<base::SingleThreadTaskRunner> GetRenderingTaskRunner() const { | 252 scoped_refptr<base::SingleThreadTaskRunner> GetRenderingTaskRunner() const { |
247 return rendering_thread_.task_runner(); | 253 return rendering_thread_.task_runner(); |
248 } | 254 } |
249 | 255 |
250 private: | 256 private: |
251 base::Thread rendering_thread_; | 257 base::Thread rendering_thread_; |
252 #if defined(USE_OZONE) | 258 #if defined(USE_OZONE) |
253 ui::OzoneGpuTestHelper gpu_helper_; | 259 scoped_ptr<ui::OzoneGpuTestHelper> gpu_helper_; |
254 #endif | 260 #endif |
255 | 261 |
256 DISALLOW_COPY_AND_ASSIGN(VideoDecodeAcceleratorTestEnvironment); | 262 DISALLOW_COPY_AND_ASSIGN(VideoDecodeAcceleratorTestEnvironment); |
257 }; | 263 }; |
258 | 264 |
259 // A helper class used to manage the lifetime of a Texture. | 265 // A helper class used to manage the lifetime of a Texture. |
260 class TextureRef : public base::RefCounted<TextureRef> { | 266 class TextureRef : public base::RefCounted<TextureRef> { |
261 public: | 267 public: |
262 TextureRef(uint32 texture_id, const base::Closure& no_longer_needed_cb) | 268 TextureRef(uint32 texture_id, const base::Closure& no_longer_needed_cb) |
263 : texture_id_(texture_id), no_longer_needed_cb_(no_longer_needed_cb) {} | 269 : texture_id_(texture_id), no_longer_needed_cb_(no_longer_needed_cb) {} |
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 ui::OzonePlatform::InitializeForUI(); | 1636 ui::OzonePlatform::InitializeForUI(); |
1631 #endif | 1637 #endif |
1632 | 1638 |
1633 content::g_env = | 1639 content::g_env = |
1634 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( | 1640 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( |
1635 testing::AddGlobalTestEnvironment( | 1641 testing::AddGlobalTestEnvironment( |
1636 new content::VideoDecodeAcceleratorTestEnvironment())); | 1642 new content::VideoDecodeAcceleratorTestEnvironment())); |
1637 | 1643 |
1638 return RUN_ALL_TESTS(); | 1644 return RUN_ALL_TESTS(); |
1639 } | 1645 } |
OLD | NEW |