diff options
author | Bo Yang <teboring@google.com> | 2015-04-24 15:34:40 -0700 |
---|---|---|
committer | Bo Yang <teboring@google.com> | 2015-04-24 18:09:55 -0700 |
commit | d6c9f644ac62ec83196a75a47655a33a87875628 (patch) | |
tree | 742b0ab947ca26d5896c97e5909ca344bcc3ce3a /src/google/protobuf/arena.cc | |
parent | fe7b5667eb446766a1c2f30c691662a36f3df1f8 (diff) |
internal changes
Change-Id: I66f216c70a19f44637090878d7e442d4d0f8991b
Diffstat (limited to 'src/google/protobuf/arena.cc')
-rwxr-xr-x | src/google/protobuf/arena.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/google/protobuf/arena.cc b/src/google/protobuf/arena.cc index bda37413..f7059d26 100755 --- a/src/google/protobuf/arena.cc +++ b/src/google/protobuf/arena.cc @@ -29,6 +29,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <google/protobuf/arena.h> +#include <google/protobuf/stubs/common.h> #ifdef ADDRESS_SANITIZER #include <sanitizer/asan_interface.h> @@ -43,6 +44,12 @@ Arena::ThreadCache& Arena::thread_cache() { static GOOGLE_THREAD_LOCAL ThreadCache thread_cache_ = { -1, NULL }; return thread_cache_; } +#elif defined(GOOGLE_PROTOBUF_OS_ANDROID) || defined(GOOGLE_PROTOBUF_OS_IPHONE) +Arena::ThreadCache& Arena::thread_cache() { + static internal::ThreadLocalStorage<ThreadCache>* thread_cache_ = + new internal::ThreadLocalStorage<ThreadCache>(); + return *thread_cache_->Get(); +} #else GOOGLE_THREAD_LOCAL Arena::ThreadCache Arena::thread_cache_ = { -1, NULL }; #endif |