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

Side by Side Diff: base/at_exit.cc

Issue 1640243002: command_buffer_gles2: Add test command_buffer_gles2_test for command_buffer_gles2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | build/all.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/at_exit.h" 5 #include "base/at_exit.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <ostream> 8 #include <ostream>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 13
14 namespace base { 14 namespace base {
15 15
16 // Keep a stack of registered AtExitManagers. We always operate on the most 16 // Keep a stack of registered AtExitManagers. We always operate on the most
17 // recent, and we should never have more than one outside of testing (for a 17 // recent, and we should never have more than one outside of testing (for a
18 // statically linked version of this library). Testing may use the shadow 18 // statically linked version of this library). Testing may use the shadow
19 // version of the constructor, and if we are building a dynamic library we may 19 // version of the constructor, and if we are building a dynamic library we may
20 // end up with multiple AtExitManagers on the same process. We don't protect 20 // end up with multiple AtExitManagers on the same process. We don't protect
21 // this for thread-safe access, since it will only be modified in testing. 21 // this for thread-safe access, since it will only be modified in testing.
22 static AtExitManager* g_top_manager = NULL; 22 static AtExitManager* g_top_manager = NULL;
23 23
24 AtExitManager::AtExitManager() : next_manager_(g_top_manager) { 24 AtExitManager::AtExitManager() : next_manager_(g_top_manager) {
25 // If multiple modules instantiate AtExitManagers they'll end up living in this 25 // If multiple modules instantiate AtExitManagers they'll end up living in this
26 // module... they have to coexist. 26 // module... they have to coexist.
27 #if !defined(COMPONENT_BUILD) 27 #if !defined(COMPONENT_BUILD) && !defined(COMMAND_BUFFER_GLES_LIB_SUPPORT_ONLY)
Nico 2016/02/01 19:15:37 having base know about some gpu define seems wrong
28 DCHECK(!g_top_manager); 28 DCHECK(!g_top_manager);
29 #endif 29 #endif
30 g_top_manager = this; 30 g_top_manager = this;
31 } 31 }
32 32
33 AtExitManager::~AtExitManager() { 33 AtExitManager::~AtExitManager() {
34 if (!g_top_manager) { 34 if (!g_top_manager) {
35 NOTREACHED() << "Tried to ~AtExitManager without an AtExitManager"; 35 NOTREACHED() << "Tried to ~AtExitManager without an AtExitManager";
36 return; 36 return;
37 } 37 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 g_top_manager->stack_.pop(); 73 g_top_manager->stack_.pop();
74 } 74 }
75 } 75 }
76 76
77 AtExitManager::AtExitManager(bool shadow) : next_manager_(g_top_manager) { 77 AtExitManager::AtExitManager(bool shadow) : next_manager_(g_top_manager) {
78 DCHECK(shadow || !g_top_manager); 78 DCHECK(shadow || !g_top_manager);
79 g_top_manager = this; 79 g_top_manager = this;
80 } 80 }
81 81
82 } // namespace base 82 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | build/all.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698