Bug 97071 - [V8] Move WorkerContextExecutionProxy::initializeIfNeeded() to WorkerScriptController
Summary: [V8] Move WorkerContextExecutionProxy::initializeIfNeeded() to WorkerScriptCo...
Status: RESOLVED DUPLICATE of bug 103210
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kentaro Hara
URL:
Keywords:
Depends on:
Blocks: 97057
  Show dependency treegraph
 
Reported: 2012-09-18 22:42 PDT by Kentaro Hara
Modified: 2012-11-26 17:04 PST (History)
3 users (show)

See Also:


Attachments
Patch (18.85 KB, patch)
2012-09-18 22:45 PDT, Kentaro Hara
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kentaro Hara 2012-09-18 22:42:24 PDT
To kill WorkerContextExecutionProxy, we move WorkerContextExecutionProxy::initializeIfNeeded() to WorkerScriptController. This requires to move a couple of related methods and member variables at the same time. Although the patch is big, it's a bit difficult to split it into pieces.
Comment 1 Kentaro Hara 2012-09-18 22:45:33 PDT
Created attachment 164662 [details]
Patch
Comment 2 Adam Barth 2012-09-19 11:37:54 PDT
Comment on attachment 164662 [details]
Patch

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

> Source/WebCore/bindings/v8/WorkerScriptController.h:104
> +        v8::Persistent<v8::Context> m_context;
> +        OwnPtr<V8PerContextData> m_perContextData;
> +        bool m_disableEvalPending;
> +        Vector<Event*> m_events;

On the main thread, this sort of stuff is handled by the WindowShell.  I worry slightly about WorkerScriptController becoming a giant object of doom.
Comment 3 Adam Barth 2012-09-19 11:38:43 PDT
Maybe we need a V8WorkerContext object to handle setting up and tearing down the v8::Context for the worker?
Comment 4 Kentaro Hara 2012-09-19 18:53:08 PDT
Comment on attachment 164662 [details]
Patch

Removing r? as I want to move initialization methods to V8Initializer.{h,cpp} first.
Comment 5 Kentaro Hara 2012-09-19 18:55:54 PDT
Comment on attachment 164662 [details]
Patch

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

> Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp:-149
> -    // Setup the security handlers and message listener. This only has
> -    // to be done once.
> -    static bool isV8Initialized = false;
> -    if (!isV8Initialized)
> -        v8::V8::AddMessageListener(&v8MessageHandler);

BTW this code looks really strange:

- Per the comment, 'isV8Initialized = true' should be added.
- However, if I add 'isV8Initialized = true', fast/workers/worker-script-error.html and fast/workers/worker-close.html begin to fail.

Will take a look in detail later.
Comment 6 Adam Barth 2012-09-20 10:43:58 PDT
Comment on attachment 164662 [details]
Patch

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

>> Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp:-149
>> -        v8::V8::AddMessageListener(&v8MessageHandler);
> 
> BTW this code looks really strange:
> 
> - Per the comment, 'isV8Initialized = true' should be added.
> - However, if I add 'isV8Initialized = true', fast/workers/worker-script-error.html and fast/workers/worker-close.html begin to fail.
> 
> Will take a look in detail later.

I would assume we'd need to do it once per isolate rather than once across the entire process.
Comment 7 Kentaro Hara 2012-11-26 17:04:00 PST

*** This bug has been marked as a duplicate of bug 103210 ***