summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-07 06:03:30 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-07 06:03:30 +0000
commit26430024d4ba899f13140334e0311f8b586557fa (patch)
tree64e154a9c5e5ee37642340f303531af76e56e3c2
parent5a4c3f5564f8870edca6be511b33f5c38c599c94 (diff)
downloadchromium_src-26430024d4ba899f13140334e0311f8b586557fa.zip
chromium_src-26430024d4ba899f13140334e0311f8b586557fa.tar.gz
chromium_src-26430024d4ba899f13140334e0311f8b586557fa.tar.bz2
Remove 13 exit time constructors and 3 static initializers
BUG=101600,94925 TEST=none TBR=vandebo,viettrungluu Review URL: http://codereview.chromium.org/8487001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108838 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/tab_contents/web_drag_source_mac.mm5
-rw-r--r--jingle/notifier/listener/push_notifications_subscribe_task.cc4
-rw-r--r--net/base/net_util.cc3
-rw-r--r--net/http/http_mac_signature.cc2
-rw-r--r--net/spdy/spdy_settings_storage.cc2
-rw-r--r--net/url_request/url_request.cc7
-rw-r--r--net/url_request/url_request_http_job.cc6
-rw-r--r--ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc9
-rw-r--r--ppapi/proxy/ppb_core_proxy.cc4
-rw-r--r--ppapi/proxy/ppb_font_proxy.cc2
-rw-r--r--printing/backend/print_backend_cups.cc2
-rw-r--r--printing/pdf_metafile_cg_mac.cc22
12 files changed, 38 insertions, 30 deletions
diff --git a/content/browser/tab_contents/web_drag_source_mac.mm b/content/browser/tab_contents/web_drag_source_mac.mm
index 1a6531b..24075ff 100644
--- a/content/browser/tab_contents/web_drag_source_mac.mm
+++ b/content/browser/tab_contents/web_drag_source_mac.mm
@@ -161,9 +161,8 @@ void PromiseWriterTask::Run() {
- (void)lazyWriteToPasteboard:(NSPasteboard*)pboard forType:(NSString*)type {
// NSHTMLPboardType requires the character set to be declared. Otherwise, it
// assumes US-ASCII. Awesome.
- static const string16 kHtmlHeader =
- ASCIIToUTF16("<meta http-equiv=\"Content-Type\" "
- "content=\"text/html;charset=UTF-8\">");
+ const string16 kHtmlHeader = ASCIIToUTF16(
+ "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">");
// Be extra paranoid; avoid crashing.
if (!dropData_.get()) {
diff --git a/jingle/notifier/listener/push_notifications_subscribe_task.cc b/jingle/notifier/listener/push_notifications_subscribe_task.cc
index 778e7fa..a4d3b21c 100644
--- a/jingle/notifier/listener/push_notifications_subscribe_task.cc
+++ b/jingle/notifier/listener/push_notifications_subscribe_task.cc
@@ -1,4 +1,4 @@
-// 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.
@@ -80,7 +80,7 @@ buzz::XmlElement* PushNotificationsSubscribeTask::MakeSubscriptionMessage(
const SubscriptionList& subscriptions,
const buzz::Jid& jid, const std::string& task_id) {
DCHECK(jid.IsFull());
- static const buzz::QName kQnSubscribe(
+ const buzz::QName kQnSubscribe(
kPushNotificationsNamespace, "subscribe");
// Create the subscription stanza using the notifications protocol.
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index f34f980..2ae1e79 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -496,7 +496,8 @@ static base::Lock lang_set_lock;
// the language |lang|.
bool IsComponentCoveredByLang(const icu::UnicodeSet& component_characters,
const std::string& lang) {
- static const icu::UnicodeSet kASCIILetters(0x61, 0x7a); // [a-z]
+ CR_DEFINE_STATIC_LOCAL(
+ const icu::UnicodeSet, kASCIILetters, ('a', 'z'));
icu::UnicodeSet* lang_set;
// We're called from both the UI thread and the history thread.
{
diff --git a/net/http/http_mac_signature.cc b/net/http/http_mac_signature.cc
index 1e3ea95..93498ef 100644
--- a/net/http/http_mac_signature.cc
+++ b/net/http/http_mac_signature.cc
@@ -132,7 +132,7 @@ bool HttpMacSignature::GenerateHeaderString(const std::string& age,
std::string HttpMacSignature::GenerateNormalizedRequest(
const std::string& age,
const std::string& nonce) {
- static const std::string kNewLine = "\n";
+ const std::string kNewLine = "\n";
std::string normalized_request = age + ":" + nonce + kNewLine;
normalized_request += method_ + kNewLine;
diff --git a/net/spdy/spdy_settings_storage.cc b/net/spdy/spdy_settings_storage.cc
index 9d79c56..f714249 100644
--- a/net/spdy/spdy_settings_storage.cc
+++ b/net/spdy/spdy_settings_storage.cc
@@ -18,7 +18,7 @@ const spdy::SpdySettings& SpdySettingsStorage::Get(
const HostPortPair& host_port_pair) const {
SettingsMap::const_iterator it = settings_map_.find(host_port_pair);
if (it == settings_map_.end()) {
- static const spdy::SpdySettings kEmpty;
+ CR_DEFINE_STATIC_LOCAL(spdy::SpdySettings, kEmpty, ());
return kEmpty;
}
return it->second;
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index 0e3c984..66d629b 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
+#include "base/lazy_instance.h"
#include "base/memory/singleton.h"
#include "base/message_loop.h"
#include "base/metrics/stats_counters.h"
@@ -55,11 +56,13 @@ void StripPostSpecificHeaders(HttpRequestHeaders* headers) {
uint64 g_next_url_request_identifier = 1;
// This lock protects g_next_url_request_identifier.
-base::Lock g_next_url_request_identifier_lock;
+base::LazyInstance<base::Lock,
+ base::LeakyLazyInstanceTraits<base::Lock> >
+ g_next_url_request_identifier_lock(base::LINKER_INITIALIZED);
// Returns an prior unused identifier for URL requests.
uint64 GenerateURLRequestIdentifier() {
- base::AutoLock lock(g_next_url_request_identifier_lock);
+ base::AutoLock lock(g_next_url_request_identifier_lock.Get());
return g_next_url_request_identifier++;
}
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index 33887db..889fba86 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -255,7 +255,7 @@ void URLRequestHttpJob::NotifyHeadersComplete() {
if (SdchManager::Global() &&
SdchManager::Global()->IsInSupportedDomain(request_->url())) {
- static const std::string name = "Get-Dictionary";
+ const std::string name = "Get-Dictionary";
std::string url_text;
void* iter = NULL;
// TODO(jar): We need to not fetch dictionaries the first time they are
@@ -592,7 +592,7 @@ void URLRequestHttpJob::CookieHandled() {
void URLRequestHttpJob::FetchResponseCookies(
std::vector<std::string>* cookies) {
- std::string name = "Set-Cookie";
+ const std::string name = "Set-Cookie";
std::string value;
void* iter = NULL;
@@ -614,7 +614,7 @@ void URLRequestHttpJob::ProcessStrictTransportSecurityHeader() {
const bool valid_https =
https && !IsCertStatusError(response_info_->ssl_info.cert_status);
- std::string name = "Strict-Transport-Security";
+ const std::string name = "Strict-Transport-Security";
std::string value;
int max_age;
diff --git a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
index 19b0cdc..d370d67 100644
--- a/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
+++ b/ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
@@ -409,8 +409,9 @@ void PnaclCoordinator::RunTranslate(int32_t pp_error,
namespace {
// Fake filename for the object file generated by llvm.
-const nacl::string kGeneratedObjectFileName =
- nacl::string("___PNACL_GENERATED");
+nacl::string GeneratedObjectFileName() {
+ return nacl::string("___PNACL_GENERATED");
+}
string_vector LinkResources(const nacl::string& sandbox_isa,
bool withGenerated) {
@@ -419,7 +420,7 @@ string_vector LinkResources(const nacl::string& sandbox_isa,
// NOTE: order of items == link order.
if (withGenerated) {
- results.push_back(kGeneratedObjectFileName);
+ results.push_back(GeneratedObjectFileName());
}
results.push_back(base_dir + "/libcrt_platform.a");
results.push_back(base_dir + "/libgcc.a");
@@ -512,7 +513,7 @@ void WINAPI DoLinkThread(void* arg) {
link_file + ") failed.");
}
// Also map the file name to descriptor.
- if (i->compare(kGeneratedObjectFileName) == 0) {
+ if (i->compare(GeneratedObjectFileName()) == 0) {
SrpcParams dummy_params2;
if (!PnaclSrpcLib::InvokeSrpcMethod(browser_interface,
ld_subprocess,
diff --git a/ppapi/proxy/ppb_core_proxy.cc b/ppapi/proxy/ppb_core_proxy.cc
index c01eb45..842ed86 100644
--- a/ppapi/proxy/ppb_core_proxy.cc
+++ b/ppapi/proxy/ppb_core_proxy.cc
@@ -28,8 +28,8 @@ namespace proxy {
namespace {
base::MessageLoopProxy* GetMainThreadMessageLoop() {
- static scoped_refptr<base::MessageLoopProxy> proxy(
- base::MessageLoopProxy::current());
+ CR_DEFINE_STATIC_LOCAL(scoped_refptr<base::MessageLoopProxy>, proxy,
+ (base::MessageLoopProxy::current()));
return proxy.get();
}
diff --git a/ppapi/proxy/ppb_font_proxy.cc b/ppapi/proxy/ppb_font_proxy.cc
index 424f255..111d89d 100644
--- a/ppapi/proxy/ppb_font_proxy.cc
+++ b/ppapi/proxy/ppb_font_proxy.cc
@@ -59,7 +59,7 @@ PP_Var PPB_Font_Proxy::GetFontFamilies(PP_Instance instance) {
return PP_MakeUndefined();
// Assume the font families don't change, so we can cache the result globally.
- static std::string families;
+ CR_DEFINE_STATIC_LOCAL(std::string, families, ());
if (families.empty()) {
dispatcher->SendToBrowser(
new PpapiHostMsg_PPBFont_GetFontFamilies(&families));
diff --git a/printing/backend/print_backend_cups.cc b/printing/backend/print_backend_cups.cc
index e2c383ee..a164362 100644
--- a/printing/backend/print_backend_cups.cc
+++ b/printing/backend/print_backend_cups.cc
@@ -262,7 +262,7 @@ int PrintBackendCUPS::GetDests(cups_dest_t** dests) {
FilePath PrintBackendCUPS::GetPPD(const char* name) {
// cupsGetPPD returns a filename stored in a static buffer in CUPS.
// Protect this code with lock.
- static base::Lock ppd_lock;
+ CR_DEFINE_STATIC_LOCAL(base::Lock, ppd_lock, ());
base::AutoLock ppd_autolock(ppd_lock);
FilePath ppd_path;
const char* ppd_file_path = NULL;
diff --git a/printing/pdf_metafile_cg_mac.cc b/printing/pdf_metafile_cg_mac.cc
index 724d814..ec4b51d 100644
--- a/printing/pdf_metafile_cg_mac.cc
+++ b/printing/pdf_metafile_cg_mac.cc
@@ -5,6 +5,7 @@
#include "printing/pdf_metafile_cg_mac.h"
#include "base/file_path.h"
+#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
@@ -34,7 +35,10 @@ namespace {
// single-process mode. TODO(avi): This Apple bug appears fixed in 10.7; when
// 10.7 is the minimum required version for Chromium, remove this hack.
-base::ThreadLocalPointer<struct __CFSet> thread_pdf_docs;
+base::LazyInstance<
+ base::ThreadLocalPointer<struct __CFSet>,
+ base::LeakyLazyInstanceTraits<base::ThreadLocalPointer<struct __CFSet> > >
+ thread_pdf_docs(base::LINKER_INITIALIZED);
} // namespace
@@ -43,24 +47,24 @@ namespace printing {
PdfMetafileCg::PdfMetafileCg()
: page_is_open_(false),
thread_pdf_docs_owned_(false) {
- if (!thread_pdf_docs.Get() && base::mac::IsOSSnowLeopardOrEarlier()) {
+ if (!thread_pdf_docs.Pointer()->Get() &&
+ base::mac::IsOSSnowLeopardOrEarlier()) {
thread_pdf_docs_owned_ = true;
- thread_pdf_docs.Set(CFSetCreateMutable(kCFAllocatorDefault,
- 0,
- &kCFTypeSetCallBacks));
+ thread_pdf_docs.Pointer()->Set(
+ CFSetCreateMutable(kCFAllocatorDefault, 0, &kCFTypeSetCallBacks));
}
}
PdfMetafileCg::~PdfMetafileCg() {
DCHECK(thread_checker_.CalledOnValidThread());
- if (pdf_doc_ && thread_pdf_docs.Get()) {
+ if (pdf_doc_ && thread_pdf_docs.Pointer()->Get()) {
// Transfer ownership to the pool.
- CFSetAddValue(thread_pdf_docs.Get(), pdf_doc_);
+ CFSetAddValue(thread_pdf_docs.Pointer()->Get(), pdf_doc_);
}
if (thread_pdf_docs_owned_) {
- CFRelease(thread_pdf_docs.Get());
- thread_pdf_docs.Set(NULL);
+ CFRelease(thread_pdf_docs.Pointer()->Get());
+ thread_pdf_docs.Pointer()->Set(NULL);
}
}