Index: chrome/renderer/safe_browsing/phishing_classifier.cc |
diff --git a/chrome/renderer/safe_browsing/phishing_classifier.cc b/chrome/renderer/safe_browsing/phishing_classifier.cc |
index 886889a35a28e6041ec919eacffa47ed904a16c0..3cc51941e2218fad041ffde9f9d78b9816be1c02 100644 |
--- a/chrome/renderer/safe_browsing/phishing_classifier.cc |
+++ b/chrome/renderer/safe_browsing/phishing_classifier.cc |
@@ -77,8 +77,9 @@ bool PhishingClassifier::is_ready() const { |
return scorer_ != NULL; |
} |
-void PhishingClassifier::BeginClassification(const string16* page_text, |
- DoneCallback* done_callback) { |
+void PhishingClassifier::BeginClassification( |
+ const string16* page_text, |
+ const DoneCallback& done_callback) { |
DCHECK(is_ready()); |
// The RenderView should have called CancelPendingClassification() before |
@@ -89,7 +90,7 @@ void PhishingClassifier::BeginClassification(const string16* page_text, |
CancelPendingClassification(); |
page_text_ = page_text; |
- done_callback_.reset(done_callback); |
+ done_callback_ = done_callback; |
// For consistency, we always want to invoke the DoneCallback |
// asynchronously, rather than directly from this method. To ensure that |
@@ -138,7 +139,8 @@ void PhishingClassifier::BeginFeatureExtraction() { |
// in several chunks of work and invokes the callback when finished. |
dom_extractor_->ExtractFeatures( |
features_.get(), |
- NewCallback(this, &PhishingClassifier::DOMExtractionFinished)); |
+ base::Bind(&PhishingClassifier::DOMExtractionFinished, |
+ base::Unretained(this))); |
} |
void PhishingClassifier::CancelPendingClassification() { |
@@ -158,7 +160,8 @@ void PhishingClassifier::DOMExtractionFinished(bool success) { |
term_extractor_->ExtractFeatures( |
page_text_, |
features_.get(), |
- NewCallback(this, &PhishingClassifier::TermExtractionFinished)); |
+ base::Bind(&PhishingClassifier::TermExtractionFinished, |
+ base::Unretained(this))); |
} else { |
RunFailureCallback(); |
} |
@@ -204,9 +207,9 @@ void PhishingClassifier::TermExtractionFinished(bool success) { |
} |
void PhishingClassifier::CheckNoPendingClassification() { |
- DCHECK(!done_callback_.get()); |
+ DCHECK(done_callback_.is_null()); |
DCHECK(!page_text_); |
- if (done_callback_.get() || page_text_) { |
+ if (done_callback_.is_null() || page_text_) { |
LOG(ERROR) << "Classification in progress, missing call to " |
<< "CancelPendingClassification"; |
UMA_HISTOGRAM_COUNTS("SBClientPhishing.CheckNoPendingClassificationFailed", |
@@ -215,7 +218,7 @@ void PhishingClassifier::CheckNoPendingClassification() { |
} |
void PhishingClassifier::RunCallback(const ClientPhishingRequest& verdict) { |
- done_callback_->Run(verdict); |
+ done_callback_.Run(verdict); |
Clear(); |
} |
@@ -231,7 +234,7 @@ void PhishingClassifier::RunFailureCallback() { |
void PhishingClassifier::Clear() { |
page_text_ = NULL; |
- done_callback_.reset(NULL); |
+ done_callback_.Reset(); |
features_.reset(NULL); |
} |