| 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" |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| 28 const int32_t kCommandBufferSize = 1024 * 1024; | 29 const int32_t kCommandBufferSize = 1024 * 1024; |
| 29 const int32_t kTransferBufferSize = 512 * 1024; | 30 const int32_t kTransferBufferSize = 512 * 1024; |
| 30 } | 31 } |
| 31 | 32 |
| 32 namespace egl { | 33 namespace egl { |
| 33 #if defined(COMMAND_BUFFER_GLES_LIB_SUPPORT_ONLY) | 34 #if defined(COMMAND_BUFFER_GLES_LIB_SUPPORT_ONLY) |
| 34 // egl::Display is used for comformance tests and command_buffer_gles. We only | 35 // egl::Display is used for comformance tests and command_buffer_gles. We only |
| 35 // need the exit manager for the command_buffer_gles library. | 36 // need the exit manager for the command_buffer_gles library. |
| 36 // TODO(hendrikw): Find a cleaner solution for this. | 37 // TODO(hendrikw): Find a cleaner solution for this. |
| 37 namespace { | 38 namespace { |
| 38 base::LazyInstance<base::Lock>::Leaky g_exit_manager_lock; | 39 base::LazyInstance<base::Lock>::Leaky g_exit_manager_lock; |
| 39 int g_exit_manager_use_count; | 40 int g_exit_manager_use_count; |
| 40 base::AtExitManager* g_exit_manager; | 41 base::AtExitManager* g_exit_manager; |
| 41 void RefAtExitManager() { | 42 void RefAtExitManager() { |
| 42 base::AutoLock lock(g_exit_manager_lock.Get()); | 43 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 |
| 43 if (g_exit_manager_use_count == 0) { | 49 if (g_exit_manager_use_count == 0) { |
| 44 g_exit_manager = new base::AtExitManager; | 50 g_exit_manager = new base::AtExitManager; |
| 45 } | 51 } |
| 46 ++g_exit_manager_use_count; | 52 ++g_exit_manager_use_count; |
| 47 } | 53 } |
| 48 void ReleaseAtExitManager() { | 54 void ReleaseAtExitManager() { |
| 49 base::AutoLock lock(g_exit_manager_lock.Get()); | 55 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 |
| 50 --g_exit_manager_use_count; | 61 --g_exit_manager_use_count; |
| 51 if (g_exit_manager_use_count == 0) { | 62 if (g_exit_manager_use_count == 0) { |
| 52 delete g_exit_manager; | 63 delete g_exit_manager; |
| 53 g_exit_manager = nullptr; | 64 g_exit_manager = nullptr; |
| 54 } | 65 } |
| 55 } | 66 } |
| 56 } | 67 } |
| 57 #endif | 68 #endif |
| 58 | 69 |
| 59 Display::Display(EGLNativeDisplayType display_id) | 70 Display::Display(EGLNativeDisplayType display_id) |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 void Display::SignalSyncToken(const gpu::SyncToken& sync_token, | 396 void Display::SignalSyncToken(const gpu::SyncToken& sync_token, |
| 386 const base::Closure& callback) { | 397 const base::Closure& callback) { |
| 387 NOTIMPLEMENTED(); | 398 NOTIMPLEMENTED(); |
| 388 } | 399 } |
| 389 | 400 |
| 390 bool Display::CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) { | 401 bool Display::CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) { |
| 391 return false; | 402 return false; |
| 392 } | 403 } |
| 393 | 404 |
| 394 } // namespace egl | 405 } // namespace egl |
| OLD | NEW |