Bug 124053 - JSManagedValue should automatically call removeManagedReference:withOwner: upon dealloc
Summary: JSManagedValue should automatically call removeManagedReference:withOwner: up...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Hahnenberg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-08 10:47 PST by Mark Hahnenberg
Modified: 2014-02-06 16:25 PST (History)
2 users (show)

See Also:


Attachments
Patch (12.63 KB, patch)
2013-11-08 11:21 PST, Mark Hahnenberg
no flags Details | Formatted Diff | Diff
Patch (13.14 KB, patch)
2014-02-06 11:21 PST, Mark Hahnenberg
no flags Details | Formatted Diff | Diff
Patch (13.22 KB, patch)
2014-02-06 11:35 PST, Mark Hahnenberg
no flags Details | Formatted Diff | Diff
Patch (13.54 KB, patch)
2014-02-06 12:29 PST, Mark Hahnenberg
no flags Details | Formatted Diff | Diff
Patch (13.54 KB, patch)
2014-02-06 13:21 PST, Mark Hahnenberg
no flags Details | Formatted Diff | Diff
Patch (13.68 KB, patch)
2014-02-06 14:19 PST, Mark Hahnenberg
no flags Details | Formatted Diff | Diff
Patch (14.21 KB, patch)
2014-02-06 14:26 PST, Mark Hahnenberg
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Hahnenberg 2013-11-08 10:47:02 PST
This would make managing JSManagedValue lifetime much easier.
Comment 1 Mark Hahnenberg 2013-11-08 11:21:57 PST
Created attachment 216414 [details]
Patch
Comment 2 Mark Hahnenberg 2013-11-08 11:22:32 PST
(In reply to comment #1)
> Created an attachment (id=216414) [details]
> Patch

Still needs API approval and availability macros.
Comment 3 Mark Hahnenberg 2013-11-08 11:23:08 PST
<rdar://problem/15409543>
Comment 4 Oliver Hunt 2013-11-08 11:30:05 PST
Comment on attachment 216414 [details]
Patch

What will this do to clients that already do the work to avoid the leak? Are they all using the existing api?
Comment 5 Geoffrey Garen 2013-11-08 11:31:29 PST
Comment on attachment 216414 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=216414&action=review

r=me, pending those things.

> Source/JavaScriptCore/API/JSManagedValue.h:58
> ++ (JSManagedValue *)managedValueWithValue:(JSValue *)value andOwner:(id)owner;

It looks like the canonical ObjC API idiom is to leave off "and". For example, -[NSString – initWithBytes:length:encoding:].
Comment 6 Mark Hahnenberg 2013-11-08 11:32:49 PST
(In reply to comment #4)
> (From update of attachment 216414 [details])
> What will this do to clients that already do the work to avoid the leak? Are they all using the existing api?

It will work correctly. Calling -removeManagedReference:withOwner: will remove the owner from the JSManagedValue's m_owners so when it is dealloc-ed it won't be called again.
Comment 7 Mark Rowe (bdash) 2013-11-13 14:46:31 PST
Can you post a new patch with availability macros added?
Comment 8 Mark Hahnenberg 2013-11-13 16:58:45 PST
(In reply to comment #7)
> Can you post a new patch with availability macros added?

I'm still not sure what macros to use. NS_AVAILABLE and friends will break the open source bots. Should I add a new WebKit availability macro for the current WebKit version using the new versioning scheme (e.g. 0x2100500 == 528.5.0) in JavaScriptCore/API/WebKitAvailability.h?
Comment 9 Mark Hahnenberg 2014-02-06 11:21:55 PST
Created attachment 223353 [details]
Patch
Comment 10 WebKit Commit Bot 2014-02-06 11:23:14 PST
Attachment 223353 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/API/WebKitAvailability.h:37:  Missing spaces around =  [whitespace/operators] [4]
ERROR: Source/JavaScriptCore/API/WebKitAvailability.h:41:  Missing spaces around =  [whitespace/operators] [4]
Total errors found: 2 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 Mark Hahnenberg 2014-02-06 11:35:54 PST
Created attachment 223356 [details]
Patch
Comment 12 WebKit Commit Bot 2014-02-06 11:37:56 PST
Attachment 223356 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/API/WebKitAvailability.h:38:  Missing spaces around =  [whitespace/operators] [4]
ERROR: Source/JavaScriptCore/API/WebKitAvailability.h:42:  Missing spaces around =  [whitespace/operators] [4]
Total errors found: 2 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 13 Mark Hahnenberg 2014-02-06 12:29:10 PST
Created attachment 223368 [details]
Patch
Comment 14 WebKit Commit Bot 2014-02-06 12:31:51 PST
Attachment 223368 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/API/WebKitAvailability.h:49:  Missing spaces around =  [whitespace/operators] [4]
ERROR: Source/JavaScriptCore/API/WebKitAvailability.h:53:  Missing spaces around =  [whitespace/operators] [4]
Total errors found: 2 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 15 Mark Hahnenberg 2014-02-06 13:21:11 PST
Created attachment 223373 [details]
Patch
Comment 16 WebKit Commit Bot 2014-02-06 13:22:26 PST
Attachment 223373 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/API/WebKitAvailability.h:49:  Missing spaces around =  [whitespace/operators] [4]
ERROR: Source/JavaScriptCore/API/WebKitAvailability.h:53:  Missing spaces around =  [whitespace/operators] [4]
Total errors found: 2 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 17 Mark Hahnenberg 2014-02-06 14:19:03 PST
Created attachment 223382 [details]
Patch
Comment 18 WebKit Commit Bot 2014-02-06 14:21:28 PST
Attachment 223382 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/API/WebKitAvailability.h:49:  Missing spaces around =  [whitespace/operators] [4]
ERROR: Source/JavaScriptCore/API/WebKitAvailability.h:53:  Missing spaces around =  [whitespace/operators] [4]
Total errors found: 2 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 19 Mark Hahnenberg 2014-02-06 14:26:05 PST
Created attachment 223384 [details]
Patch
Comment 20 WebKit Commit Bot 2014-02-06 14:28:53 PST
Attachment 223384 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/API/WebKitAvailability.h:49:  Missing spaces around =  [whitespace/operators] [4]
ERROR: Source/JavaScriptCore/API/WebKitAvailability.h:53:  Missing spaces around =  [whitespace/operators] [4]
ERROR: Source/JavaScriptCore/API/JSManagedValue.h:74:  Missing space after ,  [whitespace/comma] [3]
ERROR: Source/JavaScriptCore/API/JSManagedValue.h:76:  Missing space after ,  [whitespace/comma] [3]
Total errors found: 4 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 21 Geoffrey Garen 2014-02-06 15:50:23 PST
Comment on attachment 223384 [details]
Patch

r=me
Comment 22 WebKit Commit Bot 2014-02-06 16:25:04 PST
Comment on attachment 223384 [details]
Patch

Clearing flags on attachment: 223384

Committed r163574: <http://trac.webkit.org/changeset/163574>
Comment 23 WebKit Commit Bot 2014-02-06 16:25:07 PST
All reviewed patches have been landed.  Closing bug.