summaryrefslogtreecommitdiffstats
path: root/gin
diff options
context:
space:
mode:
authorkulkarni.a <kulkarni.a@samsung.com>2014-09-19 08:05:08 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-19 15:05:20 +0000
commit71a12a87117d7c88f02ec2c75b81726d12cbcc1a (patch)
tree1658693e96e68164ec1cdb35f58e80c4da0ca13e /gin
parent89b276fbcd87b3ce88be7b0a00df6d9266d90ad6 (diff)
downloadchromium_src-71a12a87117d7c88f02ec2c75b81726d12cbcc1a.zip
chromium_src-71a12a87117d7c88f02ec2c75b81726d12cbcc1a.tar.gz
chromium_src-71a12a87117d7c88f02ec2c75b81726d12cbcc1a.tar.bz2
Code re-factor related to WeakPtrFactory in src/gin module
Changing in the initialization order of WeakPtrFactory in src/gin module such that all member variables should appear before the WeakPtrFactory to ensure that any WeakPtrs to Controller are invalidated before its members variable's destructor are executed, rendering them invalid. BUG=303818 Review URL: https://codereview.chromium.org/580703002 Cr-Commit-Position: refs/heads/master@{#295709}
Diffstat (limited to 'gin')
-rw-r--r--gin/modules/timer.cc6
-rw-r--r--gin/modules/timer.h3
2 files changed, 5 insertions, 4 deletions
diff --git a/gin/modules/timer.cc b/gin/modules/timer.cc
index 3196dda..4ba7f91 100644
--- a/gin/modules/timer.cc
+++ b/gin/modules/timer.cc
@@ -41,10 +41,10 @@ ObjectTemplateBuilder Timer::GetObjectTemplateBuilder(v8::Isolate* isolate) {
Timer::Timer(v8::Isolate* isolate, bool repeating, int delay_ms,
v8::Handle<v8::Function> function)
- : weak_factory_(this),
- timer_(false, repeating),
+ : timer_(false, repeating),
runner_(PerContextData::From(
- isolate->GetCurrentContext())->runner()->GetWeakPtr()) {
+ isolate->GetCurrentContext())->runner()->GetWeakPtr()),
+ weak_factory_(this) {
GetWrapper(runner_->GetContextHolder()->isolate())->SetHiddenValue(
GetHiddenPropertyName(isolate), function);
timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(delay_ms),
diff --git a/gin/modules/timer.h b/gin/modules/timer.h
index e2bed2e..da17fe1 100644
--- a/gin/modules/timer.h
+++ b/gin/modules/timer.h
@@ -38,9 +38,10 @@ class GIN_EXPORT Timer : public Wrappable<Timer> {
virtual ~Timer();
void OnTimerFired();
- base::WeakPtrFactory<Timer> weak_factory_;
base::Timer timer_;
base::WeakPtr<gin::Runner> runner_;
+ base::WeakPtrFactory<Timer> weak_factory_;
+
};