| OLD | NEW |
| 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/scorer.h" | 5 #include "chrome/renderer/safe_browsing/scorer.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
| 14 #include "chrome/common/safe_browsing/client_model.pb.h" | 14 #include "chrome/common/safe_browsing/client_model.pb.h" |
| 15 #include "chrome/renderer/safe_browsing/features.h" | 15 #include "chrome/renderer/safe_browsing/features.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 // Enum used to keep stats about the status of the Scorer creation. | 18 // Enum used to keep stats about the status of the Scorer creation. |
| 19 enum ScorerCreationStatus { | 19 enum ScorerCreationStatus { |
| 20 SCORER_SUCCESS, | 20 SCORER_SUCCESS, |
| 21 SCORER_FAIL_MODEL_OPEN_FAIL, // Not used anymore | 21 SCORER_FAIL_MODEL_OPEN_FAIL, // Not used anymore |
| 22 SCORER_FAIL_MODEL_FILE_EMPTY, // Not used anymore | 22 SCORER_FAIL_MODEL_FILE_EMPTY, // Not used anymore |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // If the feature of the rule does not exist in the given feature map the | 123 // If the feature of the rule does not exist in the given feature map the |
| 124 // feature weight is considered to be zero. If the feature weight is zero | 124 // feature weight is considered to be zero. If the feature weight is zero |
| 125 // we leave early since we know that the rule score will be zero. | 125 // we leave early since we know that the rule score will be zero. |
| 126 return 0.0; | 126 return 0.0; |
| 127 } | 127 } |
| 128 rule_score *= it->second; | 128 rule_score *= it->second; |
| 129 } | 129 } |
| 130 return rule_score * rule.weight(); | 130 return rule_score * rule.weight(); |
| 131 } | 131 } |
| 132 } // namespace safe_browsing | 132 } // namespace safe_browsing |
| OLD | NEW |