Commit 37571758 authored by anand.ratn's avatar anand.ratn Committed by Commit bot

Declaring the weak_ptr_factory in proper order.

Cleaning up weak_ptr_factory destruction order in "src/chrome/browser/history"
module. WeakPtrFactory should remain the last member so it'll be destroyed and
invalidate its weak pointers before any other members are destroyed.

BUG=303818

Review URL: https://codereview.chromium.org/574313002

Cr-Commit-Position: refs/heads/master@{#295926}
parent 8e584114
...@@ -97,9 +97,9 @@ class WaitForHistoryTask : public HistoryDBTask { ...@@ -97,9 +97,9 @@ class WaitForHistoryTask : public HistoryDBTask {
class TopSitesQuerier { class TopSitesQuerier {
public: public:
TopSitesQuerier() TopSitesQuerier()
: weak_ptr_factory_(this), : number_of_callbacks_(0),
number_of_callbacks_(0), waiting_(false),
waiting_(false) {} weak_ptr_factory_(this) {}
// Queries top sites. If |wait| is true a nested message loop is run until the // Queries top sites. If |wait| is true a nested message loop is run until the
// callback is notified. // callback is notified.
...@@ -143,10 +143,10 @@ class TopSitesQuerier { ...@@ -143,10 +143,10 @@ class TopSitesQuerier {
} }
} }
base::WeakPtrFactory<TopSitesQuerier> weak_ptr_factory_;
MostVisitedURLList urls_; MostVisitedURLList urls_;
int number_of_callbacks_; int number_of_callbacks_;
bool waiting_; bool waiting_;
base::WeakPtrFactory<TopSitesQuerier> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(TopSitesQuerier); DISALLOW_COPY_AND_ASSIGN(TopSitesQuerier);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment