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

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

Issue 6286038: Add initial code to do filename munging in the FileSystem.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
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/scorer.h" 5 #include "chrome/renderer/safe_browsing/scorer.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/file_util_proxy.h" 9 #include "base/file_util_proxy.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 model_file_(model_file), 44 model_file_(model_file),
45 creation_callback_(creation_callback) { 45 creation_callback_(creation_callback) {
46 memset(buffer_, 0, sizeof(buffer_)); 46 memset(buffer_, 0, sizeof(buffer_));
47 } 47 }
48 48
49 ~ScorerLoader() {} 49 ~ScorerLoader() {}
50 50
51 // Begins the model load. 51 // Begins the model load.
52 // The ScorerLoader will delete itself when the load is finished. 52 // The ScorerLoader will delete itself when the load is finished.
53 void Run() { 53 void Run() {
54 bool success = base::FileUtilProxy::Read( 54 bool success = base::FileUtilProxy::GetInstance()->Read(
55 file_thread_proxy_, 55 file_thread_proxy_,
56 model_file_, 56 model_file_,
57 0, // offset 57 0, // offset
58 buffer_, 58 buffer_,
59 Scorer::kMaxPhishingModelSizeBytes, 59 Scorer::kMaxPhishingModelSizeBytes,
60 NewCallback(this, &ScorerLoader::ModelReadDone)); 60 NewCallback(this, &ScorerLoader::ModelReadDone));
61 DCHECK(success) << "Unable to post a task to read the phishing model file"; 61 DCHECK(success) << "Unable to post a task to read the phishing model file";
62 } 62 }
63 63
64 private: 64 private:
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // If the feature of the rule does not exist in the given feature map the 157 // If the feature of the rule does not exist in the given feature map the
158 // feature weight is considered to be zero. If the feature weight is zero 158 // feature weight is considered to be zero. If the feature weight is zero
159 // we leave early since we know that the rule score will be zero. 159 // we leave early since we know that the rule score will be zero.
160 return 0.0; 160 return 0.0;
161 } 161 }
162 rule_score *= it->second; 162 rule_score *= it->second;
163 } 163 }
164 return rule_score * rule.weight(); 164 return rule_score * rule.weight();
165 } 165 }
166 } // namespace safe_browsing 166 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698