WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
20469
Close leak of PausedTimeouts, and clean up ownership
https://bugs.webkit.org/show_bug.cgi?id=20469
Summary
Close leak of PausedTimeouts, and clean up ownership
Eric Seidel (no email)
Reported
2008-08-20 16:54:36 PDT
Close leak of PausedTimeouts, and clean up ownership See attached patch.
Attachments
First attempt at PausedTimeouts cleanup
(9.99 KB, patch)
2008-08-20 16:58 PDT
,
Eric Seidel (no email)
no flags
Details
Formatted Diff
Diff
First attempt at PausedTimeouts cleanup
(10.14 KB, patch)
2008-08-20 17:01 PDT
,
Eric Seidel (no email)
darin
: review-
Details
Formatted Diff
Diff
Updated patch with darin's suggested changes
(10.48 KB, patch)
2008-08-28 04:20 PDT
,
Eric Seidel (no email)
ap
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Eric Seidel (no email)
Comment 1
2008-08-20 16:58:53 PDT
Created
attachment 22907
[details]
First attempt at PausedTimeouts cleanup WebCore/ChangeLog | 31 ++++++++++++++++++++++++++++++ WebCore/bindings/js/JSDOMWindowBase.cpp | 21 ++++++++++--------- WebCore/bindings/js/JSDOMWindowBase.h | 5 ++- WebCore/bindings/js/ScriptController.cpp | 11 ++++++++++ WebCore/bindings/js/ScriptController.h | 3 ++ WebCore/history/CachedPage.cpp | 4 +- WebCore/page/Chrome.cpp | 24 ++++++++-------------- WebCore/page/JavaScriptDebugServer.cpp | 14 +++++++++--- 8 files changed, 80 insertions(+), 33 deletions(-)
Eric Seidel (no email)
Comment 2
2008-08-20 17:01:25 PDT
Created
attachment 22908
[details]
First attempt at PausedTimeouts cleanup WebCore/ChangeLog | 34 ++++++++++++++++++++++++++++++ WebCore/bindings/js/JSDOMWindowBase.cpp | 21 +++++++++-------- WebCore/bindings/js/JSDOMWindowBase.h | 5 ++- WebCore/bindings/js/ScriptController.cpp | 11 +++++++++ WebCore/bindings/js/ScriptController.h | 3 ++ WebCore/history/CachedPage.cpp | 4 +- WebCore/page/Chrome.cpp | 24 ++++++++------------- WebCore/page/JavaScriptDebugServer.cpp | 14 ++++++++--- 8 files changed, 83 insertions(+), 33 deletions(-)
Darin Adler
Comment 3
2008-08-22 10:47:16 PDT
Comment on
attachment 22908
[details]
First attempt at PausedTimeouts cleanup Good change! + void resumeTimeouts(OwnPtr<PausedTimeouts>&); You're declaring this in ScriptController.h, but I don't see an implemention in ScriptController.cpp. - size_t count = m_deferredFrames.size(); - for (size_t i = 0; i < count; ++i) + for (size_t i = 0; i < m_deferredFrames.size(); ++i) Why this change? It makes the loop potentially slower by putting the calls to size() inside the loop instead of outside. Is there a benefit to the change? + OwnPtr<PausedTimeouts> timeouts = m_pausedTimeouts[i].second; + OwnPtr<PausedTimeouts> timeouts(m_pausedTimeouts.take(frame)); Why did you use assignment syntax in the first case, but not the second. Consistent would be better. I'm going to say review- because of the resumeTimeouts issue. I think the patch won't build!
Darin Adler
Comment 4
2008-08-22 10:47:16 PDT
Comment on
attachment 22908
[details]
First attempt at PausedTimeouts cleanup Good change! + void resumeTimeouts(OwnPtr<PausedTimeouts>&); You're declaring this in ScriptController.h, but I don't see an implemention in ScriptController.cpp. - size_t count = m_deferredFrames.size(); - for (size_t i = 0; i < count; ++i) + for (size_t i = 0; i < m_deferredFrames.size(); ++i) Why this change? It makes the loop potentially slower by putting the calls to size() inside the loop instead of outside. Is there a benefit to the change? + OwnPtr<PausedTimeouts> timeouts = m_pausedTimeouts[i].second; + OwnPtr<PausedTimeouts> timeouts(m_pausedTimeouts.take(frame)); Why did you use assignment syntax in the first case, but not the second. Consistent would be better. I'm going to say review- because of the resumeTimeouts issue. I think the patch won't build!
Eric Seidel (no email)
Comment 5
2008-08-28 04:18:14 PDT
(In reply to
comment #4
)
> (From update of
attachment 22908
[details]
[edit]) > Good change! > > + void resumeTimeouts(OwnPtr<PausedTimeouts>&); > > You're declaring this in ScriptController.h, but I don't see an implemention in > ScriptController.cpp.
Yeah, it was missing. Oops!
> - size_t count = m_deferredFrames.size(); > - for (size_t i = 0; i < count; ++i) > + for (size_t i = 0; i < m_deferredFrames.size(); ++i) > > Why this change? It makes the loop potentially slower by putting the calls to > size() inside the loop instead of outside. Is there a benefit to the change?
It made the code smaller, and I know that Vector is a template, and thus all methods must be inlined, so the count is just a member access thus there is no function call overhead. Perhaps that's cheating? I can change it back if you feel strongly.
> + OwnPtr<PausedTimeouts> timeouts = m_pausedTimeouts[i].second; > > + OwnPtr<PausedTimeouts> timeouts(m_pausedTimeouts.take(frame)); > > Why did you use assignment syntax in the first case, but not the second. > Consistent would be better.
Fixed.
> I'm going to say review- because of the resumeTimeouts issue. I think the patch > won't build!
Yup. Builds and runs fine on Mac, but wouldn't have on Windows! Fixed.
Eric Seidel (no email)
Comment 6
2008-08-28 04:20:52 PDT
Created
attachment 23052
[details]
Updated patch with darin's suggested changes WebCore/ChangeLog | 35 ++++++++++++++++++++++++++++++ WebCore/bindings/js/JSDOMWindowBase.cpp | 21 +++++++++-------- WebCore/bindings/js/JSDOMWindowBase.h | 5 ++- WebCore/bindings/js/ScriptController.cpp | 22 ++++++++++++++++++ WebCore/bindings/js/ScriptController.h | 3 ++ WebCore/history/CachedPage.cpp | 4 +- WebCore/page/Chrome.cpp | 26 ++++++++------------- WebCore/page/JavaScriptDebugServer.cpp | 14 ++++++++--- 8 files changed, 96 insertions(+), 34 deletions(-)
Eric Seidel (no email)
Comment 7
2008-08-28 04:23:19 PDT
(In reply to
comment #5
)
> (In reply to
comment #4
) > ... thus all > methods must be inlined, so the count is just a member access thus there is no > function call overhead.
I meant that all methods must be declared in a header, and thus highly likely to be inlined. I guess I'm choosing more and more code size and cleanliness over possible speed optimizations these days.
Alexey Proskuryakov
Comment 8
2008-08-28 04:38:23 PDT
Comment on
attachment 23052
[details]
Updated patch with darin's suggested changes r=me, based on Darin's earlier review.
Eric Seidel (no email)
Comment 9
2008-08-28 04:42:55 PDT
Thanks to both of you!
r35964
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug