Closed Bug 1432963 Opened 6 years ago Closed 6 years ago

fix dom/workers exported headers to not be insane

Categories

(Core :: DOM: Workers, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox60 --- fixed

People

(Reporter: bkelly, Assigned: baku)

References

Details

Attachments

(17 files)

5.95 KB, patch
smaug
: review+
Details | Diff | Splinter Review
6.75 KB, patch
smaug
: review+
Details | Diff | Splinter Review
9.40 KB, patch
smaug
: review+
Details | Diff | Splinter Review
5.35 KB, patch
smaug
: review+
Details | Diff | Splinter Review
14.47 KB, patch
smaug
: review+
Details | Diff | Splinter Review
1.61 KB, patch
smaug
: review+
Details | Diff | Splinter Review
10.07 KB, patch
smaug
: review+
Details | Diff | Splinter Review
10.67 KB, patch
smaug
: review+
Details | Diff | Splinter Review
3.42 KB, patch
smaug
: review+
Details | Diff | Splinter Review
11.48 KB, patch
smaug
: review+
Details | Diff | Splinter Review
4.53 KB, patch
smaug
: review+
Details | Diff | Splinter Review
73.16 KB, patch
smaug
: review+
Details | Diff | Splinter Review
162.88 KB, patch
smaug
: review+
Details | Diff | Splinter Review
24.27 KB, patch
smaug
: review+
Details | Diff | Splinter Review
34.37 KB, patch
smaug
: review+
Details | Diff | Splinter Review
58.67 KB, patch
smaug
: review+
Details | Diff | Splinter Review
66.34 KB, patch
smaug
: review+
Details | Diff | Splinter Review
Our dom/worker headers are currently a bit crazy.  Lots of code needs to include WorkerPrivate.h.  But WorkerPrivate.h uses a bunch of headers that are not referenced by their exported location:

  Workers.h
  WorkerHolder.h
  Queue.h

We could fix these to be:

  mozilla/dom/workers/Workers.h
  mozilla/dom/workers/bindings/WorkerHolder.h

But Queue.h is not exported.  Also, just to make things more confusing, WorkerPrivate.h is exported as:

  mozilla/dom/WorkerPrivate.h

This is just kind of crazy and unworkable.  So we have code all over the place that just adds dom/workers to their moz.build LOCAL_INCLUDES to work around it.  That just leads to the problem getting worse.

We should at least make it possible to include WorkerPrivate.h from the export.

Andrea, any interest in working on this?
Flags: needinfo?(amarchesini)
Yeah, this was part of the Worker cleanup task. I'll take this. I'm keeping the NI flag.
It would also be nice to just use mozilla::dom:: namespace and not the extra workers:: namespace.
Assignee: nobody → amarchesini
Priority: -- → P2
Flags: needinfo?(amarchesini)
Attachment #8946741 - Flags: review?(bugs)
Note that here I had to introduce a workers::WorkerPrivate. This is going to be removed in the following patches.
Attachment #8946746 - Flags: review?(bugs)
Attachment #8946749 - Flags: review?(bugs)
Attachment #8946752 - Flags: review?(bugs)
Attachment #8946755 - Attachment description: part D - WorkerRunnable without namespace → part D - WorkerHolder without namespace
Attachment #8946756 - Attachment description: part E - WorkerHolder without namespace → part E - WorkerPrivate without namespace
After these patches, here what we have:

In mozilla/dom/ we have these headers:

    'SharedWorker.h',
    'WorkerCommon.h',
    'WorkerDebugger.h',
    'WorkerDebuggerManager.h',
    'WorkerHolder.h',
    'WorkerHolderToken.h',
    'WorkerLoadInfo.h',
    'WorkerLocation.h',
    'WorkerNavigator.h',
    'WorkerPrivate.h',
    'WorkerRunnable.h',
    'WorkerScope.h',

with 'mozilla::dom::' namespace.

there are 3 private exposed headers in mozilla/dom/workerinternal/

    'JSSettings.h',
    'Queue.h',
    'RuntimeService.h',

in 'mozilla::dom::workerinternals::' namespace

WorkerCommon exposes several static functions. Those are into a 'workers' namespace. Those functions are AssertIsOnMainThread() and so on.

No LIBS+=[ '/dom/workers' ] is required anymore.
Comment on attachment 8946741 [details] [diff] [review]
part 1 - no workers namespace for SharedWorker

Thank you. All the worker namespace stuff has been always really weird.
Attachment #8946741 - Flags: review?(bugs) → review+
Comment on attachment 8946743 [details] [diff] [review]
part 2 - Get rid of  WorkerCrossThreadDispatcher and WorkerTask

unused code. lovely.
Attachment #8946743 - Flags: review?(bugs) → review+
Attachment #8946745 - Flags: review?(bugs) → review+
Attachment #8946746 - Flags: review?(bugs) → review+
Comment on attachment 8946748 [details] [diff] [review]
part 5 - WorkerEventTarget in a separate file

'WorkerLoadInfo.h' changes look unrelated. Which patch removes BEGIN_WORKERS_NAMESPACE from that file?
So far I have found it. Perhaps some latter patch. I may change r- to r+ if I find it.
Attachment #8946748 - Flags: review?(bugs) → review-
Attachment #8946749 - Flags: review?(bugs) → review+
Attachment #8946750 - Flags: review?(bugs) → review+
Comment on attachment 8946752 [details] [diff] [review]
part 9 - WorkerLoadInfo

Ahaa, here.
Attachment #8946752 - Flags: review?(bugs) → review+
Attachment #8946748 - Flags: review- → review+
Attachment #8946751 - Flags: review?(bugs) → review+
Attachment #8946753 - Flags: review?(bugs) → review+
Attachment #8946754 - Flags: review?(bugs) → review+
Comment on attachment 8946755 [details] [diff] [review]
part D - WorkerHolder without namespace

ok, this changes also NotificationEvent
Attachment #8946755 - Flags: review?(bugs) → review+
Attachment #8946756 - Flags: review?(bugs) → review+
Comment on attachment 8946762 [details] [diff] [review]
part C - WorkerRunnable without namespace

I should have looked at these in order, but oh well.
Attachment #8946762 - Flags: review?(bugs) → review+
Comment on attachment 8946764 [details] [diff] [review]
part F - static function in a workers namespace

Personally I really don't like functions in some namespace. Having a class and static methods just makes it easier to figure out where the implementation is etc.

But looks like this is just following the existing pattern in workers, so fine.

What is the change to layout/generic/WritingModes.h? Pleaes explain that, and r+
Attachment #8946764 - Flags: review?(bugs) → review+
> What is the change to layout/generic/WritingModes.h? Pleaes explain that,
> and r+

There is a conflict with 2 different Side implementation. I had to force the full namespace in order to avoid a conflict.
Comment on attachment 8946765 [details] [diff] [review]
part G - JSSettings in a workerinternals namespace

Moving CancelWorkersForWindow etc around in the file is a tad annoying. But perhaps the context in the patch just didn't quite reveal the reason.
Attachment #8946765 - Flags: review?(bugs) → review+
Comment on attachment 8946766 [details] [diff] [review]
part H - no LIBS=[workers] in moz.build files

Make sure to push all the patches to try (building on all the platforms) before pushing to m-i ;)
Attachment #8946766 - Flags: review?(bugs) → review+
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d7e5e7c4cf88
Fixing workers headers - part 1 - no workers namespace for SharedWorker, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/5c06802f7ce4
Fixing workers headers - part 2 - Get rid of WorkerCrossThreadDispatcher and WorkerTask, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/d3c3ec4cbe78
Fixing workers headers - part 3 - WorkerError and WorkerPrincipal without workers namespace, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/a8f2bea31ba9
Fixing workers headers - part 4 - WorkerThread without workers namespace, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/89714cb6e883
Fixing workers headers - part 5 - WorkerEventTarget in a separate file, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/2d8d6c014e67
Fixing workers headers - part 6 - Get rid of WorkerInlines.h, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/6978eec68f5f
Fixing workers headers - part 7 - WorkerDebugger without workers namespace, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/7a76ef9f9fd5
Fixing workers headers - part 8 - WorkerTargetHolder without workers namespace, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/b83b357dc475
Fixing workers headers - part 9 - WorkerLoadInfo without workers namespace, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/0f5abdabc30f
Fixing workers headers - part 10 - ScriptLoader into a workerinternals namespace, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/69e7ac848a5d
Fixing workers headers - part 11 - MessageEventRunnable without workers namespace, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/765fff03aebd
Fixing workers headers - part 12 - WorkerRunnable without workers namespace, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/68a1d607cbc4
Fixing workers headers - part 13 - WorkerHolder without workers namespace, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/22ab83c80c5e
Fixing workers headers - part 14 - WorkerPrivate without workers namespace, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/7a858acf697e
Fixing workers headers - part 15 - static function in a workers namespace, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/f82c8af2c1ea
Fixing workers headers - part 16 - JSSettings in a workerinternals namespace, r=smaug
https://hg.mozilla.org/integration/mozilla-inbound/rev/001c306fa281
Fixing workers headers - part 17 - no LIBS=[workers] in moz.build files, r=smaug
FYI, it looks like there are some lingering:

using namespace mozilla::dom::workers;
using namespace workers;

in the tree.  Also maybe some forward declarations like this:

https://searchfox.org/mozilla-central/rev/eeb7190f9ad6f1a846cd6df09986325b3f2c3117/dom/canvas/ImageBitmap.h#42
Flags: needinfo?(amarchesini)
Filing a separate bug for that.
Flags: needinfo?(amarchesini)
Blocks: 1435174
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: