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

Side by Side Diff: components/omnibox/browser/omnibox_field_trial.cc

Issue 2864103003: Limit the number of history urls indexed for omnibox suggestions. (Closed)
Patch Set: Address comments. Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/omnibox/browser/omnibox_field_trial.h" 5 #include "components/omnibox/browser/omnibox_field_trial.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/feature_list.h" 11 #include "base/feature_list.h"
12 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "base/metrics/field_trial_params.h" 13 #include "base/metrics/field_trial_params.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/string_split.h" 15 #include "base/strings/string_split.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/sys_info.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 #include "build/build_config.h" 19 #include "build/build_config.h"
19 #include "components/metrics/proto/omnibox_event.pb.h" 20 #include "components/metrics/proto/omnibox_event.pb.h"
20 #include "components/omnibox/browser/omnibox_switches.h" 21 #include "components/omnibox/browser/omnibox_switches.h"
21 #include "components/omnibox/browser/url_index_private_data.h" 22 #include "components/omnibox/browser/url_index_private_data.h"
22 #include "components/search/search.h" 23 #include "components/search/search.h"
23 #include "components/variations/active_field_trials.h" 24 #include "components/variations/active_field_trials.h"
24 #include "components/variations/metrics_util.h" 25 #include "components/variations/metrics_util.h"
25 #include "components/variations/variations_associated_data.h" 26 #include "components/variations/variations_associated_data.h"
26 27
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 kHQPExperimentalScoringTopicalityThresholdParam); 438 kHQPExperimentalScoringTopicalityThresholdParam);
438 439
439 double topicality_threshold; 440 double topicality_threshold;
440 if (topicality_threshold_str.empty() || 441 if (topicality_threshold_str.empty() ||
441 !base::StringToDouble(topicality_threshold_str, &topicality_threshold)) 442 !base::StringToDouble(topicality_threshold_str, &topicality_threshold))
442 return 0.8f; 443 return 0.8f;
443 444
444 return static_cast<float>(topicality_threshold); 445 return static_cast<float>(topicality_threshold);
445 } 446 }
446 447
448 int OmniboxFieldTrial::MaxNumHQPUrlsIndexedAtStartup() {
449 const char* param = kMaxNumHQPUrlsIndexedAtStartupOnNonLowEndDevicesParam;
450 if (base::SysInfo::IsLowEndDevice())
451 param = kMaxNumHQPUrlsIndexedAtStartupOnLowEndDevicesParam;
452 std::string param_value(variations::GetVariationParamValue(
453 kBundledExperimentFieldTrialName, param));
454 int num_urls;
455 if (base::StringToInt(param_value, &num_urls))
456 return num_urls;
457 // Default value is set to -1 for unlimited number of urls.
458 return -1;
459 }
460
447 bool OmniboxFieldTrial::HQPFixFewVisitsBug() { 461 bool OmniboxFieldTrial::HQPFixFewVisitsBug() {
448 return variations::GetVariationParamValue( 462 return variations::GetVariationParamValue(
449 kBundledExperimentFieldTrialName, 463 kBundledExperimentFieldTrialName,
450 kHQPFixFewVisitsBugRule) == "true"; 464 kHQPFixFewVisitsBugRule) == "true";
451 } 465 }
452 466
453 bool OmniboxFieldTrial::HQPFreqencyUsesSum() { 467 bool OmniboxFieldTrial::HQPFreqencyUsesSum() {
454 return variations::GetVariationParamValue(kBundledExperimentFieldTrialName, 468 return variations::GetVariationParamValue(kBundledExperimentFieldTrialName,
455 kHQPFreqencyUsesSumRule) == "true"; 469 kHQPFreqencyUsesSumRule) == "true";
456 } 470 }
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 "VisitedCountScoreBuckets"; 728 "VisitedCountScoreBuckets";
715 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountUseDecayFactorParam[] = 729 const char OmniboxFieldTrial::kHUPNewScoringVisitedCountUseDecayFactorParam[] =
716 "VisitedCountUseDecayFactor"; 730 "VisitedCountUseDecayFactor";
717 731
718 const char OmniboxFieldTrial::kHQPExperimentalScoringBucketsParam[] = 732 const char OmniboxFieldTrial::kHQPExperimentalScoringBucketsParam[] =
719 "HQPExperimentalScoringBuckets"; 733 "HQPExperimentalScoringBuckets";
720 const char 734 const char
721 OmniboxFieldTrial::kHQPExperimentalScoringTopicalityThresholdParam[] = 735 OmniboxFieldTrial::kHQPExperimentalScoringTopicalityThresholdParam[] =
722 "HQPExperimentalScoringTopicalityThreshold"; 736 "HQPExperimentalScoringTopicalityThreshold";
723 737
738 const char
739 OmniboxFieldTrial::kMaxNumHQPUrlsIndexedAtStartupOnLowEndDevicesParam[] =
740 "MaxNumHQPUrlsIndexedAtStartupOnLowEndDevices";
741 const char
742 OmniboxFieldTrial::kMaxNumHQPUrlsIndexedAtStartupOnNonLowEndDevicesParam[] =
743 "MaxNumHQPUrlsIndexedAtStartupOnNonLowEndDevices";
744
724 const char OmniboxFieldTrial::kPhysicalWebZeroSuggestBaseRelevanceParam[] = 745 const char OmniboxFieldTrial::kPhysicalWebZeroSuggestBaseRelevanceParam[] =
725 "PhysicalWebZeroSuggestBaseRelevance"; 746 "PhysicalWebZeroSuggestBaseRelevance";
726 const char OmniboxFieldTrial::kPhysicalWebAfterTypingBaseRelevanceParam[] = 747 const char OmniboxFieldTrial::kPhysicalWebAfterTypingBaseRelevanceParam[] =
727 "PhysicalWebAfterTypingBaseRelevanceParam"; 748 "PhysicalWebAfterTypingBaseRelevanceParam";
728 749
729 const char OmniboxFieldTrial::kZeroSuggestRedirectToChromeServerAddressParam[] = 750 const char OmniboxFieldTrial::kZeroSuggestRedirectToChromeServerAddressParam[] =
730 "ZeroSuggestRedirectToChromeServerAddress"; 751 "ZeroSuggestRedirectToChromeServerAddress";
731 const char 752 const char
732 OmniboxFieldTrial::kZeroSuggestRedirectToChromeAdditionalFieldsParam[] = 753 OmniboxFieldTrial::kZeroSuggestRedirectToChromeAdditionalFieldsParam[] =
733 "ZeroSuggestRedirectToChromeAdditionalFields"; 754 "ZeroSuggestRedirectToChromeAdditionalFields";
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 if (it != params.end()) 811 if (it != params.end())
791 return it->second; 812 return it->second;
792 // Fall back to the global instant extended context. 813 // Fall back to the global instant extended context.
793 it = params.find(rule + ":" + page_classification_str + ":*"); 814 it = params.find(rule + ":" + page_classification_str + ":*");
794 if (it != params.end()) 815 if (it != params.end())
795 return it->second; 816 return it->second;
796 // Look up rule in the global context. 817 // Look up rule in the global context.
797 it = params.find(rule + ":*:*"); 818 it = params.find(rule + ":*:*");
798 return (it != params.end()) ? it->second : std::string(); 819 return (it != params.end()) ? it->second : std::string();
799 } 820 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/omnibox_field_trial.h ('k') | components/omnibox/browser/url_index_private_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698