diff options
author | misterg <misterg@google.com> | 2018-10-24 21:02:11 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2018-10-26 18:19:51 (GMT) |
commit | a50e4f05b3d84c6a014c59a24263328242cc8236 (patch) | |
tree | 6b262d5156f04387467abbc48b4e5e98ec94e382 /googletest/src/gtest-port.cc | |
parent | 8ec8ce1c8a51076950bfa7a7886d95f4c8aed11b (diff) | |
download | googletest-a50e4f05b3d84c6a014c59a24263328242cc8236.zip googletest-a50e4f05b3d84c6a014c59a24263328242cc8236.tar.gz googletest-a50e4f05b3d84c6a014c59a24263328242cc8236.tar.bz2 |
Googletest export
Remove linked_ptr and use std::shared_ptr instead
PiperOrigin-RevId: 218571466
Diffstat (limited to 'googletest/src/gtest-port.cc')
-rw-r--r-- | googletest/src/gtest-port.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index aa98ddb..082aaff 100644 --- a/googletest/src/gtest-port.cc +++ b/googletest/src/gtest-port.cc @@ -31,10 +31,11 @@ #include "gtest/internal/gtest-port.h" #include <limits.h> -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <fstream> +#include <memory> #if GTEST_OS_WINDOWS # include <windows.h> @@ -475,7 +476,7 @@ class ThreadLocalRegistryImpl { thread_local_values .insert(std::make_pair( thread_local_instance, - linked_ptr<ThreadLocalValueHolderBase>( + std::shared_ptr<ThreadLocalValueHolderBase>( thread_local_instance->NewValueForCurrentThread()))) .first; } @@ -484,7 +485,7 @@ class ThreadLocalRegistryImpl { static void OnThreadLocalDestroyed( const ThreadLocalBase* thread_local_instance) { - std::vector<linked_ptr<ThreadLocalValueHolderBase> > value_holders; + std::vector<std::shared_ptr<ThreadLocalValueHolderBase> > value_holders; // Clean up the ThreadLocalValues data structure while holding the lock, but // defer the destruction of the ThreadLocalValueHolderBases. { @@ -512,7 +513,7 @@ class ThreadLocalRegistryImpl { static void OnThreadExit(DWORD thread_id) { GTEST_CHECK_(thread_id != 0) << ::GetLastError(); - std::vector<linked_ptr<ThreadLocalValueHolderBase> > value_holders; + std::vector<std::shared_ptr<ThreadLocalValueHolderBase> > value_holders; // Clean up the ThreadIdToThreadLocals data structure while holding the // lock, but defer the destruction of the ThreadLocalValueHolderBases. { @@ -539,7 +540,8 @@ class ThreadLocalRegistryImpl { private: // In a particular thread, maps a ThreadLocal object to its value. typedef std::map<const ThreadLocalBase*, - linked_ptr<ThreadLocalValueHolderBase> > ThreadLocalValues; + std::shared_ptr<ThreadLocalValueHolderBase> > + ThreadLocalValues; // Stores all ThreadIdToThreadLocals having values in a thread, indexed by // thread's ID. typedef std::map<DWORD, ThreadLocalValues> ThreadIdToThreadLocals; |