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

Side by Side Diff: chrome/browser/translate/translate_manager.cc

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: willchan comments + rebase Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/translate/translate_manager.h" 5 #include "chrome/browser/translate/translate_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 const int kTranslateScriptExpirationDelayMS = 24 * 60 * 60 * 1000; // 1 day. 134 const int kTranslateScriptExpirationDelayMS = 24 * 60 * 60 * 1000; // 1 day.
135 135
136 } // namespace 136 } // namespace
137 137
138 // This must be kept in sync with the &cb= value in the kLanguageListFetchURL. 138 // This must be kept in sync with the &cb= value in the kLanguageListFetchURL.
139 const char* const TranslateManager::kLanguageListCallbackName = "sl("; 139 const char* const TranslateManager::kLanguageListCallbackName = "sl(";
140 const char* const TranslateManager::kTargetLanguagesKey = "tl"; 140 const char* const TranslateManager::kTargetLanguagesKey = "tl";
141 141
142 // static 142 // static
143 base::LazyInstance<std::set<std::string> > 143 base::LazyInstance<std::set<std::string> >
144 TranslateManager::supported_languages_(base::LINKER_INITIALIZED); 144 TranslateManager::supported_languages_ = LAZY_INSTANCE_INITIALIZER;
145 145
146 TranslateManager::~TranslateManager() { 146 TranslateManager::~TranslateManager() {
147 weak_method_factory_.InvalidateWeakPtrs(); 147 weak_method_factory_.InvalidateWeakPtrs();
148 } 148 }
149 149
150 // static 150 // static
151 TranslateManager* TranslateManager::GetInstance() { 151 TranslateManager* TranslateManager::GetInstance() {
152 return Singleton<TranslateManager>::get(); 152 return Singleton<TranslateManager>::get();
153 } 153 }
154 154
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); 828 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper();
829 829
830 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { 830 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) {
831 TranslateInfoBarDelegate* delegate = 831 TranslateInfoBarDelegate* delegate =
832 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); 832 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate();
833 if (delegate) 833 if (delegate)
834 return delegate; 834 return delegate;
835 } 835 }
836 return NULL; 836 return NULL;
837 } 837 }
OLDNEW
« no previous file with comments | « chrome/browser/tabs/pinned_tab_service_factory.cc ('k') | chrome/browser/ui/cocoa/view_id_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698