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

Side by Side Diff: ui/events/keycodes/platform_key_map_win.cc

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: . 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
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/events/keycodes/platform_key_map_win.h" 5 #include "ui/events/keycodes/platform_key_map_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 255
256 return DomKey::NONE; 256 return DomKey::NONE;
257 } 257 }
258 258
259 void CleanupKeyMapTls(void* data) { 259 void CleanupKeyMapTls(void* data) {
260 PlatformKeyMap* key_map = reinterpret_cast<PlatformKeyMap*>(data); 260 PlatformKeyMap* key_map = reinterpret_cast<PlatformKeyMap*>(data);
261 delete key_map; 261 delete key_map;
262 } 262 }
263 263
264 struct PlatformKeyMapInstanceTlsTraits 264 struct PlatformKeyMapInstanceTlsTraits
265 : public base::DefaultLazyInstanceTraits<base::ThreadLocalStorage::Slot> { 265 : public base::LazyInstanceTraitsBase<base::ThreadLocalStorage::Slot> {
Nico 2017/03/07 21:43:02 same question as the other "wait" comment
scottmg 2017/03/07 21:56:30 Done.
266 static base::ThreadLocalStorage::Slot* New(void* instance) { 266 static base::ThreadLocalStorage::Slot* New(void* instance) {
267 // Use placement new to initialize our instance in our preallocated space. 267 // Use placement new to initialize our instance in our preallocated space.
268 // TODO(chongz): Use std::default_delete instead of providing own function. 268 // TODO(chongz): Use std::default_delete instead of providing own function.
269 return new (instance) base::ThreadLocalStorage::Slot(CleanupKeyMapTls); 269 return new (instance) base::ThreadLocalStorage::Slot(CleanupKeyMapTls);
270 } 270 }
271 }; 271 };
272 272
273 base::LazyInstance<base::ThreadLocalStorage::Slot, 273 base::LazyInstance<base::ThreadLocalStorage::Slot,
274 PlatformKeyMapInstanceTlsTraits> 274 PlatformKeyMapInstanceTlsTraits>
275 g_platform_key_map_tls_lazy = LAZY_INSTANCE_INITIALIZER; 275 g_platform_key_map_tls_lazy = LAZY_INSTANCE_INITIALIZER;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 } 402 }
403 } else { 403 } else {
404 // TODO(chongz): Handle rv <= -2 and rv >= 2. 404 // TODO(chongz): Handle rv <= -2 and rv >= 2.
405 } 405 }
406 } 406 }
407 } 407 }
408 ::SetKeyboardState(keyboard_state_to_restore); 408 ::SetKeyboardState(keyboard_state_to_restore);
409 } 409 }
410 410
411 } // namespace ui 411 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698