Skip to content

Split ScriptMsg into common and unique messages for main-thread and worker event loops  #3734

Closed

Description

@jdm

Enums like CommonScriptMsg, WorkerScriptMsg, and MainThreadScriptMsg, where the latter two have a variant for CommonScriptMsg, would make a lot of sense. Conflating messages that both event loops need to handle with ones that should never be dispatched to one or the other is unnecessary and confusing.

Activity

  1. added
    E-less-complex
    A-content/script
    I-cleanup
    on Oct 20, 2014
  2. catchmrbharath commented on Jan 5, 2015

    @catchmrbharath
    Contributor

    @jdm What do you mean by "latter two have a variant for CommonScriptMessage" ?

    If that is cleared up, I would like to have at go at this issue.

  3. catchmrbharath commented on Jan 5, 2015

    @catchmrbharath
    Contributor

    My idea was to have three enums CommonScriptMsg, WorkerScriptMsg and MainThreadScriptMsg as separate enums. Things that are dispatched to both dedicatedworkerglobalscope and ScriptTask should are present in the CommonScriptMsg.

  4. jdm commented on Jan 5, 2015

    @jdm
    MemberAuthor

    @catchmrbharath I mean that we'll have something like enum WorkerScriptMsg { A(whatever), Common(CommonScriptMsg) }.

  5. added
    C-assigned
    on Jan 5, 2015
  6. jdm commented on Feb 20, 2015

    @jdm
    MemberAuthor

    Still working on this, @catchmrbharath?

  7. catchmrbharath commented on Feb 22, 2015

    @catchmrbharath
    Contributor

    @jdm Sorry about that. I am presently not working on this. Can you remove the C-assigned tag? I should have updated the issue long back. Sorry again :).

  8. removed
    C-assigned
    on Feb 22, 2015
  9. jdm commented on Feb 22, 2015

    @jdm
    MemberAuthor

    No problem!

  10. wldcordeiro commented on Mar 5, 2015

    @wldcordeiro
    Contributor

    I'll take a stab at this issue @jdm, could you just give me some guidance as to what attributes of the ScriptMsg enum should be part of each of the others?

  11. jdm commented on Mar 5, 2015

    @jdm
    MemberAuthor

    Thanks @wldcordeiro! Any event that is processed only by the worker event loop in dedicatedworkerglobal.rs (handle_event) belongs in one enum, while any event that is only processed by the event loop in script_task.rs (handle_msgs) belongs in another. Any event that is processed by both of them belongs in a common enum. Does that make sense?

  12. added
    C-assigned
    on Mar 5, 2015
  13. wldcordeiro commented on Mar 5, 2015

    @wldcordeiro
    Contributor

    @jdm that does make sense, but would it also make sense to move the enums to different modules? Or would it be fine if they all were in script_task.rs?

  14. 8 remaining items

  15. jdm commented on Mar 8, 2015

    @jdm
    MemberAuthor
    Common(
            CommonScriptMsg::FireTimer,
            CommonScriptMsg::WorkerDispatchErrorEvent,
            CommonScriptMsg::RunnableMsg,
            CommonScriptMsg::RefcountCleanup,
            CommonScriptMsg::PageFetchComplete
        ),

    This isn't valid, since the arguments to the Common variant are not types, they are values. Enum variants are only allowed to contain types (such as WorkerScriptMsg, or CommonScriptMsg). Does that make more sense?

  16. jdm commented on Mar 8, 2015

    @jdm
    MemberAuthor

    Oh, I guess you sorted that out on your own. I guess the PR builds now? :)

  17. wldcordeiro commented on Mar 9, 2015

    @wldcordeiro
    Contributor

    @jdm PR is building! Looks like it's working. 😄

  18. wldcordeiro commented on Apr 8, 2015

    @wldcordeiro
    Contributor

    @jdm You can remove the assigned tag. I've been too busy lately to work on this.

  19. removed
    C-assigned
    on Apr 8, 2015
  20. added
    C-assigned
    on Aug 9, 2015
  21. wldcordeiro commented on Aug 14, 2015

    @wldcordeiro
    Contributor

    @Wafflespeanut That's kind of what I was running into. It was definitely more complex than the description suggests.

  22. jdm commented on Aug 14, 2015

    @jdm
    MemberAuthor

    Yep, my mistake. I'll make sure to think through the ramifications of such changes more thoroughly in the future before proposing them to eager new contributors.

  23. added 2 commits that reference this issue on Aug 14, 2015
  24. waddlesplash commented on Aug 15, 2015

    @waddlesplash

    PR was merged, this should be closed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/scriptC-assignedE-less-complexI-cleanup

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions