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
This commit is contained in:
content/browser/tab_contents
jingle/notifier/listener
net
base
http
spdy
url_request
ppapi
printing
@ -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()) {
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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++;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user