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

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

Issue 1815653002: Revert of Add traces for main omnibox providers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 (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 "components/omnibox/browser/history_url_provider.h" 5 #include "components/omnibox/browser/history_url_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "base/trace_event/trace_event.h"
20 #include "components/bookmarks/browser/bookmark_utils.h" 19 #include "components/bookmarks/browser/bookmark_utils.h"
21 #include "components/history/core/browser/history_backend.h" 20 #include "components/history/core/browser/history_backend.h"
22 #include "components/history/core/browser/history_database.h" 21 #include "components/history/core/browser/history_database.h"
23 #include "components/history/core/browser/history_service.h" 22 #include "components/history/core/browser/history_service.h"
24 #include "components/history/core/browser/history_types.h" 23 #include "components/history/core/browser/history_types.h"
25 #include "components/metrics/proto/omnibox_input_type.pb.h" 24 #include "components/metrics/proto/omnibox_input_type.pb.h"
26 #include "components/omnibox/browser/autocomplete_match.h" 25 #include "components/omnibox/browser/autocomplete_match.h"
27 #include "components/omnibox/browser/autocomplete_provider_listener.h" 26 #include "components/omnibox/browser/autocomplete_provider_listener.h"
28 #include "components/omnibox/browser/autocomplete_result.h" 27 #include "components/omnibox/browser/autocomplete_result.h"
29 #include "components/omnibox/browser/in_memory_url_index_types.h" 28 #include "components/omnibox/browser/in_memory_url_index_types.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 params_(NULL), 449 params_(NULL),
451 search_url_database_(OmniboxFieldTrial::HUPSearchDatabase()) { 450 search_url_database_(OmniboxFieldTrial::HUPSearchDatabase()) {
452 // Initialize the default HUP scoring params. 451 // Initialize the default HUP scoring params.
453 OmniboxFieldTrial::GetDefaultHUPScoringParams(&scoring_params_); 452 OmniboxFieldTrial::GetDefaultHUPScoringParams(&scoring_params_);
454 // Initialize HUP scoring params based on the current experiment. 453 // Initialize HUP scoring params based on the current experiment.
455 OmniboxFieldTrial::GetExperimentalHUPScoringParams(&scoring_params_); 454 OmniboxFieldTrial::GetExperimentalHUPScoringParams(&scoring_params_);
456 } 455 }
457 456
458 void HistoryURLProvider::Start(const AutocompleteInput& input, 457 void HistoryURLProvider::Start(const AutocompleteInput& input,
459 bool minimal_changes) { 458 bool minimal_changes) {
460 TRACE_EVENT0("omnibox", "HistoryURLProvider::Start");
461 // NOTE: We could try hard to do less work in the |minimal_changes| case 459 // NOTE: We could try hard to do less work in the |minimal_changes| case
462 // here; some clever caching would let us reuse the raw matches from the 460 // here; some clever caching would let us reuse the raw matches from the
463 // history DB without re-querying. However, we'd still have to go back to 461 // history DB without re-querying. However, we'd still have to go back to
464 // the history thread to mark these up properly, and if pass 2 is currently 462 // the history thread to mark these up properly, and if pass 2 is currently
465 // running, we'd need to wait for it to return to the main thread before 463 // running, we'd need to wait for it to return to the main thread before
466 // doing this (we can't just write new data for it to read due to thread 464 // doing this (we can't just write new data for it to read due to thread
467 // safety issues). At that point it's just as fast, and easier, to simply 465 // safety issues). At that point it's just as fast, and easier, to simply
468 // re-run the query from scratch and ignore |minimal_changes|. 466 // re-run the query from scratch and ignore |minimal_changes|.
469 467
470 // Cancel any in-progress query. 468 // Cancel any in-progress query.
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 // take care of adding this defaultable match.) 834 // take care of adding this defaultable match.)
837 if ((params.promote_type == HistoryURLProviderParams::WHAT_YOU_TYPED_MATCH) || 835 if ((params.promote_type == HistoryURLProviderParams::WHAT_YOU_TYPED_MATCH) ||
838 (params.prevent_inline_autocomplete && 836 (params.prevent_inline_autocomplete &&
839 params.have_what_you_typed_match)) { 837 params.have_what_you_typed_match)) {
840 matches_.push_back(params.what_you_typed_match); 838 matches_.push_back(params.what_you_typed_match);
841 } 839 }
842 } 840 }
843 841
844 void HistoryURLProvider::QueryComplete( 842 void HistoryURLProvider::QueryComplete(
845 HistoryURLProviderParams* params_gets_deleted) { 843 HistoryURLProviderParams* params_gets_deleted) {
846 TRACE_EVENT0("omnibox", "HistoryURLProvider::QueryComplete");
847 // Ensure |params_gets_deleted| gets deleted on exit. 844 // Ensure |params_gets_deleted| gets deleted on exit.
848 scoped_ptr<HistoryURLProviderParams> params(params_gets_deleted); 845 scoped_ptr<HistoryURLProviderParams> params(params_gets_deleted);
849 846
850 // If the user hasn't already started another query, clear our member pointer 847 // If the user hasn't already started another query, clear our member pointer
851 // so we can't write into deleted memory. 848 // so we can't write into deleted memory.
852 if (params_ == params_gets_deleted) 849 if (params_ == params_gets_deleted)
853 params_ = NULL; 850 params_ = NULL;
854 851
855 // Don't send responses for queries that have been canceled. 852 // Don't send responses for queries that have been canceled.
856 if (params->cancel_flag.IsSet()) 853 if (params->cancel_flag.IsSet())
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, 1195 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0,
1199 match.contents.length(), ACMatchClassification::URL, 1196 match.contents.length(), ACMatchClassification::URL,
1200 &match.contents_class); 1197 &match.contents_class);
1201 } 1198 }
1202 match.description = info.title(); 1199 match.description = info.title();
1203 match.description_class = 1200 match.description_class =
1204 ClassifyDescription(params.input.text(), match.description); 1201 ClassifyDescription(params.input.text(), match.description);
1205 RecordAdditionalInfoFromUrlRow(info, &match); 1202 RecordAdditionalInfoFromUrlRow(info, &match);
1206 return match; 1203 return match;
1207 } 1204 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/history_quick_provider.cc ('k') | components/omnibox/browser/keyword_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698