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

Side by Side Diff: chrome/browser/autocomplete/autocomplete.cc

Issue 6780035: Use lock-free lazy initialization for static histogram references (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/autocomplete/autocomplete.h" 5 #include "chrome/browser/autocomplete/autocomplete.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 base::TimeTicks start_time = base::TimeTicks::Now(); 856 base::TimeTicks start_time = base::TimeTicks::Now();
857 for (ACProviders::iterator i(providers_.begin()); i != providers_.end(); 857 for (ACProviders::iterator i(providers_.begin()); i != providers_.end();
858 ++i) { 858 ++i) {
859 (*i)->Start(input_, minimal_changes); 859 (*i)->Start(input_, minimal_changes);
860 if (matches_requested != AutocompleteInput::ALL_MATCHES) 860 if (matches_requested != AutocompleteInput::ALL_MATCHES)
861 DCHECK((*i)->done()); 861 DCHECK((*i)->done());
862 } 862 }
863 if (matches_requested == AutocompleteInput::ALL_MATCHES && text.size() < 6) { 863 if (matches_requested == AutocompleteInput::ALL_MATCHES && text.size() < 6) {
864 base::TimeTicks end_time = base::TimeTicks::Now(); 864 base::TimeTicks end_time = base::TimeTicks::Now();
865 std::string name = "Omnibox.QueryTime." + base::IntToString(text.size()); 865 std::string name = "Omnibox.QueryTime." + base::IntToString(text.size());
866 scoped_refptr<base::Histogram> counter = base::Histogram::FactoryGet( 866 base::Histogram* counter = base::Histogram::FactoryGet(
867 name, 1, 1000, 50, base::Histogram::kUmaTargetedHistogramFlag); 867 name, 1, 1000, 50, base::Histogram::kUmaTargetedHistogramFlag);
868 counter->Add(static_cast<int>((end_time - start_time).InMilliseconds())); 868 counter->Add(static_cast<int>((end_time - start_time).InMilliseconds()));
869 } 869 }
870 in_start_ = false; 870 in_start_ = false;
871 CheckIfDone(); 871 CheckIfDone();
872 UpdateResult(true); 872 UpdateResult(true);
873 873
874 if (!done_) 874 if (!done_)
875 StartExpireTimer(); 875 StartExpireTimer();
876 } 876 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 } 981 }
982 } 982 }
983 done_ = true; 983 done_ = true;
984 } 984 }
985 985
986 void AutocompleteController::StartExpireTimer() { 986 void AutocompleteController::StartExpireTimer() {
987 if (result_.HasCopiedMatches()) 987 if (result_.HasCopiedMatches())
988 expire_timer_.Start(base::TimeDelta::FromMilliseconds(kExpireTimeMS), 988 expire_timer_.Start(base::TimeDelta::FromMilliseconds(kExpireTimeMS),
989 this, &AutocompleteController::ExpireCopiedEntries); 989 this, &AutocompleteController::ExpireCopiedEntries);
990 } 990 }
OLDNEW
« no previous file with comments | « base/metrics/histogram_unittest.cc ('k') | chrome/browser/autocomplete/history_quick_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698