diff options
author | evanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-20 21:47:40 +0000 |
---|---|---|
committer | evanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-20 21:47:40 +0000 |
commit | c3ec35638ea6594b6bdbac7ff92c38add8984623 (patch) | |
tree | c51541ac2451e66c410b3d244e1f59ac2218c57e /chrome/renderer | |
parent | e537c3515e270527ba2fa54fcfc4a1ed49cc975e (diff) | |
download | chromium_src-c3ec35638ea6594b6bdbac7ff92c38add8984623.zip chromium_src-c3ec35638ea6594b6bdbac7ff92c38add8984623.tar.gz chromium_src-c3ec35638ea6594b6bdbac7ff92c38add8984623.tar.bz2 |
TrackedObjects assumes you can use a "TLS slot" of -1 to indicate uninitialized. This isn't true for the pthread_key_t type, which is unsigned on Linux and reportedly a struct on Macs. This change modifies the Slot type to be a struct containing an "initialized" flag.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1113 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_thread.cc | 8 | ||||
-rw-r--r-- | chrome/renderer/render_thread.h | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index b37cf454..14f9313 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -47,8 +47,9 @@ static const unsigned int kCacheStatsDelayMS = 2000 /* milliseconds */; // V8 needs a 1MB stack size. static const size_t kStackSize = 1024 * 1024; -/*static*/ -DWORD RenderThread::tls_index_ = ThreadLocalStorage::Alloc(); +// TODO(evanm): don't rely on static initialization. +// static +TLSSlot RenderThread::tls_index_; //----------------------------------------------------------------------------- // Methods below are only called on the owner's thread: @@ -106,7 +107,6 @@ void RenderThread::RemoveRoute(int32 routing_id) { } void RenderThread::Init() { - DCHECK(tls_index_) << "static initializer failed"; DCHECK(!current()) << "should only have one RenderThread per thread"; notification_service_.reset(new NotificationService); @@ -118,7 +118,7 @@ void RenderThread::Init() { IPC::Channel::MODE_CLIENT, this, NULL, owner_loop_, true, RenderProcess::GetShutDownEvent())); - ThreadLocalStorage::Set(tls_index_, this); + tls_index_.Set(this); // The renderer thread should wind-up COM. CoInitialize(0); diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h index 9463a20..5e4f336 100644 --- a/chrome/renderer/render_thread.h +++ b/chrome/renderer/render_thread.h @@ -74,7 +74,7 @@ class RenderThread : public IPC::Channel::Listener, // The RenderThread instance for the current thread. static RenderThread* current() { - return static_cast<RenderThread*>(ThreadLocalStorage::Get(tls_index_)); + return static_cast<RenderThread*>(tls_index_.Get()); } VisitedLinkSlave* visited_link_slave() const { return visited_link_slave_; } @@ -119,7 +119,7 @@ class RenderThread : public IPC::Channel::Listener, // decisions about how to allocation resources using current information. void InformHostOfCacheStats(); - static DWORD tls_index_; + static TLSSlot tls_index_; // The message loop used to run tasks on the thread that started this thread. MessageLoop* owner_loop_; |