| OLD | NEW |
| 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 Loading... |
| 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::internal::DestructorAtExitLazyInstanceTraits< |
| 266 base::ThreadLocalStorage::Slot> { |
| 266 static base::ThreadLocalStorage::Slot* New(void* instance) { | 267 static base::ThreadLocalStorage::Slot* New(void* instance) { |
| 267 // Use placement new to initialize our instance in our preallocated space. | 268 // Use placement new to initialize our instance in our preallocated space. |
| 268 // TODO(chongz): Use std::default_delete instead of providing own function. | 269 // TODO(chongz): Use std::default_delete instead of providing own function. |
| 269 return new (instance) base::ThreadLocalStorage::Slot(CleanupKeyMapTls); | 270 return new (instance) base::ThreadLocalStorage::Slot(CleanupKeyMapTls); |
| 270 } | 271 } |
| 271 }; | 272 }; |
| 272 | 273 |
| 273 base::LazyInstance<base::ThreadLocalStorage::Slot, | 274 base::LazyInstance<base::ThreadLocalStorage::Slot, |
| 274 PlatformKeyMapInstanceTlsTraits> | 275 PlatformKeyMapInstanceTlsTraits> |
| 275 g_platform_key_map_tls_lazy = LAZY_INSTANCE_INITIALIZER; | 276 g_platform_key_map_tls_lazy = LAZY_INSTANCE_INITIALIZER; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 } | 403 } |
| 403 } else { | 404 } else { |
| 404 // TODO(chongz): Handle rv <= -2 and rv >= 2. | 405 // TODO(chongz): Handle rv <= -2 and rv >= 2. |
| 405 } | 406 } |
| 406 } | 407 } |
| 407 } | 408 } |
| 408 ::SetKeyboardState(keyboard_state_to_restore); | 409 ::SetKeyboardState(keyboard_state_to_restore); |
| 409 } | 410 } |
| 410 | 411 |
| 411 } // namespace ui | 412 } // namespace ui |
| OLD | NEW |