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 #include "gpu/gles2_conform_support/egl/display.h" | 5 #include "gpu/gles2_conform_support/egl/display.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
15 #include "gpu/command_buffer/client/gles2_implementation.h" | 15 #include "gpu/command_buffer/client/gles2_implementation.h" |
16 #include "gpu/command_buffer/client/gles2_lib.h" | 16 #include "gpu/command_buffer/client/gles2_lib.h" |
17 #include "gpu/command_buffer/client/transfer_buffer.h" | 17 #include "gpu/command_buffer/client/transfer_buffer.h" |
18 #include "gpu/command_buffer/common/value_state.h" | 18 #include "gpu/command_buffer/common/value_state.h" |
19 #include "gpu/command_buffer/service/context_group.h" | 19 #include "gpu/command_buffer/service/context_group.h" |
20 #include "gpu/command_buffer/service/mailbox_manager.h" | 20 #include "gpu/command_buffer/service/mailbox_manager.h" |
21 #include "gpu/command_buffer/service/memory_tracking.h" | 21 #include "gpu/command_buffer/service/memory_tracking.h" |
22 #include "gpu/command_buffer/service/transfer_buffer_manager.h" | 22 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
23 #include "gpu/command_buffer/service/valuebuffer_manager.h" | 23 #include "gpu/command_buffer/service/valuebuffer_manager.h" |
24 #include "gpu/gles2_conform_support/egl/config.h" | 24 #include "gpu/gles2_conform_support/egl/config.h" |
25 #include "gpu/gles2_conform_support/egl/surface.h" | 25 #include "gpu/gles2_conform_support/egl/surface.h" |
26 #include "gpu/gles2_conform_support/egl/test_support.h" | |
27 | 26 |
28 namespace { | 27 namespace { |
29 const int32_t kCommandBufferSize = 1024 * 1024; | 28 const int32_t kCommandBufferSize = 1024 * 1024; |
30 const int32_t kTransferBufferSize = 512 * 1024; | 29 const int32_t kTransferBufferSize = 512 * 1024; |
31 } | 30 } |
32 | 31 |
33 namespace egl { | 32 namespace egl { |
34 #if defined(COMMAND_BUFFER_GLES_LIB_SUPPORT_ONLY) | 33 #if defined(COMMAND_BUFFER_GLES_LIB_SUPPORT_ONLY) |
35 // egl::Display is used for comformance tests and command_buffer_gles. We only | 34 // egl::Display is used for comformance tests and command_buffer_gles. We only |
36 // need the exit manager for the command_buffer_gles library. | 35 // need the exit manager for the command_buffer_gles library. |
37 // TODO(hendrikw): Find a cleaner solution for this. | 36 // TODO(hendrikw): Find a cleaner solution for this. |
38 namespace { | 37 namespace { |
39 base::LazyInstance<base::Lock>::Leaky g_exit_manager_lock; | 38 base::LazyInstance<base::Lock>::Leaky g_exit_manager_lock; |
40 int g_exit_manager_use_count; | 39 int g_exit_manager_use_count; |
41 base::AtExitManager* g_exit_manager; | 40 base::AtExitManager* g_exit_manager; |
42 void RefAtExitManager() { | 41 void RefAtExitManager() { |
43 base::AutoLock lock(g_exit_manager_lock.Get()); | 42 base::AutoLock lock(g_exit_manager_lock.Get()); |
44 #if defined(COMPONENT_BUILD) | |
45 if (g_command_buffer_gles_has_atexit_manager) { | |
46 return; | |
47 } | |
48 #endif | |
49 if (g_exit_manager_use_count == 0) { | 43 if (g_exit_manager_use_count == 0) { |
50 g_exit_manager = new base::AtExitManager; | 44 g_exit_manager = new base::AtExitManager; |
51 } | 45 } |
52 ++g_exit_manager_use_count; | 46 ++g_exit_manager_use_count; |
53 } | 47 } |
54 void ReleaseAtExitManager() { | 48 void ReleaseAtExitManager() { |
55 base::AutoLock lock(g_exit_manager_lock.Get()); | 49 base::AutoLock lock(g_exit_manager_lock.Get()); |
56 #if defined(COMPONENT_BUILD) | |
57 if (g_command_buffer_gles_has_atexit_manager) { | |
58 return; | |
59 } | |
60 #endif | |
61 --g_exit_manager_use_count; | 50 --g_exit_manager_use_count; |
62 if (g_exit_manager_use_count == 0) { | 51 if (g_exit_manager_use_count == 0) { |
63 delete g_exit_manager; | 52 delete g_exit_manager; |
64 g_exit_manager = nullptr; | 53 g_exit_manager = nullptr; |
65 } | 54 } |
66 } | 55 } |
67 } | 56 } |
68 #endif | 57 #endif |
69 | 58 |
70 Display::Display(EGLNativeDisplayType display_id) | 59 Display::Display(EGLNativeDisplayType display_id) |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 void Display::SignalSyncToken(const gpu::SyncToken& sync_token, | 385 void Display::SignalSyncToken(const gpu::SyncToken& sync_token, |
397 const base::Closure& callback) { | 386 const base::Closure& callback) { |
398 NOTIMPLEMENTED(); | 387 NOTIMPLEMENTED(); |
399 } | 388 } |
400 | 389 |
401 bool Display::CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) { | 390 bool Display::CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) { |
402 return false; | 391 return false; |
403 } | 392 } |
404 | 393 |
405 } // namespace egl | 394 } // namespace egl |
OLD | NEW |