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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_controller.h

Issue 376863003: Stop manually calling AddRef/Release for AutocompleteController::providers_ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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) 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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/memory/ref_counted.h"
11 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "base/timer/timer.h" 14 #include "base/timer/timer.h"
14 #include "chrome/browser/autocomplete/autocomplete_provider.h" 15 #include "chrome/browser/autocomplete/autocomplete_provider.h"
15 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" 16 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h"
16 #include "chrome/browser/autocomplete/autocomplete_result.h" 17 #include "chrome/browser/autocomplete/autocomplete_result.h"
17 #include "components/autocomplete/autocomplete_input.h" 18 #include "components/autocomplete/autocomplete_input.h"
18 19
19 class AutocompleteControllerDelegate; 20 class AutocompleteControllerDelegate;
20 class HistoryURLProvider; 21 class HistoryURLProvider;
(...skipping 18 matching lines...) Expand all
39 // 40 //
40 // IMPORTANT: There is NO THREAD SAFETY built into this portion of the 41 // IMPORTANT: There is NO THREAD SAFETY built into this portion of the
41 // autocomplete system. All calls to and from the AutocompleteController should 42 // autocomplete system. All calls to and from the AutocompleteController should
42 // happen on the same thread. AutocompleteProviders are responsible for doing 43 // happen on the same thread. AutocompleteProviders are responsible for doing
43 // their own thread management when they need to return matches asynchronously. 44 // their own thread management when they need to return matches asynchronously.
44 // 45 //
45 // The coordinator for autocomplete queries, responsible for combining the 46 // The coordinator for autocomplete queries, responsible for combining the
46 // matches from a series of providers into one AutocompleteResult. 47 // matches from a series of providers into one AutocompleteResult.
47 class AutocompleteController : public AutocompleteProviderListener { 48 class AutocompleteController : public AutocompleteProviderListener {
48 public: 49 public:
50 typedef std::vector<scoped_refptr<AutocompleteProvider> > Providers;
Peter Kasting 2014/07/09 01:07:32 Any particular reason to declare this here instead
hashimoto 2014/07/09 01:57:29 This typedef is only used as AutocompleteControlle
51
49 // |provider_types| is a bitmap containing AutocompleteProvider::Type values 52 // |provider_types| is a bitmap containing AutocompleteProvider::Type values
50 // that will (potentially, depending on platform, flags, etc.) be 53 // that will (potentially, depending on platform, flags, etc.) be
51 // instantiated. |template_url_service| is used to create URLs from the 54 // instantiated. |template_url_service| is used to create URLs from the
52 // autocomplete results. 55 // autocomplete results.
53 AutocompleteController(Profile* profile, 56 AutocompleteController(Profile* profile,
54 TemplateURLService* template_url_service, 57 TemplateURLService* template_url_service,
55 AutocompleteControllerDelegate* delegate, 58 AutocompleteControllerDelegate* delegate,
56 int provider_types); 59 int provider_types);
57 ~AutocompleteController(); 60 ~AutocompleteController();
58 61
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 125
123 // Deprecated. Do not use that method! It's provided temporarily as clank 126 // Deprecated. Do not use that method! It's provided temporarily as clank
124 // migrates. If you need to access the aucomplete input you should keep a 127 // migrates. If you need to access the aucomplete input you should keep a
125 // local copy of it. 128 // local copy of it.
126 // TODO(beaudoin): Remove this method once clank no longer rely on it. 129 // TODO(beaudoin): Remove this method once clank no longer rely on it.
127 // crbug.com/367832 130 // crbug.com/367832
128 const AutocompleteInput& input() const { return input_; } 131 const AutocompleteInput& input() const { return input_; }
129 132
130 const AutocompleteResult& result() const { return result_; } 133 const AutocompleteResult& result() const { return result_; }
131 bool done() const { return done_; } 134 bool done() const { return done_; }
132 const ACProviders* providers() const { return &providers_; } 135 const Providers& providers() const { return providers_; }
133 136
134 const base::TimeTicks& last_time_default_match_changed() const { 137 const base::TimeTicks& last_time_default_match_changed() const {
135 return last_time_default_match_changed_; 138 return last_time_default_match_changed_;
136 } 139 }
137 140
138 private: 141 private:
139 friend class AutocompleteProviderTest; 142 friend class AutocompleteProviderTest;
140 FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest, 143 FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest,
141 RedundantKeywordsIgnoredInResult); 144 RedundantKeywordsIgnoredInResult);
142 FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest, UpdateAssistedQueryStats); 145 FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest, UpdateAssistedQueryStats);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 187
185 // Starts |expire_timer_|. 188 // Starts |expire_timer_|.
186 void StartExpireTimer(); 189 void StartExpireTimer();
187 190
188 // Starts |stop_timer_|. 191 // Starts |stop_timer_|.
189 void StartStopTimer(); 192 void StartStopTimer();
190 193
191 AutocompleteControllerDelegate* delegate_; 194 AutocompleteControllerDelegate* delegate_;
192 195
193 // A list of all providers. 196 // A list of all providers.
194 ACProviders providers_; 197 Providers providers_;
195 198
196 HistoryURLProvider* history_url_provider_; 199 HistoryURLProvider* history_url_provider_;
197 200
198 KeywordProvider* keyword_provider_; 201 KeywordProvider* keyword_provider_;
199 202
200 SearchProvider* search_provider_; 203 SearchProvider* search_provider_;
201 204
202 ZeroSuggestProvider* zero_suggest_provider_; 205 ZeroSuggestProvider* zero_suggest_provider_;
203 206
204 // Input passed to Start. 207 // Input passed to Start.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // Are we in Start()? This is used to avoid updating |result_| and sending 242 // Are we in Start()? This is used to avoid updating |result_| and sending
240 // notifications until Start() has been invoked on all providers. 243 // notifications until Start() has been invoked on all providers.
241 bool in_start_; 244 bool in_start_;
242 245
243 TemplateURLService* template_url_service_; 246 TemplateURLService* template_url_service_;
244 247
245 DISALLOW_COPY_AND_ASSIGN(AutocompleteController); 248 DISALLOW_COPY_AND_ASSIGN(AutocompleteController);
246 }; 249 };
247 250
248 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ 251 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698