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

Side by Side Diff: third_party/WebKit/Source/wtf/ThreadSpecific.h

Issue 2309153002: Remove RenderThreadImpl::Shutdown (Closed)
Patch Set: temp Created 3 years, 11 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 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Jian Li <jianli@chromium.org> 3 * Copyright (C) 2009 Jian Li <jianli@chromium.org>
4 * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com> 4 * Copyright (C) 2012 Patrick Gansterer <paroga@paroga.com>
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 data->destructor = &ThreadSpecific<T>::destroy; 217 data->destructor = &ThreadSpecific<T>::destroy;
218 TlsSetValue(tlsKeys()[m_index], data); 218 TlsSetValue(tlsKeys()[m_index], data);
219 } 219 }
220 220
221 #else 221 #else
222 #error ThreadSpecific is not implemented for this platform. 222 #error ThreadSpecific is not implemented for this platform.
223 #endif 223 #endif
224 224
225 template <typename T> 225 template <typename T>
226 inline void ThreadSpecific<T>::destroy(void* ptr) { 226 inline void ThreadSpecific<T>::destroy(void* ptr) {
227 if (isShutdown()) 227 // Never call destructors on the main thread.
228 // This is fine because Blink no longer has a graceful shutdown sequence.
229 if (isMainThread())
228 return; 230 return;
229 231
230 Data* data = static_cast<Data*>(ptr); 232 Data* data = static_cast<Data*>(ptr);
231 233
232 #if OS(POSIX) 234 #if OS(POSIX)
233 // We want get() to keep working while data destructor works, because it can 235 // We want get() to keep working while data destructor works, because it can
234 // be called indirectly by the destructor. Some pthreads implementations 236 // be called indirectly by the destructor. Some pthreads implementations
235 // zero out the pointer before calling destroy(), so we temporarily reset it. 237 // zero out the pointer before calling destroy(), so we temporarily reset it.
236 pthread_setspecific(data->owner->m_key, ptr); 238 pthread_setspecific(data->owner->m_key, ptr);
237 #endif 239 #endif
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 template <typename T> 280 template <typename T>
279 inline T& ThreadSpecific<T>::operator*() { 281 inline T& ThreadSpecific<T>::operator*() {
280 return *operator T*(); 282 return *operator T*();
281 } 283 }
282 284
283 } // namespace WTF 285 } // namespace WTF
284 286
285 using WTF::ThreadSpecific; 287 using WTF::ThreadSpecific;
286 288
287 #endif // WTF_ThreadSpecific_h 289 #endif // WTF_ThreadSpecific_h
OLDNEW
« content/renderer/render_thread_impl.cc ('K') | « content/renderer/render_thread_impl_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698