summaryrefslogtreecommitdiffstats
path: root/base/third_party
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-03 20:05:38 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-03 20:05:38 +0000
commit6a32203f5ac88c13f1bc82513bd14827d56c2abb (patch)
tree30dbfae26a52eb638521acfbf5d7b4bdef8ad157 /base/third_party
parentd786ce91e8c3855d443bf50f8fda11d5fe1f20c0 (diff)
downloadchromium_src-6a32203f5ac88c13f1bc82513bd14827d56c2abb.zip
chromium_src-6a32203f5ac88c13f1bc82513bd14827d56c2abb.tar.gz
chromium_src-6a32203f5ac88c13f1bc82513bd14827d56c2abb.tar.bz2
Remove 2 exit time destructors and 2 static initializers.
BUG=101600,94925 TEST=none Review URL: http://codereview.chromium.org/8450008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108531 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/third_party')
-rw-r--r--base/third_party/dmg_fp/dtoa_wrapper.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/base/third_party/dmg_fp/dtoa_wrapper.cc b/base/third_party/dmg_fp/dtoa_wrapper.cc
index e34b8a6..21c4dc3 100644
--- a/base/third_party/dmg_fp/dtoa_wrapper.cc
+++ b/base/third_party/dmg_fp/dtoa_wrapper.cc
@@ -1,15 +1,17 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
//
// The purpose of this file is to supply the macro definintions necessary
// to make third_party/dmg_fp/dtoa.cc threadsafe.
-#include "base/synchronization/lock.h"
+#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/synchronization/lock.h"
// We need two locks because they're sometimes grabbed at the same time.
// A single lock would lead to an attempted recursive grab.
-static base::Lock dtoa_locks[2];
+static base::LazyInstance<base::Lock> dtoa_lock_0(base::LINKER_INITIALIZED);
+static base::LazyInstance<base::Lock> dtoa_lock_1(base::LINKER_INITIALIZED);
/*
* This define and the code below is to trigger thread-safe behavior
@@ -28,13 +30,15 @@ static base::Lock dtoa_locks[2];
#define MULTIPLE_THREADS
inline static void ACQUIRE_DTOA_LOCK(size_t n) {
- DCHECK(n < arraysize(dtoa_locks));
- dtoa_locks[n].Acquire();
+ DCHECK(n < 2);
+ base::Lock* lock = n == 0 ? dtoa_lock_0.Pointer() : dtoa_lock_1.Pointer();
+ lock->Acquire();
}
inline static void FREE_DTOA_LOCK(size_t n) {
- DCHECK(n < arraysize(dtoa_locks));
- dtoa_locks[n].Release();
+ DCHECK(n < 2);
+ base::Lock* lock = n == 0 ? dtoa_lock_0.Pointer() : dtoa_lock_1.Pointer();
+ lock->Release();
}
#include "base/third_party/dmg_fp/dtoa.cc"