summaryrefslogtreecommitdiffstats
path: root/components/suggestions
diff options
context:
space:
mode:
authormohan.reddy <mohan.reddy@samsung.com>2014-09-10 06:33:00 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-10 13:42:19 +0000
commitd97aafa2698638f2f207538980014b6e461e382c (patch)
tree8720732fc762671e92d85491f304e7a493583119 /components/suggestions
parent534f477b55a79cb4829d95c48d310cfedca09470 (diff)
downloadchromium_src-d97aafa2698638f2f207538980014b6e461e382c.zip
chromium_src-d97aafa2698638f2f207538980014b6e461e382c.tar.gz
chromium_src-d97aafa2698638f2f207538980014b6e461e382c.tar.bz2
Refactoring the WeakPtrFactory usage, Member variables should appear before the WeakPtrFactory, to ensure that any WeakPtrs to Controller are invalidated before its members variable's destructors are executed, rendering them invalid.
BUG=303818 Review URL: https://codereview.chromium.org/554233002 Cr-Commit-Position: refs/heads/master@{#294163}
Diffstat (limited to 'components/suggestions')
-rw-r--r--components/suggestions/suggestions_service.cc4
-rw-r--r--components/suggestions/suggestions_service.h6
2 files changed, 5 insertions, 5 deletions
diff --git a/components/suggestions/suggestions_service.cc b/components/suggestions/suggestions_service.cc
index b12aae1..e7b0397 100644
--- a/components/suggestions/suggestions_service.cc
+++ b/components/suggestions/suggestions_service.cc
@@ -127,8 +127,8 @@ SuggestionsService::SuggestionsService(
thumbnail_manager_(thumbnail_manager.Pass()),
url_request_context_(url_request_context),
blacklist_delay_sec_(kBlacklistDefaultDelaySec),
- weak_ptr_factory_(this),
- request_timeout_ms_(kDefaultRequestTimeoutMs) {
+ request_timeout_ms_(kDefaultRequestTimeoutMs),
+ weak_ptr_factory_(this) {
// Obtain various parameters from Variations.
suggestions_url_ =
GURL(GetExperimentParam(kSuggestionsFieldTrialURLParam) + "?" +
diff --git a/components/suggestions/suggestions_service.h b/components/suggestions/suggestions_service.h
index e495f7f..aa30ba2 100644
--- a/components/suggestions/suggestions_service.h
+++ b/components/suggestions/suggestions_service.h
@@ -188,13 +188,13 @@ class SuggestionsService : public KeyedService, public net::URLFetcherDelegate {
// Delay used when scheduling a blacklisting task.
int blacklist_delay_sec_;
- // For callbacks may be run after destruction.
- base::WeakPtrFactory<SuggestionsService> weak_ptr_factory_;
-
// Timeout (in ms) before serving requestors after a fetch suggestions request
// has been issued.
int request_timeout_ms_;
+ // For callbacks may be run after destruction.
+ base::WeakPtrFactory<SuggestionsService> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(SuggestionsService);
};