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

Side by Side Diff: chrome/browser/predictors/autocomplete_action_predictor.cc

Issue 12225093: chrome/browser/predictors componentization part-1 Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | chrome/browser/predictors/autocomplete_action_predictor_table.h » ('j') | 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/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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/guid.h" 12 #include "base/guid.h"
13 #include "base/i18n/case_conversion.h" 13 #include "base/i18n/case_conversion.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/stringprintf.h" 16 #include "base/stringprintf.h"
17 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
18 #include "chrome/browser/autocomplete/autocomplete_log.h" 18 #include "chrome/browser/autocomplete/autocomplete_log.h"
19 #include "chrome/browser/autocomplete/autocomplete_match.h" 19 #include "chrome/browser/autocomplete/autocomplete_match.h"
20 #include "chrome/browser/autocomplete/autocomplete_result.h" 20 #include "chrome/browser/autocomplete/autocomplete_result.h"
21 #include "chrome/browser/history/history_notifications.h" 21 #include "chrome/browser/history/history_notifications.h"
22 #include "chrome/browser/history/history_service.h" 22 #include "chrome/browser/history/history_service.h"
23 #include "chrome/browser/history/history_service_factory.h" 23 #include "chrome/browser/history/history_service_factory.h"
24 #include "chrome/browser/history/in_memory_database.h" 24 #include "chrome/browser/history/in_memory_database.h"
25 #include "chrome/browser/predictors/autocomplete_action_predictor_factory.h" 25 #include "chrome/browser/predictors/autocomplete_action_predictor_factory.h"
26 #include "chrome/browser/predictors/predictor_database.h"
27 #include "chrome/browser/predictors/predictor_database_factory.h" 26 #include "chrome/browser/predictors/predictor_database_factory.h"
27 #include "chrome/browser/predictors/predictor_database_service.h"
28 #include "chrome/browser/prerender/prerender_field_trial.h" 28 #include "chrome/browser/prerender/prerender_field_trial.h"
29 #include "chrome/browser/prerender/prerender_handle.h" 29 #include "chrome/browser/prerender/prerender_handle.h"
30 #include "chrome/browser/prerender/prerender_manager.h" 30 #include "chrome/browser/prerender/prerender_manager.h"
31 #include "chrome/browser/prerender/prerender_manager_factory.h" 31 #include "chrome/browser/prerender/prerender_manager_factory.h"
32 #include "chrome/browser/profiles/profile.h" 32 #include "chrome/browser/profiles/profile.h"
33 #include "chrome/common/chrome_notification_types.h" 33 #include "chrome/common/chrome_notification_types.h"
34 #include "content/public/browser/browser_thread.h" 34 #include "content/public/browser/browser_thread.h"
35 #include "content/public/browser/notification_details.h" 35 #include "content/public/browser/notification_details.h"
36 #include "content/public/browser/notification_service.h" 36 #include "content/public/browser/notification_service.h"
37 #include "content/public/browser/notification_source.h" 37 #include "content/public/browser/notification_source.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 CopyFromMainProfile(); 78 CopyFromMainProfile();
79 } else { 79 } else {
80 // Request the in-memory database from the history to force it to load so 80 // Request the in-memory database from the history to force it to load so
81 // it's available as soon as possible. 81 // it's available as soon as possible.
82 HistoryService* history_service = HistoryServiceFactory::GetForProfile( 82 HistoryService* history_service = HistoryServiceFactory::GetForProfile(
83 profile_, Profile::EXPLICIT_ACCESS); 83 profile_, Profile::EXPLICIT_ACCESS);
84 if (history_service) 84 if (history_service)
85 history_service->InMemoryDatabase(); 85 history_service->InMemoryDatabase();
86 86
87 table_ = 87 table_ =
88 PredictorDatabaseFactory::GetForProfile(profile_)->autocomplete_table(); 88 PredictorDatabaseFactory::GetForProfile(profile_)->GetDatabase()->
89 autocomplete_table();
89 90
90 // Observe all main frame loads so we can wait for the first to complete 91 // Observe all main frame loads so we can wait for the first to complete
91 // before accessing DB and IO threads to build the local cache. 92 // before accessing DB and IO threads to build the local cache.
92 notification_registrar_.Add(this, 93 notification_registrar_.Add(this,
93 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, 94 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
94 content::NotificationService::AllSources()); 95 content::NotificationService::AllSources());
95 } 96 }
96 } 97 }
97 98
98 AutocompleteActionPredictor::~AutocompleteActionPredictor() { 99 AutocompleteActionPredictor::~AutocompleteActionPredictor() {
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 return number_of_hits / (number_of_hits + value.number_of_misses); 576 return number_of_hits / (number_of_hits + value.number_of_misses);
576 } 577 }
577 578
578 AutocompleteActionPredictor::TransitionalMatch::TransitionalMatch() { 579 AutocompleteActionPredictor::TransitionalMatch::TransitionalMatch() {
579 } 580 }
580 581
581 AutocompleteActionPredictor::TransitionalMatch::~TransitionalMatch() { 582 AutocompleteActionPredictor::TransitionalMatch::~TransitionalMatch() {
582 } 583 }
583 584
584 } // namespace predictors 585 } // namespace predictors
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/predictors/autocomplete_action_predictor_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698