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

Side by Side Diff: chrome/renderer/safe_browsing/phishing_classifier_delegate.cc

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thakis comment, renamed LAZY_INSTANCE_INITIALIZER 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/renderer/safe_browsing/phishing_classifier_delegate.h" 5 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 19 matching lines...) Expand all
30 namespace safe_browsing { 30 namespace safe_browsing {
31 31
32 static GURL StripRef(const GURL& url) { 32 static GURL StripRef(const GURL& url) {
33 GURL::Replacements replacements; 33 GURL::Replacements replacements;
34 replacements.ClearRef(); 34 replacements.ClearRef();
35 return url.ReplaceComponents(replacements); 35 return url.ReplaceComponents(replacements);
36 } 36 }
37 37
38 typedef std::set<PhishingClassifierDelegate*> PhishingClassifierDelegates; 38 typedef std::set<PhishingClassifierDelegate*> PhishingClassifierDelegates;
39 static base::LazyInstance<PhishingClassifierDelegates> 39 static base::LazyInstance<PhishingClassifierDelegates>
40 g_delegates(base::LINKER_INITIALIZED); 40 g_delegates = LAZY_INSTANCE_INITIALIZER;
41 41
42 static base::LazyInstance<scoped_ptr<const safe_browsing::Scorer> > 42 static base::LazyInstance<scoped_ptr<const safe_browsing::Scorer> >
43 g_phishing_scorer(base::LINKER_INITIALIZED); 43 g_phishing_scorer = LAZY_INSTANCE_INITIALIZER;
44 44
45 // static 45 // static
46 PhishingClassifierFilter* PhishingClassifierFilter::Create() { 46 PhishingClassifierFilter* PhishingClassifierFilter::Create() {
47 // Private constructor and public static Create() method to facilitate 47 // Private constructor and public static Create() method to facilitate
48 // stubbing out this class for binary-size reduction purposes. 48 // stubbing out this class for binary-size reduction purposes.
49 return new PhishingClassifierFilter(); 49 return new PhishingClassifierFilter();
50 } 50 }
51 51
52 PhishingClassifierFilter::PhishingClassifierFilter() 52 PhishingClassifierFilter::PhishingClassifierFilter()
53 : RenderProcessObserver() {} 53 : RenderProcessObserver() {}
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 279
280 VLOG(2) << "Starting classification for " << last_finished_load_url_; 280 VLOG(2) << "Starting classification for " << last_finished_load_url_;
281 last_url_sent_to_classifier_ = last_finished_load_url_; 281 last_url_sent_to_classifier_ = last_finished_load_url_;
282 is_classifying_ = true; 282 is_classifying_ = true;
283 classifier_->BeginClassification( 283 classifier_->BeginClassification(
284 &classifier_page_text_, 284 &classifier_page_text_,
285 NewCallback(this, &PhishingClassifierDelegate::ClassificationDone)); 285 NewCallback(this, &PhishingClassifierDelegate::ClassificationDone));
286 } 286 }
287 287
288 } // namespace safe_browsing 288 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698