Bug 93971

Summary: [V8] Refactor away IsolatedWorld
Product: WebKit Reporter: Dan Carney <dcarney>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, darin, gyuyoung.kim, haraken, japhet, rakuco, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 94272, 94523    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Dan Carney
Reported 2012-08-14 08:31:16 PDT
Refactor away IsolatedWorld
Attachments
Patch (15.72 KB, patch)
2012-08-14 08:35 PDT, Dan Carney
no flags
Patch (14.99 KB, patch)
2012-08-14 12:07 PDT, Dan Carney
no flags
Patch (15.91 KB, patch)
2012-08-17 02:45 PDT, Dan Carney
no flags
Patch (25.01 KB, patch)
2012-08-23 09:10 PDT, Dan Carney
no flags
Dan Carney
Comment 1 2012-08-14 08:35:39 PDT
Dan Carney
Comment 2 2012-08-14 09:35:20 PDT
Comment on attachment 158339 [details] Patch killing patch - some test code made it in
Dan Carney
Comment 3 2012-08-14 12:07:24 PDT
Adam Barth
Comment 4 2012-08-14 13:35:42 PDT
Comment on attachment 158389 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=158389&action=review > Source/WebCore/bindings/v8/DOMWrapperWorld.h:45 > + static PassRefPtr<DOMWrapperWorld> create(int worldId = mainWorldId) { return adoptRef(new DOMWrapperWorld(worldId)); } Can you make createMainWorld be a separate function? It's a bit too tempting to call create() and duplicate the main world. > Source/WebCore/bindings/v8/DOMWrapperWorld.h:49 > + if (m_worldId != mainWorldId) > + isolatedWorldCount--; I would just make this unconditional and have a domWrapperWorldCount. There's always going to be a main world, so we know how to interpet the value. > Source/WebCore/bindings/v8/DOMWrapperWorld.h:57 > + Please remove this blank line. > Source/WebCore/bindings/v8/DOMWrapperWorld.h:58 > + DOMWrapperWorld(int worldId): m_worldId(worldId) This should be split onto two lines with the : as the first character of the second line (indented four spaces).
Dan Carney
Comment 5 2012-08-15 00:58:56 PDT
Comment on attachment 158389 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=158389&action=review >> Source/WebCore/bindings/v8/DOMWrapperWorld.h:45 >> + static PassRefPtr<DOMWrapperWorld> create(int worldId = mainWorldId) { return adoptRef(new DOMWrapperWorld(worldId)); } > > Can you make createMainWorld be a separate function? It's a bit too tempting to call create() and duplicate the main world. This is transitional. There are 2 places in the code where DOMWrapperWorld() was being called, as opposed to IsolatedWorld(). This logic replicates that. I think those are only called in tests, but I'm not certain. >> Source/WebCore/bindings/v8/DOMWrapperWorld.h:49 >> + isolatedWorldCount--; > > I would just make this unconditional and have a domWrapperWorldCount. There's always going to be a main world, so we know how to interpet the value. Same issue as above.
Dan Carney
Comment 6 2012-08-15 03:13:15 PDT
Comment on attachment 158389 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=158389&action=review >>> Source/WebCore/bindings/v8/DOMWrapperWorld.h:45 >>> + static PassRefPtr<DOMWrapperWorld> create(int worldId = mainWorldId) { return adoptRef(new DOMWrapperWorld(worldId)); } >> >> Can you make createMainWorld be a separate function? It's a bit too tempting to call create() and duplicate the main world. > > This is transitional. There are 2 places in the code where DOMWrapperWorld() was being called, as opposed to IsolatedWorld(). This logic replicates that. I think those are only called in tests, but I'm not certain. The problematic calls are in WebViewImpl http://code.google.com/p/chromium/source/search?q=DOMWrapperWorld%3A%3Acreate&origq=DOMWrapperWorld%3A%3Acreate&btnG=Search+Trunk Do you happen to know if I can replace them with a call to mainThreadNormalWorld()?
Adam Barth
Comment 7 2012-08-15 14:51:23 PDT
Comment on attachment 158389 [details] Patch Ok. It's fine to move in small steps like this. We shouldn't be afraid to break things though. That's what the tests are for.
Adam Barth
Comment 8 2012-08-15 14:51:59 PDT
Comment on attachment 158389 [details] Patch Ok. It's fine to move in small steps like this. We shouldn't be afraid to break things though. That's what the tests are for.
WebKit Review Bot
Comment 9 2012-08-15 15:37:15 PDT
Comment on attachment 158389 [details] Patch Clearing flags on attachment: 158389 Committed r125717: <http://trac.webkit.org/changeset/125717>
WebKit Review Bot
Comment 10 2012-08-15 15:37:22 PDT
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 11 2012-08-16 17:10:02 PDT
Re-opened since this is blocked by 94272
Kentaro Hara
Comment 12 2012-08-17 02:33:09 PDT
*** Bug 94318 has been marked as a duplicate of this bug. ***
Dan Carney
Comment 13 2012-08-17 02:45:02 PDT
Kentaro Hara
Comment 14 2012-08-17 02:50:02 PDT
Comment on attachment 159059 [details] Patch Looks OK. By the way, do you have a plan to rename DOMWrapperWorld to IsolatedWorld? (You can do it in a follow-up patch.) A bunch of method names and variable names are using "isolatedWorld". In particular, some Chromium API names (e.g. evaluateInIsolatedWorld()) are using "IsolatedWorld", and it is difficult to rename Chromium APIs. So I think that it would be reasonable to rename DOMWrapperWorld to IsolatedWorld.
Dan Carney
Comment 15 2012-08-17 02:59:15 PDT
(In reply to comment #14) > (From update of attachment 159059 [details]) > Looks OK. > > By the way, do you have a plan to rename DOMWrapperWorld to IsolatedWorld? (You can do it in a follow-up patch.) A bunch of method names and variable names are using "isolatedWorld". In particular, some Chromium API names (e.g. evaluateInIsolatedWorld()) are using "IsolatedWorld", and it is difficult to rename Chromium APIs. So I think that it would be reasonable to rename DOMWrapperWorld to IsolatedWorld. I have some follow up patches, but they just rename the constructors to createIsolatedWorld and createMainWorld. I wasn't planning to rename back to IsolatedWorld as we are trying to match the JSC api a little more.
Kentaro Hara
Comment 16 2012-08-17 03:03:46 PDT
(In reply to comment #15) > I have some follow up patches, but they just rename the constructors to createIsolatedWorld and createMainWorld. I wasn't planning to rename back to IsolatedWorld as we are trying to match the JSC api a little more. It looks like that JSC binding is sometimes using "IsolatedWorld" and "DOMWrapperWorld" interchangeably. What is the difference between IsolatedWorld and DOMWrapperWorld conceptually?
WebKit Review Bot
Comment 17 2012-08-17 05:22:53 PDT
Comment on attachment 159059 [details] Patch Clearing flags on attachment: 159059 Committed r125884: <http://trac.webkit.org/changeset/125884>
WebKit Review Bot
Comment 18 2012-08-17 05:22:59 PDT
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 19 2012-08-20 13:56:19 PDT
Re-opened since this is blocked by 94523
Dan Carney
Comment 20 2012-08-23 09:10:45 PDT
Dan Carney
Comment 21 2012-08-23 09:13:33 PDT
(In reply to comment #16) > (In reply to comment #15) > > I have some follow up patches, but they just rename the constructors to createIsolatedWorld and createMainWorld. I wasn't planning to rename back to IsolatedWorld as we are trying to match the JSC api a little more. > > It looks like that JSC binding is sometimes using "IsolatedWorld" and "DOMWrapperWorld" interchangeably. What is the difference between IsolatedWorld and DOMWrapperWorld conceptually? No difference. That's why I'm removing the distinction. The main world is the one the user sees in the inspector, but it's ultimately just an isolated world, too.
Dan Carney
Comment 22 2012-08-23 09:16:17 PDT
(In reply to comment #20) > Created an attachment (id=160180) [details] > Patch Attempt #3. This version works around an issue where WebViewImpl needs a throwaway main world that it doesn't use but needs it before the v8 isolate is set, causing a crash.
Adam Barth
Comment 23 2012-08-23 13:43:52 PDT
Comment on attachment 160180 [details] Patch It looks like you've got all green bubbles. If you'd like this patch reviewed, please set the Review flag to "?".
Dan Carney
Comment 24 2012-08-23 23:12:48 PDT
(In reply to comment #23) > (From update of attachment 160180 [details]) > It looks like you've got all green bubbles. If you'd like this patch reviewed, please set the Review flag to "?". Yeah, I have to run this through the unit tests and browser tests locally in debug mode to be sure this is good. It's very easy to trigger assertions by getting this slightly wrong. I'll flap the flag shortly.
Kentaro Hara
Comment 25 2012-08-23 23:14:36 PDT
(In reply to comment #21) > (In reply to comment #16) > > (In reply to comment #15) > > > I have some follow up patches, but they just rename the constructors to createIsolatedWorld and createMainWorld. I wasn't planning to rename back to IsolatedWorld as we are trying to match the JSC api a little more. > > > > It looks like that JSC binding is sometimes using "IsolatedWorld" and "DOMWrapperWorld" interchangeably. What is the difference between IsolatedWorld and DOMWrapperWorld conceptually? > > No difference. That's why I'm removing the distinction. The main world is the one the user sees in the inspector, but it's ultimately just an isolated world, too. Then you might want to rename DOMWrapperWorld to IsolatedWorld in a follow-up patch (in both JSC and V8). Having two names for one concept would be confusing.
Kentaro Hara
Comment 26 2012-08-24 00:40:20 PDT
Comment on attachment 160180 [details] Patch OK
WebKit Review Bot
Comment 27 2012-08-24 02:40:22 PDT
Comment on attachment 160180 [details] Patch Clearing flags on attachment: 160180 Committed r126566: <http://trac.webkit.org/changeset/126566>
WebKit Review Bot
Comment 28 2012-08-24 02:40:28 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.