OLD | NEW |
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/predictors/autocomplete_action_predictor.h" | 5 #include "chrome/browser/predictors/autocomplete_action_predictor.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 if (profile_->IsOffTheRecord()) { | 87 if (profile_->IsOffTheRecord()) { |
88 main_profile_predictor_ = AutocompleteActionPredictorFactory::GetForProfile( | 88 main_profile_predictor_ = AutocompleteActionPredictorFactory::GetForProfile( |
89 profile_->GetOriginalProfile()); | 89 profile_->GetOriginalProfile()); |
90 DCHECK(main_profile_predictor_); | 90 DCHECK(main_profile_predictor_); |
91 main_profile_predictor_->incognito_predictor_ = this; | 91 main_profile_predictor_->incognito_predictor_ = this; |
92 if (main_profile_predictor_->initialized_) | 92 if (main_profile_predictor_->initialized_) |
93 CopyFromMainProfile(); | 93 CopyFromMainProfile(); |
94 } else { | 94 } else { |
95 // Request the in-memory database from the history to force it to load so | 95 // Request the in-memory database from the history to force it to load so |
96 // it's available as soon as possible. | 96 // it's available as soon as possible. |
97 HistoryService* history_service = | 97 HistoryService* history_service = HistoryServiceFactory::GetForProfile( |
98 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); | 98 profile_, Profile::EXPLICIT_ACCESS); |
99 if (history_service) | 99 if (history_service) |
100 history_service->InMemoryDatabase(); | 100 history_service->InMemoryDatabase(); |
101 | 101 |
102 table_ = | 102 table_ = |
103 PredictorDatabaseFactory::GetForProfile(profile_)->autocomplete_table(); | 103 PredictorDatabaseFactory::GetForProfile(profile_)->autocomplete_table(); |
104 | 104 |
105 // Create local caches using the database as loaded. We will garbage collect | 105 // Create local caches using the database as loaded. We will garbage collect |
106 // rows from the caches and the database once the history service is | 106 // rows from the caches and the database once the history service is |
107 // available. | 107 // available. |
108 std::vector<AutocompleteActionPredictorTable::Row>* rows = | 108 std::vector<AutocompleteActionPredictorTable::Row>* rows = |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 return number_of_hits / (number_of_hits + value.number_of_misses); | 569 return number_of_hits / (number_of_hits + value.number_of_misses); |
570 } | 570 } |
571 | 571 |
572 AutocompleteActionPredictor::TransitionalMatch::TransitionalMatch() { | 572 AutocompleteActionPredictor::TransitionalMatch::TransitionalMatch() { |
573 } | 573 } |
574 | 574 |
575 AutocompleteActionPredictor::TransitionalMatch::~TransitionalMatch() { | 575 AutocompleteActionPredictor::TransitionalMatch::~TransitionalMatch() { |
576 } | 576 } |
577 | 577 |
578 } // namespace predictors | 578 } // namespace predictors |
OLD | NEW |