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

Side by Side Diff: chrome/browser/history/scored_history_match.cc

Issue 10535084: Coverity: Remove dead code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/history/scored_history_match.h" 5 #include "chrome/browser/history/scored_history_match.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <iterator> 9 #include <iterator>
10 #include <numeric> 10 #include <numeric>
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 if (term_score < 10) { 385 if (term_score < 10) {
386 // If the term scores less than 10 points (no full-credit hit, or 386 // If the term scores less than 10 points (no full-credit hit, or
387 // no combination of hits that score that well), then the topicality 387 // no combination of hits that score that well), then the topicality
388 // score is linear in the term score. 388 // score is linear in the term score.
389 topicality_score = 0.1 * term_score; 389 topicality_score = 0.1 * term_score;
390 } else { 390 } else {
391 // For term scores of at least ten points, pass them through a log 391 // For term scores of at least ten points, pass them through a log
392 // function so a score of 10 points gets a 1.0 (to meet up exactly 392 // function so a score of 10 points gets a 1.0 (to meet up exactly
393 // with the linear component) and increases logarithmically until 393 // with the linear component) and increases logarithmically until
394 // maxing out at 30 points, with computes to a score around 2.1. 394 // maxing out at 30 points, with computes to a score around 2.1.
395 topicality_score = (1.0 + 2.25 * log10(0.1 * 395 topicality_score = (1.0 + 2.25 * log10(0.1 * term_score));
396 ((term_score <= 30) ? term_score : 30)));
397 } 396 }
398 raw_term_score_to_topicality_score[term_score] = topicality_score; 397 raw_term_score_to_topicality_score[term_score] = topicality_score;
399 } 398 }
400 } 399 }
401 400
402 // static 401 // static
403 float* ScoredHistoryMatch::days_ago_to_recency_score = NULL; 402 float* ScoredHistoryMatch::days_ago_to_recency_score = NULL;
404 403
405 // static 404 // static
406 float ScoredHistoryMatch::GetRecencyScore(int last_visit_days_ago) { 405 float ScoredHistoryMatch::GetRecencyScore(int last_visit_days_ago) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 462
464 // static 463 // static
465 float ScoredHistoryMatch::GetPopularityScore(int typed_count, 464 float ScoredHistoryMatch::GetPopularityScore(int typed_count,
466 int visit_count) { 465 int visit_count) {
467 // The max()s are to guard against database corruption. 466 // The max()s are to guard against database corruption.
468 return (std::max(typed_count, 0) * 5.0 + std::max(visit_count, 0) * 3.0) / 467 return (std::max(typed_count, 0) * 5.0 + std::max(visit_count, 0) * 3.0) /
469 (5.0 + 3.0); 468 (5.0 + 3.0);
470 } 469 }
471 470
472 } // namespace history 471 } // namespace history
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698