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

Side by Side Diff: components/suggestions/suggestions_service.cc

Issue 554233002: Refactoring the WeakPtrFactory usage, Member variables should appear before the WeakPtrFactory, to … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/suggestions/suggestions_service.h" 5 #include "components/suggestions/suggestions_service.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 SuggestionsService::SuggestionsService( 120 SuggestionsService::SuggestionsService(
121 net::URLRequestContextGetter* url_request_context, 121 net::URLRequestContextGetter* url_request_context,
122 scoped_ptr<SuggestionsStore> suggestions_store, 122 scoped_ptr<SuggestionsStore> suggestions_store,
123 scoped_ptr<ImageManager> thumbnail_manager, 123 scoped_ptr<ImageManager> thumbnail_manager,
124 scoped_ptr<BlacklistStore> blacklist_store) 124 scoped_ptr<BlacklistStore> blacklist_store)
125 : suggestions_store_(suggestions_store.Pass()), 125 : suggestions_store_(suggestions_store.Pass()),
126 blacklist_store_(blacklist_store.Pass()), 126 blacklist_store_(blacklist_store.Pass()),
127 thumbnail_manager_(thumbnail_manager.Pass()), 127 thumbnail_manager_(thumbnail_manager.Pass()),
128 url_request_context_(url_request_context), 128 url_request_context_(url_request_context),
129 blacklist_delay_sec_(kBlacklistDefaultDelaySec), 129 blacklist_delay_sec_(kBlacklistDefaultDelaySec),
130 weak_ptr_factory_(this), 130 request_timeout_ms_(kDefaultRequestTimeoutMs),
131 request_timeout_ms_(kDefaultRequestTimeoutMs) { 131 weak_ptr_factory_(this) {
132 // Obtain various parameters from Variations. 132 // Obtain various parameters from Variations.
133 suggestions_url_ = 133 suggestions_url_ =
134 GURL(GetExperimentParam(kSuggestionsFieldTrialURLParam) + "?" + 134 GURL(GetExperimentParam(kSuggestionsFieldTrialURLParam) + "?" +
135 GetExperimentParam(kSuggestionsFieldTrialCommonParamsParam)); 135 GetExperimentParam(kSuggestionsFieldTrialCommonParamsParam));
136 blacklist_url_prefix_ = GetBlacklistUrlPrefix(); 136 blacklist_url_prefix_ = GetBlacklistUrlPrefix();
137 std::string timeout = GetExperimentParam(kSuggestionsFieldTrialTimeoutMs); 137 std::string timeout = GetExperimentParam(kSuggestionsFieldTrialTimeoutMs);
138 int temp_timeout; 138 int temp_timeout;
139 if (!timeout.empty() && base::StringToInt(timeout, &temp_timeout)) { 139 if (!timeout.empty() && base::StringToInt(timeout, &temp_timeout)) {
140 request_timeout_ms_ = temp_timeout; 140 request_timeout_ms_ = temp_timeout;
141 } 141 }
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 if (last_request_successful) { 416 if (last_request_successful) {
417 blacklist_delay_sec_ = kBlacklistDefaultDelaySec; 417 blacklist_delay_sec_ = kBlacklistDefaultDelaySec;
418 } else { 418 } else {
419 int candidate_delay = blacklist_delay_sec_ * kBlacklistBackoffMultiplier; 419 int candidate_delay = blacklist_delay_sec_ * kBlacklistBackoffMultiplier;
420 if (candidate_delay < kBlacklistMaxDelaySec) 420 if (candidate_delay < kBlacklistMaxDelaySec)
421 blacklist_delay_sec_ = candidate_delay; 421 blacklist_delay_sec_ = candidate_delay;
422 } 422 }
423 } 423 }
424 424
425 } // namespace suggestions 425 } // namespace suggestions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698