Commit Graph

20223 Commits

Author SHA1 Message Date
Noemi Erli
b13f2bcb47 Backed out 7 changesets (bug 1627075) for causing @nsZipArchive crashes CLOSED TREE
Backed out changeset 9705b2759d45 (bug 1627075)
Backed out changeset 699212a443c3 (bug 1627075)
Backed out changeset 7ae4df10749c (bug 1627075)
Backed out changeset ece9a4223349 (bug 1627075)
Backed out changeset 6c4eedaa0d04 (bug 1627075)
Backed out changeset f5106898239f (bug 1627075)
Backed out changeset b6029c7c0016 (bug 1627075)
2020-07-02 14:05:53 +03:00
Simon Giesecke
6b1107803f Bug 1649770 - Check for tainted array in RemoveElementsBy. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D81867
2020-07-01 17:13:36 +00:00
Doug Thayer
3742aac030 Bug 1627075 - Route Omnijar requests through StartupCache r=froydnj
This should be a relatively straightforward patch. Essentially, we implement
a wrapper class (and friends) around nsZipArchive (and friends), which transparently
caches entries from the underlying zip archive in the StartupCache. This will break
without changes to the StartupCache, made in the patch after this, which allow it
to be used off of the main thread, and outside the main process.

Depends on D77635

Differential Revision: https://phabricator.services.mozilla.com/D77634
2020-07-02 02:51:41 +00:00
Doug Thayer
a493fefece Bug 1627075 - OMT and OMP StartupCache access r=froydnj
The overall goal of this patch is to make the StartupCache accessible anywhere.
There's two main pieces to that equation:

1. Allowing it to be accessed off main thread, which means modifying the
   mutex usage to ensure that all data accessed from non-main threads is
   protected.
2. Allowing it to be accessed out of the chrome process, which means passing
   a handle to a shared cache buffer down to child processes.

Number 1 is somewhat fiddly, but it's all generally straightforward work. I'll
hope that the comments and the code are sufficient to explain what's going on
there.

Number 2 has some decisions to be made:
- The first decision was to pass a handle to a frozen chunk of memory down to
  all child processes, rather than passing a handle to an actual file. There's
  two reasons for this: 1) since we want to compress the underlying file on
  disk, giving that file to child processes would mean they have to decompress
  it themselves, eating CPU time. 2) since they would have to decompress it
  themselves, they would have to allocate the memory for the decompressed
  buffers, meaning they cannot all simply share one big decompressed buffer.

  - The drawback of this decision is that we have to load and decompress the
    buffer up front, before we spawn any child processes. We attempt to
    mitigate this by keeping track of all the entries that child processes
    access, and only including those in the frozen decompressed shared buffer.

  - We base our implementation of this approach off of the shared preferences
    implementation. Hopefully I got all of the pieces to fit together
    correctly. They seem to work in local testing and on try, but I think
    they require a set of experienced eyes looking carefully at them.

- Another decision was whether to send the handles to the buffers over IPC or
  via command line. We went with the command line approach, because the startup
  cache would need to be accessed very early on in order to ensure we do not
  read from any omnijars, and we could not make that work via IPC.

  - Unfortunately this means adding another hard-coded FD, similar to
    kPrefMapFileDescriptor. It seems like at the very least we need to rope all
    of these together into one place, but I think that should be filed as a
    follow-up?

Lastly, because this patch is a bit of a monster to review - first, thank you
for looking at it, and second, the reason we're invested in this is because we
saw a >10% improvement in cold startup times on reference hardware, with a p
value less than 0.01. It's still not abundantly clear how reference hardware
numbers translate to numbers on release, and they certainly don't translate
well to Nightly numbers, but it's enough to convince me that it's worth some
effort.

Depends on D78584

Differential Revision: https://phabricator.services.mozilla.com/D77635
2020-07-02 03:39:46 +00:00
Doug Thayer
45d135813f Bug 1627075 - Allow lazily initializing nsZipArchives r=froydnj
Opening our Omnijars can be expensive, and it should be deferrable until after
startup is completed, provided we have a startup cache. In a previous patch in this
stack, we implemented caching of the zip central directory for omnijars, but we
still have to open the file in order to hand the object off to various omnijar
consumers. In a later patch, we will wrap nsZipArchive access in a class which
will allow us to transparently cache nsZipArchive results. These two get us
most of the way to not needing to read from the underlying omnijar files during
startup, but there are still nontrivial pieces, like nsZipFind for instance,
which we don't want to just duplicate inside of a wrapper class, so we would
like to sort out a way in which we can use an nsZipArchive class, but not
actually back it up with the real underlying file until we really need data
from it which we can't find in a cache.

Depends on D77633

Differential Revision: https://phabricator.services.mozilla.com/D78584
2020-07-02 03:12:49 +00:00
Doug Thayer
a336fc378c Bug 1627075 - Init StartupCache before Omnijar r=froydnj
We need to be able to init StartupCache before the Omnijar in order to cache
all of the Omnijar contents we access. This patch implements that.

Depends on D77632

Differential Revision: https://phabricator.services.mozilla.com/D77633
2020-07-02 02:49:49 +00:00
Doug Thayer
10f4af3f14 Bug 1627075 - Build Omnijar file list from startup cache r=froydnj
We would like to be able to defer opening the omnijar files until after startup
if the StartupCache has already been populated. Opening the omnijar files takes
a nontrivial time, at least on Windows, and almost everything in the omnijar
should be fairly compressible, and thus makes sense to live in the StartupCache.
See the last patch in this series for a little more discussion on numbers, but
tl;dr: we saw a 12% improvement in time to about:home being finished on reference
hardware with these changes together with the changes from the descendant patches.

Differential Revision: https://phabricator.services.mozilla.com/D77632
2020-07-02 02:49:31 +00:00
Jean-Yves Avenard
afea3c617d Bug 1634846 - P3. Get around NS_INLINE_DECL_REFCOUNTING not working with TaskQueue. r=nika,froydnj
NS_INLINE_DECL_REFCOUNTING macro doesn't properly work when the object is used on a thread that isn't backed by a single PRThread (such as TaskQueue). See bug 1648031.

The resolution of this issue is rather complex, and outside the scope of this series of change.

So for now, we create a new macro NS_INLINE_DECL_REFCOUNTING_ONEVENTTHREAD which will use a different mechanism to ensure the thread-safe usage of a class.

Differential Revision: https://phabricator.services.mozilla.com/D81269
2020-07-02 00:26:43 +00:00
Jean-Yves Avenard
8ebce5b5a8 Bug 1649671 - Add DelayedDispatch support to AbstractThread (and TaskQueue). r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D81811
2020-07-02 00:08:54 +00:00
Mihai Alexandru Michis
bab20702a8 Backed out 6 changesets (bug 1627075) for causing failures regarding startupcache.
CLOSED TREE

Backed out changeset cf23b456ba12 (bug 1627075)
Backed out changeset b07887474f51 (bug 1627075)
Backed out changeset 65c0e6790a33 (bug 1627075)
Backed out changeset 6cd31f17a931 (bug 1627075)
Backed out changeset 0f0d1bd2a8ac (bug 1627075)
Backed out changeset 763a5a7b43a0 (bug 1627075)
2020-07-01 22:16:28 +03:00
Doug Thayer
ab4b703a53 Bug 1627075 - Route Omnijar requests through StartupCache r=froydnj
This should be a relatively straightforward patch. Essentially, we implement
a wrapper class (and friends) around nsZipArchive (and friends), which transparently
caches entries from the underlying zip archive in the StartupCache. This will break
without changes to the StartupCache, made in the patch after this, which allow it
to be used off of the main thread, and outside the main process.

Depends on D77635

Differential Revision: https://phabricator.services.mozilla.com/D77634
2020-07-01 17:09:53 +00:00
Doug Thayer
42ac8f4294 Bug 1627075 - OMT and OMP StartupCache access r=froydnj
The overall goal of this patch is to make the StartupCache accessible anywhere.
There's two main pieces to that equation:

1. Allowing it to be accessed off main thread, which means modifying the
   mutex usage to ensure that all data accessed from non-main threads is
   protected.
2. Allowing it to be accessed out of the chrome process, which means passing
   a handle to a shared cache buffer down to child processes.

Number 1 is somewhat fiddly, but it's all generally straightforward work. I'll
hope that the comments and the code are sufficient to explain what's going on
there.

Number 2 has some decisions to be made:
- The first decision was to pass a handle to a frozen chunk of memory down to
  all child processes, rather than passing a handle to an actual file. There's
  two reasons for this: 1) since we want to compress the underlying file on
  disk, giving that file to child processes would mean they have to decompress
  it themselves, eating CPU time. 2) since they would have to decompress it
  themselves, they would have to allocate the memory for the decompressed
  buffers, meaning they cannot all simply share one big decompressed buffer.

  - The drawback of this decision is that we have to load and decompress the
    buffer up front, before we spawn any child processes. We attempt to
    mitigate this by keeping track of all the entries that child processes
    access, and only including those in the frozen decompressed shared buffer.

  - We base our implementation of this approach off of the shared preferences
    implementation. Hopefully I got all of the pieces to fit together
    correctly. They seem to work in local testing and on try, but I think
    they require a set of experienced eyes looking carefully at them.

- Another decision was whether to send the handles to the buffers over IPC or
  via command line. We went with the command line approach, because the startup
  cache would need to be accessed very early on in order to ensure we do not
  read from any omnijars, and we could not make that work via IPC.

  - Unfortunately this means adding another hard-coded FD, similar to
    kPrefMapFileDescriptor. It seems like at the very least we need to rope all
    of these together into one place, but I think that should be filed as a
    follow-up?

Lastly, because this patch is a bit of a monster to review - first, thank you
for looking at it, and second, the reason we're invested in this is because we
saw a >10% improvement in cold startup times on reference hardware, with a p
value less than 0.01. It's still not abundantly clear how reference hardware
numbers translate to numbers on release, and they certainly don't translate
well to Nightly numbers, but it's enough to convince me that it's worth some
effort.

Depends on D78584

Differential Revision: https://phabricator.services.mozilla.com/D77635
2020-07-01 17:55:38 +00:00
Doug Thayer
b52c9d39c1 Bug 1627075 - Allow lazily initializing nsZipArchives r=froydnj
Opening our Omnijars can be expensive, and it should be deferrable until after
startup is completed, provided we have a startup cache. In a previous patch in this
stack, we implemented caching of the zip central directory for omnijars, but we
still have to open the file in order to hand the object off to various omnijar
consumers. In a later patch, we will wrap nsZipArchive access in a class which
will allow us to transparently cache nsZipArchive results. These two get us
most of the way to not needing to read from the underlying omnijar files during
startup, but there are still nontrivial pieces, like nsZipFind for instance,
which we don't want to just duplicate inside of a wrapper class, so we would
like to sort out a way in which we can use an nsZipArchive class, but not
actually back it up with the real underlying file until we really need data
from it which we can't find in a cache.

Depends on D77633

Differential Revision: https://phabricator.services.mozilla.com/D78584
2020-07-01 18:04:48 +00:00
Doug Thayer
e1810ad0e8 Bug 1627075 - Init StartupCache before Omnijar r=froydnj
We need to be able to init StartupCache before the Omnijar in order to cache
all of the Omnijar contents we access. This patch implements that.

Depends on D77632

Differential Revision: https://phabricator.services.mozilla.com/D77633
2020-07-01 17:07:29 +00:00
Doug Thayer
b19fd0dabb Bug 1627075 - Build Omnijar file list from startup cache r=froydnj
We would like to be able to defer opening the omnijar files until after startup
if the StartupCache has already been populated. Opening the omnijar files takes
a nontrivial time, at least on Windows, and almost everything in the omnijar
should be fairly compressible, and thus makes sense to live in the StartupCache.
See the last patch in this series for a little more discussion on numbers, but
tl;dr: we saw a 12% improvement in time to about:home being finished on reference
hardware with these changes together with the changes from the descendant patches.

Differential Revision: https://phabricator.services.mozilla.com/D77632
2020-07-01 17:07:17 +00:00
Simon Giesecke
61e4a0be9b Bug 1649729 - Get rid of MOZ_ACCESS_THREAD_BOUND macro. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D81843
2020-07-01 13:13:23 +00:00
Simon Giesecke
dc25d4ae8f Bug 1147091 - Add StableSort to nsTArray_Impl. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D81857
2020-07-01 13:25:02 +00:00
Simon Giesecke
9364b353d4 Bug 1648010 - Remove NS_NAMED_LITERAL_CSTRING and NS_NAMED_LITERAL_STRING macros. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80631
2020-07-01 08:42:31 +00:00
Simon Giesecke
e3c223da3e Bug 1648010 - Fix uses of NS_LITERAL_STRING with C string literals. r=geckoview-reviewers,agi,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80861
2020-07-01 08:34:12 +00:00
Simon Giesecke
cd8b8939b9 Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Bas Schouten
6323c24374 Bug 1606706 - Part 3: Enable new TaskController code by default. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D74673
2020-07-01 01:36:08 +00:00
Zeke Medley
83e9191999 Bug 1506364 - Implement the prefers-contrast media-query. r=morgan,emilio
Differential Revision: https://phabricator.services.mozilla.com/D79553
2020-06-29 17:46:12 +00:00
Jean-Yves Avenard
4a24fe3c8e Bug 1647958 - P3. Have GetCurrentSerialEventTarget returns the currently running MessageLoop. r=nika
We want it to returning the actual nsThread if that's where the MessageLoop would dispatch its tasks; otherwise return the MessageLoop's EventTarget

Depends on D80357

Differential Revision: https://phabricator.services.mozilla.com/D80811
2020-06-30 08:04:10 +00:00
Honza Bambas
e3c8fc6ab0 Bug 1648781 - MOZ_LOG of timer events dispatch and run, MOZ_LOG of idle-dispatch timeout, r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D81467
2020-06-30 10:57:28 +00:00
Brindusan Cristian
6f757f82da Backed out 2 changesets (bug 1647958) for conflicting with the backout of Bug 1648898. CLOSED TREE
Backed out changeset 55ecb48a0504 (bug 1647958)
Backed out changeset af210e0df79f (bug 1647958)
2020-06-30 10:59:29 +03:00
Narcis Beleuzu
3700aab557 Backed out 7 changesets (bug 1634846, bug 1647628, bug 1649294, bug 1647112) for webgl-conf crashes. CLOSED TREE
Backed out changeset 4441d06e96c3 (bug 1647628)
Backed out changeset 4efaf32bc8f7 (bug 1647112)
Backed out changeset 2d24ad813039 (bug 1647112)
Backed out changeset fda262d73a13 (bug 1649294)
Backed out changeset 5863f9c5229f (bug 1634846)
Backed out changeset bca79526745d (bug 1634846)
Backed out changeset d539408a0048 (bug 1634846)
2020-06-30 09:50:00 +03:00
Jean-Yves Avenard
9f996ba331 Bug 1634846 - P3. Get around NS_INLINE_DECL_REFCOUNTING not working with TaskQueue. r=nika,froydnj
NS_INLINE_DECL_REFCOUNTING macro doesn't properly work when the object is used on a thread that isn't backed by a single PRThread (such as TaskQueue). See bug 1648031.

The resolution of this issue is rather complex, and outside the scope of this series of change.

So for now, we create a new macro NS_INLINE_DECL_REFCOUNTING_ONEVENTTHREAD which will use a different mechanism to ensure the thread-safe usage of a class.

Differential Revision: https://phabricator.services.mozilla.com/D81269
2020-06-30 02:50:07 +00:00
Jean-Yves Avenard
35e8e946e1 Bug 1647958 - P3. Have GetCurrentSerialEventTarget returns the currently running MessageLoop. r=nika
We want it to returning the actual nsThread if that's where the MessageLoop would dispatch its tasks; otherwise return the MessageLoop's EventTarget

Depends on D80357

Differential Revision: https://phabricator.services.mozilla.com/D80811
2020-06-30 02:49:05 +00:00
Nihanth Subramanya
359cdd5536 Bug 1555557 - Do cert override file writes off the main thread. r=keeler
Differential Revision: https://phabricator.services.mozilla.com/D35375
2020-06-29 17:00:58 +00:00
Simon Giesecke
017f9a1fc0 Bug 1648010 - Add user-defined string literals. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D81125
2020-06-29 17:02:35 +00:00
Nathan Froyd
d862df6fa7 Bug 1648787 - remove MOZ_GUARD_OBJECT bits from RecursiveMutex; r=dmajor,xpcom-reviewers,nika
Apparently I added these in the initial commit for RecursiveMutex.  I'm
not quite sure what I was thinking, but we don't need them for the
RecursiveMutex itself.  (We have them on the corresponding `*Auto*Lock`
classes, which are also `MOZ_RAII`.)

Differential Revision: https://phabricator.services.mozilla.com/D81345
2020-06-29 15:37:21 +00:00
Razvan Maries
96853b352d Merge mozilla-central to autoland. a=merge on a CLOSED TREE 2020-06-29 18:48:34 +03:00
Mozilla Releng Treescript
f6180a922b Update configs. IGNORE BROKEN CHANGESETS CLOSED TREE NO BUG a=release ba=release 2020-06-29 15:15:46 +00:00
Mihai Alexandru Michis
3e115816f2 Backed out changeset d1416483de0d (bug 1648010) for causing bustages in nsTLiteralString.h
CLOSED TREE
2020-06-29 17:53:38 +03:00
Simon Giesecke
62fd821c3a Bug 1648010 - Add user-defined string literals. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D81125
2020-06-29 14:26:44 +00:00
lougeniac64
499048fe86 (Bug 1635487) Wired up sync logging for extension pref storage r=lina,markh
Differential Revision: https://phabricator.services.mozilla.com/D80975
2020-06-27 19:15:17 +00:00
Andrea Marchesini
2c405fb804 Bug 1648141 - IPCBlobInputStream to RemoteLazyInputStream - part 6 - remoteLazyInputStream, r=smaug,necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D80929
2020-06-29 11:02:55 +00:00
Simon Giesecke
89f394789a Bug 1648705 - Add nsTArrayView. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D81294
2020-06-26 16:00:51 +00:00
Razvan Maries
f7cb24cc7e Backed out 8 changesets (bug 1648141) for build bustages on RemoteLazyInputStreamThread.cpp. CLOSED TREE
Backed out changeset e9b4ca0ee700 (bug 1648141)
Backed out changeset b9bb847cee47 (bug 1648141)
Backed out changeset 11dfce46ec14 (bug 1648141)
Backed out changeset d824d2f67f27 (bug 1648141)
Backed out changeset e5b8292e7095 (bug 1648141)
Backed out changeset c1a3d5fa0c61 (bug 1648141)
Backed out changeset 24fdb83db3cd (bug 1648141)
Backed out changeset 749d894dde52 (bug 1648141)
2020-06-29 13:59:16 +03:00
Andrea Marchesini
d50c65af76 Bug 1648141 - IPCBlobInputStream to RemoteLazyInputStream - part 6 - remoteLazyInputStream, r=smaug,necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D80929
2020-06-29 10:28:21 +00:00
Csoregi Natalia
5bb8a015e6 Backed out changeset 8cd7fabbe270 (bug 1635487) for multiple leaks. CLOSED TREE 2020-06-27 10:43:15 +03:00
lougeniac64
bce2c33963 (Bug 1635487) Wired up sync logging for extension pref storage r=lina,markh
Differential Revision: https://phabricator.services.mozilla.com/D80975
2020-06-27 06:26:22 +00:00
Razvan Maries
eb909a6e55 Backed out changeset fec02fef5e73 (bug 1635487) for Android bustages. CLOSED TREE 2020-06-27 03:05:27 +03:00
lougeniac64
893cb93c43 (Bug 1635487) Wired up sync logging for extension pref storage r=lina,markh
Differential Revision: https://phabricator.services.mozilla.com/D80975
2020-06-26 21:19:17 +00:00
Emilio Cobos Álvarez
7c995807da Bug 1646936 - Generate a single metadata file in the objdir, and feed it to cbindgen. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D80360
2020-06-26 10:41:26 +00:00
Coroiu Cristina
302c2fa31a Backed out changeset 8f948dd74aba (bug 1646936) for SM and Toolchain failures on a CLOSED TREE 2020-06-26 13:08:09 +03:00
Emilio Cobos Álvarez
9c7c03bf30 Bug 1646936 - Generate a single metadata file in the objdir, and feed it to cbindgen. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D80360
2020-06-26 09:37:16 +00:00
Doug Thayer
206bfb45d1 Bug 1648142 - Block on cert storage ops prior to shutdown r=keeler
This just spins the event loop during fast shutdown until all queued
cert_storage tasks have completed. The patch achieves this by simply
adding a counter which will be incremented and decremented on the
main thread via tying into the tasks' `new` and `done` methods. A
slightly more performant solution would use a condvar and sleep the
main thread waiting on pending operations to complete, but given the
low frequency of these occuring during shutdown, such an approach
would be overkill.

Differential Revision: https://phabricator.services.mozilla.com/D80906
2020-06-25 20:33:51 +00:00
Emilio Cobos Álvarez
5dc443249c Bug 1648334 - Use less unsafe in gecko_logger. r=froydnj,valentin
We were storing LogModule::mName as an &'static str in the map... That's
not fine.

The Arc shenanigans were also more complicated than they need to be IMO.

This uses a plain atomic bool to keep the fast path snappy.

Differential Revision: https://phabricator.services.mozilla.com/D81007
2020-06-25 15:23:16 +00:00
Honza Bambas
2b6b893f89 Bug 1638925 - Ensure that the event gets destroyed within the guards r=jya
Differential Revision: https://phabricator.services.mozilla.com/D80171
2020-06-24 13:51:25 +00:00