Bug 210700 - Fix WebUserContentControllerProxy vs ContentWorld lifetime
Summary: Fix WebUserContentControllerProxy vs ContentWorld lifetime
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brady Eidson
URL:
Keywords: InRadar
Depends on:
Blocks: 206398
  Show dependency treegraph
 
Reported: 2020-04-18 15:03 PDT by Brady Eidson
Modified: 2020-04-18 19:09 PDT (History)
3 users (show)

See Also:


Attachments
Patch (23.31 KB, patch)
2020-04-18 16:10 PDT, Brady Eidson
achristensen: review+
Details | Formatted Diff | Diff
Patch for landing (23.29 KB, patch)
2020-04-18 18:47 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brady Eidson 2020-04-18 15:03:55 PDT
UserContentControllerProxy / ContentWorld cleanup

Blocking testing for https://bugs.webkit.org/show_bug.cgi?id=206398
Comment 1 Brady Eidson 2020-04-18 15:46:41 PDT
Renaming - I realized there is an actual bug this refactoring is fixing, and wrote an API test for it

"Fix WebUserContentControllerProxy vs ContentWorld lifetime"
Comment 2 Brady Eidson 2020-04-18 16:10:21 PDT
Created attachment 396868 [details]
Patch
Comment 3 Alex Christensen 2020-04-18 17:36:38 PDT
Comment on attachment 396868 [details]
Patch

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

> Source/WebKit/UIProcess/API/APIContentWorld.cpp:38
> +    static HashMap<WTF::String, ContentWorld*>* sharedMap = new HashMap<WTF::String, ContentWorld*>;

NeverDestroyed<HashMap<...>> to be consistent with below.

> Source/WebKit/UIProcess/API/APIContentWorld.h:61
> +    HashSet<WebKit::WebUserContentControllerProxy*> m_associatedContentControllerProxies;

Could we use WeakPtr here instead of storing raw pointers?
Comment 4 Brady Eidson 2020-04-18 18:46:02 PDT
(In reply to Alex Christensen from comment #3)
> Comment on attachment 396868 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=396868&action=review
> 
> > Source/WebKit/UIProcess/API/APIContentWorld.cpp:38
> > +    static HashMap<WTF::String, ContentWorld*>* sharedMap = new HashMap<WTF::String, ContentWorld*>;
> 
> NeverDestroyed<HashMap<...>> to be consistent with below.

Fixed
> > Source/WebKit/UIProcess/API/APIContentWorld.h:61
> > +    HashSet<WebKit::WebUserContentControllerProxy*> m_associatedContentControllerProxies;
> 
> Could we use WeakPtr here instead of storing raw pointers?

I'm wondering what the ramifications are of making an API::Object have WeakPtrs.
I'm going to punt for now.
Comment 5 Brady Eidson 2020-04-18 18:47:59 PDT
Created attachment 396883 [details]
Patch for landing
Comment 6 EWS 2020-04-18 19:08:56 PDT
Committed r260330: <https://trac.webkit.org/changeset/260330>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 396883 [details].
Comment 7 Radar WebKit Bug Importer 2020-04-18 19:09:17 PDT
<rdar://problem/61992273>