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

Side by Side Diff: mojo/public/cpp/bindings/lib/sync_call_restrictions.cc

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: l10n again Created 3 years, 9 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 | « mojo/public/cpp/bindings/lib/message.cc ('k') | net/base/mime_util.cc » ('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 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 "mojo/public/cpp/bindings/sync_call_restrictions.h" 5 #include "mojo/public/cpp/bindings/sync_call_restrictions.h"
6 6
7 #if ENABLE_SYNC_CALL_RESTRICTIONS 7 #if ENABLE_SYNC_CALL_RESTRICTIONS
8 8
9 #include "base/debug/leak_annotations.h" 9 #include "base/debug/leak_annotations.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 32
33 private: 33 private:
34 SyncCallSettings(); 34 SyncCallSettings();
35 ~SyncCallSettings(); 35 ~SyncCallSettings();
36 36
37 bool system_defined_value_ = true; 37 bool system_defined_value_ = true;
38 size_t scoped_allow_count_ = 0; 38 size_t scoped_allow_count_ = 0;
39 }; 39 };
40 40
41 base::LazyInstance<base::ThreadLocalPointer<SyncCallSettings>> 41 base::LazyInstance<base::ThreadLocalPointer<SyncCallSettings>>::DestructorAtExit
42 g_sync_call_settings = LAZY_INSTANCE_INITIALIZER; 42 g_sync_call_settings = LAZY_INSTANCE_INITIALIZER;
43 43
44 // static 44 // static
45 SyncCallSettings* SyncCallSettings::current() { 45 SyncCallSettings* SyncCallSettings::current() {
46 SyncCallSettings* result = g_sync_call_settings.Pointer()->Get(); 46 SyncCallSettings* result = g_sync_call_settings.Pointer()->Get();
47 if (!result) { 47 if (!result) {
48 result = new SyncCallSettings(); 48 result = new SyncCallSettings();
49 ANNOTATE_LEAKING_OBJECT_PTR(result); 49 ANNOTATE_LEAKING_OBJECT_PTR(result);
50 DCHECK_EQ(result, g_sync_call_settings.Pointer()->Get()); 50 DCHECK_EQ(result, g_sync_call_settings.Pointer()->Get());
51 } 51 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 85
86 // static 86 // static
87 void SyncCallRestrictions::DecreaseScopedAllowCount() { 87 void SyncCallRestrictions::DecreaseScopedAllowCount() {
88 SyncCallSettings::current()->DecreaseScopedAllowCount(); 88 SyncCallSettings::current()->DecreaseScopedAllowCount();
89 } 89 }
90 90
91 } // namespace mojo 91 } // namespace mojo
92 92
93 #endif // ENABLE_SYNC_CALL_RESTRICTIONS 93 #endif // ENABLE_SYNC_CALL_RESTRICTIONS
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/message.cc ('k') | net/base/mime_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698