diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-29 00:39:26 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-29 00:39:26 +0000 |
commit | 3b3c6445122bf8144b08c94c42db00f6079e4c77 (patch) | |
tree | 8483986e8a9b4696543b1606c8fa1f28745dbcf0 /mojo/public/cpp/utility/lib/thread_local_win.cc | |
parent | e97a6074124c0bbb4e57316e754b64e3eb0a8ee1 (diff) | |
download | chromium_src-3b3c6445122bf8144b08c94c42db00f6079e4c77.zip chromium_src-3b3c6445122bf8144b08c94c42db00f6079e4c77.tar.gz chromium_src-3b3c6445122bf8144b08c94c42db00f6079e4c77.tar.bz2 |
Mojo: Move mojo/public/utility to mojo/public/cpp/utility.
R=sky@chromium.org
Review URL: https://codereview.chromium.org/217443002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260324 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/public/cpp/utility/lib/thread_local_win.cc')
-rw-r--r-- | mojo/public/cpp/utility/lib/thread_local_win.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/mojo/public/cpp/utility/lib/thread_local_win.cc b/mojo/public/cpp/utility/lib/thread_local_win.cc new file mode 100644 index 0000000..98841f7 --- /dev/null +++ b/mojo/public/cpp/utility/lib/thread_local_win.cc @@ -0,0 +1,39 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/public/cpp/utility/lib/thread_local.h" + +#include <assert.h> +#include <windows.h> + +namespace mojo { +namespace internal { + +// static +void ThreadLocalPlatform::AllocateSlot(SlotType* slot) { + *slot = TlsAlloc(); + assert(*slot != TLS_OUT_OF_INDEXES); +} + +// static +void ThreadLocalPlatform::FreeSlot(SlotType slot) { + if (!TlsFree(slot)) { + assert(false); + } +} + +// static +void* ThreadLocalPlatform::GetValueFromSlot(SlotType slot) { + return TlsGetValue(slot); +} + +// static +void ThreadLocalPlatform::SetValueInSlot(SlotType slot, void* value) { + if (!TlsSetValue(slot, value)) { + assert(false); + } +} + +} // namespace internal +} // namespace mojo |