Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_dom_feature_extractor.h" | 5 #include "chrome/renderer/safe_browsing/phishing_dom_feature_extractor.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/hash_tables.h" | 8 #include "base/hash_tables.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 } | 139 } |
| 140 | 140 |
| 141 void PhishingDOMFeatureExtractor::ExtractFeaturesWithTimeout() { | 141 void PhishingDOMFeatureExtractor::ExtractFeaturesWithTimeout() { |
| 142 DCHECK(page_feature_state_.get()); | 142 DCHECK(page_feature_state_.get()); |
| 143 ++page_feature_state_->num_iterations; | 143 ++page_feature_state_->num_iterations; |
| 144 base::TimeTicks current_chunk_start_time = clock_->Now(); | 144 base::TimeTicks current_chunk_start_time = clock_->Now(); |
| 145 | 145 |
| 146 if (!cur_frame_) { | 146 if (!cur_frame_) { |
| 147 WebKit::WebView* web_view = render_view_->webview(); | 147 WebKit::WebView* web_view = render_view_->webview(); |
| 148 if (!web_view) { | 148 if (!web_view) { |
| 149 // When the WebView is going away, the render view should have called | 149 RunCallback(false); // The WebView is going away. |
|
Brian Ryner
2011/02/07 20:08:19
We're not using it currently, but there is a simil
jam
2011/02/07 20:24:49
Done.
| |
| 150 // CancelPendingExtraction() which should have stopped any pending work, | |
| 151 // so this case should not happen. | |
| 152 NOTREACHED(); | |
| 153 RunCallback(false); | |
| 154 return; | 150 return; |
| 155 } | 151 } |
| 156 cur_frame_ = web_view->mainFrame(); | 152 cur_frame_ = web_view->mainFrame(); |
| 157 } | 153 } |
| 158 | 154 |
| 159 int num_elements = 0; | 155 int num_elements = 0; |
| 160 for (; cur_frame_; | 156 for (; cur_frame_; |
| 161 cur_frame_ = cur_frame_->traverseNext(false /* don't wrap around */)) { | 157 cur_frame_ = cur_frame_->traverseNext(false /* don't wrap around */)) { |
| 162 WebKit::WebNode cur_node; | 158 WebKit::WebNode cur_node; |
| 163 if (cur_frame_data_.get()) { | 159 if (cur_frame_data_.get()) { |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 480 // Record number of script tags (discretized for numerical stability.) | 476 // Record number of script tags (discretized for numerical stability.) |
| 481 if (page_feature_state_->num_script_tags > 1) { | 477 if (page_feature_state_->num_script_tags > 1) { |
| 482 features_->AddBooleanFeature(features::kPageNumScriptTagsGTOne); | 478 features_->AddBooleanFeature(features::kPageNumScriptTagsGTOne); |
| 483 if (page_feature_state_->num_script_tags > 6) { | 479 if (page_feature_state_->num_script_tags > 6) { |
| 484 features_->AddBooleanFeature(features::kPageNumScriptTagsGTSix); | 480 features_->AddBooleanFeature(features::kPageNumScriptTagsGTSix); |
| 485 } | 481 } |
| 486 } | 482 } |
| 487 } | 483 } |
| 488 | 484 |
| 489 } // namespace safe_browsing | 485 } // namespace safe_browsing |
| OLD | NEW |