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

Side by Side Diff: Source/WebCore/page/SuspendableTimer.cpp

Issue 6349095: Merge 77355 - 2011-02-01 Mihai Parparita <mihaip@chromium.org>... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/648/
Patch Set: Created 9 years, 10 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
« no previous file with comments | « Source/WebCore/page/SuspendableTimer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 18 matching lines...) Expand all
29 29
30 #include "ScriptExecutionContext.h" 30 #include "ScriptExecutionContext.h"
31 31
32 namespace WebCore { 32 namespace WebCore {
33 33
34 SuspendableTimer::SuspendableTimer(ScriptExecutionContext* context) 34 SuspendableTimer::SuspendableTimer(ScriptExecutionContext* context)
35 : ActiveDOMObject(context, this) 35 : ActiveDOMObject(context, this)
36 , m_nextFireInterval(0) 36 , m_nextFireInterval(0)
37 , m_repeatInterval(0) 37 , m_repeatInterval(0)
38 #if !ASSERT_DISABLED 38 #if !ASSERT_DISABLED
39 , m_active(false)
39 , m_suspended(false) 40 , m_suspended(false)
40 #endif 41 #endif
41 { 42 {
42 } 43 }
43 44
44 SuspendableTimer::~SuspendableTimer() 45 SuspendableTimer::~SuspendableTimer()
45 { 46 {
46 } 47 }
47 48
48 bool SuspendableTimer::hasPendingActivity() const 49 bool SuspendableTimer::hasPendingActivity() const
49 { 50 {
50 return isActive(); 51 return isActive();
51 } 52 }
52 53
53 void SuspendableTimer::stop() 54 void SuspendableTimer::stop()
54 { 55 {
55 TimerBase::stop(); 56 TimerBase::stop();
56 } 57 }
57 58
58 void SuspendableTimer::suspend(ReasonForSuspension) 59 void SuspendableTimer::suspend(ReasonForSuspension)
59 { 60 {
60 #if !ASSERT_DISABLED 61 #if !ASSERT_DISABLED
61 ASSERT(!m_suspended); 62 ASSERT(!m_suspended);
62 m_suspended = true; 63 m_suspended = true;
63 #endif 64 #endif
64 m_nextFireInterval = nextFireInterval(); 65 m_active = isActive();
65 m_repeatInterval = repeatInterval(); 66 if (m_active) {
66 TimerBase::stop(); 67 m_nextFireInterval = nextFireInterval();
68 m_repeatInterval = repeatInterval();
69 TimerBase::stop();
70 }
67 } 71 }
68 72
69 void SuspendableTimer::resume() 73 void SuspendableTimer::resume()
70 { 74 {
71 #if !ASSERT_DISABLED 75 #if !ASSERT_DISABLED
72 ASSERT(m_suspended); 76 ASSERT(m_suspended);
73 m_suspended = false; 77 m_suspended = false;
74 #endif 78 #endif
75 start(m_nextFireInterval, m_repeatInterval); 79 if (m_active)
80 start(m_nextFireInterval, m_repeatInterval);
76 } 81 }
77 82
78 bool SuspendableTimer::canSuspend() const 83 bool SuspendableTimer::canSuspend() const
79 { 84 {
80 return true; 85 return true;
81 } 86 }
82 87
83 } // namespace WebCore 88 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/page/SuspendableTimer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698