Граф коммитов

2276 Коммитов

Автор SHA1 Сообщение Дата
Jens Stutte 05581ddca4 Bug 1678330: Ensure nested SpinEventLoopUntil(OrShutdown) calls are traceable to the originating source in case of crash. r=nika,extension-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D106839
2021-03-02 22:11:58 +00:00
Cosmin Sabou b2eb620ed0 Backed out changeset 03cae7800b41 (bug 1678330) for mochitest plain failures on test_window_open_discarded_bc.html. CLOSED TREE 2021-03-02 20:18:21 +02:00
Jens Stutte a0af9ea0a4 Bug 1678330: Ensure nested SpinEventLoopUntil(OrShutdown) calls are traceable to the originating source in case of crash. r=nika,extension-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D106839
2021-03-02 15:15:20 +00:00
Simon Giesecke 9af107a839 Bug 1691913 - Rename nsBaseHashtable::Put to InsertOrUpdate. r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
This makes the naming more consistent with other functions called
Insert and/or Update. Also, it removes the ambiguity whether
Put expects that an entry already exists or not, in particular because
it differed from nsTHashtable::PutEntry in that regard.

Differential Revision: https://phabricator.services.mozilla.com/D105473
2021-02-26 09:11:46 +00:00
Simon Giesecke 4f75368dcb Bug 1691913 - Rename nsBaseHashtable::GetOrInsert(With) to LookupOrInsert(With). r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
The functions should be called "Lookup" rather than "Get" because they return
a DataType& (rather than UserDataType).

Differential Revision: https://phabricator.services.mozilla.com/D105472
2021-02-26 09:11:45 +00:00
Simon Giesecke 7c931c97c4 Bug 1689218 - Rename nsBaseHashtable::GetAndRemove to Extract. r=necko-reviewers,dragana
First, it should be called "Lookup" rather than "Get" because it returns
DataType (rather than UserDataType), but that would still be confusing,
since as opposed to other Lookup* methods, it does not return a DataType&
(and obviously, it can't). So "Extract" seems to be a better name, cf.
mozilla::Maybe::extract.

Differential Revision: https://phabricator.services.mozilla.com/D105471
2021-02-22 12:07:48 +00:00
Simon Giesecke c5f7800f35 Bug 1691913 - Rename nsClassHashtable::LookupOrAdd to GetOrInsertNew. r=xpcom-reviewers,nika
It should be called "Get" rather than "Lookup" because it returns
UserDataType. "Add" is called "Insert" in the other methods.

Differential Revision: https://phabricator.services.mozilla.com/D105470
2021-02-22 12:07:47 +00:00
Simon Giesecke 901cbda9f5 Bug 1691913 - Fix forwarding of constructor arguments to nsBaseHashtableET. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D105469
2021-02-22 12:07:47 +00:00
Marco Castelluccio 337ea53819 Bug 1693814 - Reenable some arena allocator tests on ccov builds since they no longer fail. r=jmaher DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D105785
2021-02-19 17:03:07 +00:00
Andreea Pavel 64289058b6 Backed out 5 changesets (bug 1690167) for failing xpcshell at bootstrapSvc.js on a CLOSED TREE
Backed out changeset d28c0f11743f (bug 1690167)
Backed out changeset 3b2bebed9128 (bug 1690167)
Backed out changeset 7e925e90a251 (bug 1690167)
Backed out changeset f85934a2b7ad (bug 1690167)
Backed out changeset 6d83474e81bb (bug 1690167)
2021-02-17 07:10:58 +02:00
Mike Hommey 622b111f9e Bug 1690167 - Change VsprintfLiteral/SprintfLiteral to rely on PrintfTarget. r=nika,Gankra,firefox-build-system-reviewers,mhentges
Instead of snprintf.

Because some standalone code uses those functions directly or indirectly,
and PrintfTarget lives in mozglue, they now need to depend on mozglue
instead of mfbt. Except logalloc/replay, which cherry-picks what it
uses.

Differential Revision: https://phabricator.services.mozilla.com/D103730
2021-02-16 21:20:04 +00:00
Simon Giesecke 661e25bf09 Bug 1692880 - Make Put accept DataType instead of wrapping UserDataType. r=xpcom-reviewers,necko-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D104850
2021-02-16 15:53:33 +00:00
Simon Giesecke 27de23cf55 Bug 1691894 - Remove nsClassHashtable::LookupForAddFromFactory and use GetOrInsertWith instead. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D104851
2021-02-15 16:37:51 +00:00
Simon Giesecke f42597369a Bug 1691894 - Implement nsBaseHashtable::GetOrInsertWith and nsBaseHashtable::GetOrInsert with user-defined constructor arguments. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D104673
2021-02-15 15:12:17 +00:00
smolnar 1afbbe67e1 Backed out 5 changesets (bug 1691894) for causing hazard failures in nsXULPrototypeCache. CLOSED TREE
Backed out changeset 22dc870ee609 (bug 1691894)
Backed out changeset 58c31e9d6ae3 (bug 1691894)
Backed out changeset 7483e84149d8 (bug 1691894)
Backed out changeset f977d6cfa973 (bug 1691894)
Backed out changeset db4503476f34 (bug 1691894)
2021-02-15 16:43:23 +02:00
Simon Giesecke c8b8012985 Bug 1691894 - Remove nsClassHashtable::LookupForAddFromFactory and use GetOrInsertWith instead. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D104851
2021-02-15 10:04:46 +00:00
Simon Giesecke 3c29a68440 Bug 1691894 - Make Put accept DataType instead of wrapping UserDataType. r=xpcom-reviewers,necko-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D104850
2021-02-15 10:04:46 +00:00
Simon Giesecke f8306d41b8 Bug 1691894 - Implement nsBaseHashtable::GetOrInsertWith and nsBaseHashtable::GetOrInsert with user-defined constructor arguments. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D104673
2021-02-15 10:04:44 +00:00
Mihai Alexandru Michis 9154148880 Backed out 4 changesets (bug 1690167) for causing cppunit failures in TestIntegerPrintfMacros.
CLOSED TREE

Backed out changeset 27dee66eba83 (bug 1690167)
Backed out changeset cfffb092a39f (bug 1690167)
Backed out changeset 87b2a2a66fd9 (bug 1690167)
Backed out changeset cac4879f50b4 (bug 1690167)
2021-02-13 00:07:00 +02:00
Mike Hommey 47675f5460 Bug 1690167 - Change VsprintfLiteral/SprintfLiteral to rely on PrintfTarget. r=nika,Gankra,firefox-build-system-reviewers,mhentges
Instead of snprintf.

Because some standalone code uses those functions directly or indirectly,
and PrintfTarget lives in mozglue, they now need to depend on mozglue
instead of mfbt. Except logalloc/replay, which cherry-picks what it
uses.

Differential Revision: https://phabricator.services.mozilla.com/D103730
2021-02-12 20:21:50 +00:00
Simon Giesecke fbfee61619 Bug 1688833 - Change remaining references to LookupForAdd to WithEntryHandle and remove LookupForAdd. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D104400
2021-02-09 18:19:47 +00:00
Simon Giesecke 3012a7db34 Bug 1688833 - Make nsBaseHashtable::WithEntryHandle public and complete its design. r=xpcom-reviewers,nika
Implements the missing handle functions (OrInsertWith, OrUpdateWith), and harmonizes functions
to return a reference to the data.

Adds unit tests.

Differential Revision: https://phabricator.services.mozilla.com/D99764
2021-02-09 18:19:35 +00:00
Nick Alexander 7fc02f82da Bug 1690572 - Avoid `error: ?SprintfLiteral? was not declared in this scope` on Solaris. r=xpcom-reviewers,sg
Differential Revision: https://phabricator.services.mozilla.com/D104251
2021-02-06 11:32:53 +00:00
Nika Layzell 9467aebdbf Bug 1681529 - Part 9: Add a basic test for the seekable stream wrapper, r=baku
This basic GTest exercises some of the basic functionality of the
SeekableStreamWrapper when applied to a nsPipe.

Differential Revision: https://phabricator.services.mozilla.com/D101808
2021-02-04 18:13:17 +00:00
Nika Layzell 82b549eebb Bug 1681529 - Part 6: Introduce a SeekableStreamWrapper to make pipes seekable, r=baku
This patch introduces a new SeekableStreamWrapper class which handles adapting
nsIInputStreams which support being cheaply cloned using nsICloneableInputStream
into seekable input streams by operating on a clone of the original stream, and
re-cloning that stream when seeking backwards.

This wrapper is generally intended to be used with nsPipeInputStream as that
type supports both a fairly cheap clone operation, and keeping a large internal
buffer which is fairly cheap to seek using this method, but should also work
with other types such as RemoteLazyInputStream or nsStringStream.

An alternate strategy was considered where nsPipe was given internal support for
a mSeekable flag to be set on creation. This flag would then have a similar
effect, except with additional optimizations due to being visible within the
implementation of the nsPipe, rather than relying on an unadvanced
nsPipeInputStream to keep the buffer alive.

I ended up choosing this approach instead for a few reasons:

 * The seekable adapter can be applied to an already-created nsPipeInputStream,
   such as one received from IPC. With the nsPipe approach, making an IPC stream
   seekable either requires telling IPCStreamDestination to use a seekable pipe
   ahead of time, or performing a NS_AsyncCopy from the IPC-provided pipe into a
   different seekable pipe, which is likely wasted effort and would prevent
   optimizations such as RemoteLazyInputStream and DelayedStart streams.
 * The adapter can support other features of the underlying stream, such as
   nsIInputStreamLength, without resorting to adding additional adapter layers
   on top of the returned nsPipe.
 * The performance is unlikely to be substantially different in the most common
   case, which is using Seek(NS_SEEK_SET, 0) to return to the beginning of the
   stream.
 * Less additional complexity is added to the already-complicated internals of
   nsPipe, and instead it is kept in a separate wrapper stream, which is easier
   to review.

Using nsStorageStream, as is used by EnsureUploadStreamIsCloneable, was also
considered, but was rejected as it has similar problems to the seekable nsPipe
approach and also doesn't implement nsIAsyncStream, meaning that one must wait
for the NS_AsyncCopy to be completed before reading the stream.

It may actually be possible to replace the existing uses of nsStorageStream with
a wrapped nsPipe in the future, but that is left as follow-up material, and may
have memory overhead implications due to nsPipe not resizing the final segment,
unlike nsStorageStream.

Differential Revision: https://phabricator.services.mozilla.com/D101805
2021-02-04 18:13:09 +00:00
Bogdan Tara abc7c8eeee Backed out 11 changesets (bug 1681529) for talos crashes CLOSED TREE
Backed out changeset c87d0f32d7a6 (bug 1681529)
Backed out changeset b1269f35d525 (bug 1681529)
Backed out changeset 29df8d4c984a (bug 1681529)
Backed out changeset 4def7578ced0 (bug 1681529)
Backed out changeset ce57c5a26c25 (bug 1681529)
Backed out changeset 78b186ec645a (bug 1681529)
Backed out changeset b1d1550a66ca (bug 1681529)
Backed out changeset e8620622208a (bug 1681529)
Backed out changeset 636b1a7c13e4 (bug 1681529)
Backed out changeset a5a8eac68b87 (bug 1681529)
Backed out changeset 968e17db71df (bug 1681529)
2021-02-03 09:29:38 +02:00
Nick Alexander df9c9cd78c Bug 1687549 - Allow to limit MOZ_LOG file with `maxsize:N` when using `append`. r=xpcom-reviewers,kmag
The existing `append` option allows to accumulate logs. The `rotate:N`
option added in Bug 1244306 allows to limit the growth of the log, but
it's both incompatible with `append` and not well suited for a single
cumulative historical log across multiple runs, since it's unclear how
to manage the current log file index across invocations.  Continuously
limiting the file size for each log message is technically
challenging.

This commit pursues a much simpler approach.  When `maxsize:N` is
specified with `append`, before a log file is opened, it "tails" the
file to be at most N // 2 bytes long.  It tries to keep lines intact
at low runtime memory cost, but allows very long lines may be cut.

This implementation wants an atomic file rename operation, which is
supported on Win32 and POSIX OSes only at this time.  On other OSes, a
compile time error will be raised.

Differential Revision: https://phabricator.services.mozilla.com/D103405
2021-02-03 04:35:01 +00:00
Nika Layzell 576135877c Bug 1681529 - Part 9: Add a basic test for the seekable stream wrapper, r=baku
This basic GTest exercises some of the basic functionality of the
SeekableStreamWrapper when applied to a nsPipe.

Differential Revision: https://phabricator.services.mozilla.com/D101808
2021-02-02 23:26:41 +00:00
Nika Layzell 21451717af Bug 1681529 - Part 6: Introduce a SeekableStreamWrapper to make pipes seekable, r=baku
This patch introduces a new SeekableStreamWrapper class which handles adapting
nsIInputStreams which support being cheaply cloned using nsICloneableInputStream
into seekable input streams by operating on a clone of the original stream, and
re-cloning that stream when seeking backwards.

This wrapper is generally intended to be used with nsPipeInputStream as that
type supports both a fairly cheap clone operation, and keeping a large internal
buffer which is fairly cheap to seek using this method, but should also work
with other types such as RemoteLazyInputStream or nsStringStream.

An alternate strategy was considered where nsPipe was given internal support for
a mSeekable flag to be set on creation. This flag would then have a similar
effect, except with additional optimizations due to being visible within the
implementation of the nsPipe, rather than relying on an unadvanced
nsPipeInputStream to keep the buffer alive.

I ended up choosing this approach instead for a few reasons:

 * The seekable adapter can be applied to an already-created nsPipeInputStream,
   such as one received from IPC. With the nsPipe approach, making an IPC stream
   seekable either requires telling IPCStreamDestination to use a seekable pipe
   ahead of time, or performing a NS_AsyncCopy from the IPC-provided pipe into a
   different seekable pipe, which is likely wasted effort and would prevent
   optimizations such as RemoteLazyInputStream and DelayedStart streams.
 * The adapter can support other features of the underlying stream, such as
   nsIInputStreamLength, without resorting to adding additional adapter layers
   on top of the returned nsPipe.
 * The performance is unlikely to be substantially different in the most common
   case, which is using Seek(NS_SEEK_SET, 0) to return to the beginning of the
   stream.
 * Less additional complexity is added to the already-complicated internals of
   nsPipe, and instead it is kept in a separate wrapper stream, which is easier
   to review.

Using nsStorageStream, as is used by EnsureUploadStreamIsCloneable, was also
considered, but was rejected as it has similar problems to the seekable nsPipe
approach and also doesn't implement nsIAsyncStream, meaning that one must wait
for the NS_AsyncCopy to be completed before reading the stream.

It may actually be possible to replace the existing uses of nsStorageStream with
a wrapped nsPipe in the future, but that is left as follow-up material, and may
have memory overhead implications due to nsPipe not resizing the final segment,
unlike nsStorageStream.

Differential Revision: https://phabricator.services.mozilla.com/D101805
2021-02-02 23:26:33 +00:00
Brindusan Cristian cbdb020883 Backed out 11 changesets (bug 1681529) for mochitest failures at test_reload_large_postdata.html. CLOSED TREE
Backed out changeset f1f988155c82 (bug 1681529)
Backed out changeset f0ba367de05e (bug 1681529)
Backed out changeset dbea9952ec79 (bug 1681529)
Backed out changeset 6e185ec2c4a4 (bug 1681529)
Backed out changeset d0b11c08666a (bug 1681529)
Backed out changeset f2515096b378 (bug 1681529)
Backed out changeset ecd8c3b8fdb4 (bug 1681529)
Backed out changeset 7ea2e9cc8bad (bug 1681529)
Backed out changeset dbc85d0bffaf (bug 1681529)
Backed out changeset f0893f544219 (bug 1681529)
Backed out changeset 91979e21aa8e (bug 1681529)
2021-02-02 22:02:59 +02:00
Nika Layzell f41577663f Bug 1681529 - Part 9: Add a basic test for the seekable stream wrapper, r=baku
This basic GTest exercises some of the basic functionality of the
SeekableStreamWrapper when applied to a nsPipe.

Differential Revision: https://phabricator.services.mozilla.com/D101808
2021-01-28 00:30:04 +00:00
Nika Layzell 96b1095085 Bug 1681529 - Part 6: Introduce a SeekableStreamWrapper to make pipes seekable, r=baku
This patch introduces a new SeekableStreamWrapper class which handles adapting
nsIInputStreams which support being cheaply cloned using nsICloneableInputStream
into seekable input streams by operating on a clone of the original stream, and
re-cloning that stream when seeking backwards.

This wrapper is generally intended to be used with nsPipeInputStream as that
type supports both a fairly cheap clone operation, and keeping a large internal
buffer which is fairly cheap to seek using this method, but should also work
with other types such as RemoteLazyInputStream or nsStringStream.

An alternate strategy was considered where nsPipe was given internal support for
a mSeekable flag to be set on creation. This flag would then have a similar
effect, except with additional optimizations due to being visible within the
implementation of the nsPipe, rather than relying on an unadvanced
nsPipeInputStream to keep the buffer alive.

I ended up choosing this approach instead for a few reasons:

 * The seekable adapter can be applied to an already-created nsPipeInputStream,
   such as one received from IPC. With the nsPipe approach, making an IPC stream
   seekable either requires telling IPCStreamDestination to use a seekable pipe
   ahead of time, or performing a NS_AsyncCopy from the IPC-provided pipe into a
   different seekable pipe, which is likely wasted effort and would prevent
   optimizations such as RemoteLazyInputStream and DelayedStart streams.
 * The adapter can support other features of the underlying stream, such as
   nsIInputStreamLength, without resorting to adding additional adapter layers
   on top of the returned nsPipe.
 * The performance is unlikely to be substantially different in the most common
   case, which is using Seek(NS_SEEK_SET, 0) to return to the beginning of the
   stream.
 * Less additional complexity is added to the already-complicated internals of
   nsPipe, and instead it is kept in a separate wrapper stream, which is easier
   to review.

Using nsStorageStream, as is used by EnsureUploadStreamIsCloneable, was also
considered, but was rejected as it has similar problems to the seekable nsPipe
approach and also doesn't implement nsIAsyncStream, meaning that one must wait
for the NS_AsyncCopy to be completed before reading the stream.

It may actually be possible to replace the existing uses of nsStorageStream with
a wrapped nsPipe in the future, but that is left as follow-up material, and may
have memory overhead implications due to nsPipe not resizing the final segment,
unlike nsStorageStream.

Differential Revision: https://phabricator.services.mozilla.com/D101805
2021-01-27 21:55:17 +00:00
Jan Varga 6543a55a77 Bug 1681469 - Allow nsBaseHashtable to work with a non-default-constructible/non-movable DataType; r=nika
nsBaseHashtable now supports non-default-constructible DataType and
UserDataType, however not all methods can be instantiated.  All methods which
can't be instantiated with non-default-constructible DataType or UserDataType
are now described as such in method definitions.

The public API of PLDHashTable and nsBaseHashtable/nsDataHashtable was changed:
- A new method PLDHashTable::WithEntryHandle has been added. It allows to use a
  custom function for entry initialization (instead of the global hook).
- A new method nsBaseHashtable::MaybeGet has been added.
- A new overload nsBaseHashtable::Remove has been added.
- The nsDataHashtable::GetAndRemove method has been pulled up to
  nsBaseHashtable.

In addition, the following implementation details have changed:

PLDHashTable:
- The code from the Add method has been split into MakeEntryHandle and a helper
  object called EntryHandle. The Add method is now implemented on top of that.

nsTHashtable:
- A new (non-public) API for WithEntryHandle has been added.
- The InitEntry hook is no longer used. Instead of using the hook, PutEntry
  methods now use nsTHashtable::WithEntryHandle instead of PLDHashTable::Add.
  This change allows to do custom initialization in derived classes.

nsBaseHashtable:
- A new (non-public) API for WithEntryHandle has been added.
- Put methods no longer use nsTHashtable::PutEntry, they now use the new method
  nsBaseHashtable::WithEntryHandle.

Differential Revision: https://phabricator.services.mozilla.com/D99428
2021-01-29 08:39:40 +00:00
Brindusan Cristian 3819b1c1cc Backed out changeset 6ecaa139c502 (bug 1681469) for gtest AddressSanitizer failures. CLOSED TREE 2021-01-29 06:53:39 +02:00
Jan Varga 4ab8759533 Bug 1681469 - Allow nsBaseHashtable to work with a non-default-constructible/non-movable DataType; r=nika
nsBaseHashtable now supports non-default-constructible DataType and
UserDataType, however not all methods can be instantiated.  All methods which
can't be instantiated with non-default-constructible DataType or UserDataType
are now described as such in method definitions.

The public API of PLDHashTable and nsBaseHashtable/nsDataHashtable was changed:
- A new method PLDHashTable::WithEntryHandle has been added. It allows to use a
  custom function for entry initialization (instead of the global hook).
- A new method nsBaseHashtable::MaybeGet has been added.
- A new overload nsBaseHashtable::Remove has been added.
- The nsDataHashtable::GetAndRemove method has been pulled up to
  nsBaseHashtable.

In addition, the following implementation details have changed:

PLDHashTable:
- The code from the Add method has been split into MakeEntryHandle and a helper
  object called EntryHandle. The Add method is now implemented on top of that.

nsTHashtable:
- A new (non-public) API for WithEntryHandle has been added.
- The InitEntry hook is no longer used. Instead of using the hook, PutEntry
  methods now use nsTHashtable::WithEntryHandle instead of PLDHashTable::Add.
  This change allows to do custom initialization in derived classes.

nsBaseHashtable:
- A new (non-public) API for WithEntryHandle has been added.
- Put methods no longer use nsTHashtable::PutEntry, they now use the new method
  nsBaseHashtable::WithEntryHandle.

Differential Revision: https://phabricator.services.mozilla.com/D99428
2021-01-28 20:58:58 +00:00
Andrew McCreight 1aac9cb98a Bug 1571186 - Disable TestExpirationTracker on debug OSX for frequent failures. r=KrisWright
Apparently this test has a history of failures, and it recently
started failing frequently for no apparent reason.

Differential Revision: https://phabricator.services.mozilla.com/D103116
2021-01-26 22:43:58 +00:00
Csoregi Natalia d97e4efd8e Backed out 9 changesets (bug 1681529) for causing bustage on TestSeekableStreamWrapper.cpp. CLOSED TREE
Backed out changeset 99d1c9682dc2 (bug 1681529)
Backed out changeset b562b6038855 (bug 1681529)
Backed out changeset 5a5f514a6cfe (bug 1681529)
Backed out changeset ceb55436928a (bug 1681529)
Backed out changeset 9852de883959 (bug 1681529)
Backed out changeset 1a33ea8b533d (bug 1681529)
Backed out changeset 3385635e9521 (bug 1681529)
Backed out changeset 49c28bfc4da4 (bug 1681529)
Backed out changeset 43cc14af229d (bug 1681529)
2021-01-25 23:40:44 +02:00
Nika Layzell 16dcb71f07 Bug 1681529 - Part 9: Add a basic test for the seekable stream wrapper, r=baku
This basic GTest exercises some of the basic functionality of the
SeekableStreamWrapper when applied to a nsPipe.

Differential Revision: https://phabricator.services.mozilla.com/D101808
2021-01-20 16:17:39 +00:00
Nika Layzell aced9c0ee0 Bug 1681529 - Part 6: Introduce a SeekableStreamWrapper to make pipes seekable, r=baku
This patch introduces a new SeekableStreamWrapper class which handles adapting
nsIInputStreams which support being cheaply cloned using nsICloneableInputStream
into seekable input streams by operating on a clone of the original stream, and
re-cloning that stream when seeking backwards.

This wrapper is generally intended to be used with nsPipeInputStream as that
type supports both a fairly cheap clone operation, and keeping a large internal
buffer which is fairly cheap to seek using this method, but should also work
with other types such as RemoteLazyInputStream or nsStringStream.

An alternate strategy was considered where nsPipe was given internal support for
a mSeekable flag to be set on creation. This flag would then have a similar
effect, except with additional optimizations due to being visible within the
implementation of the nsPipe, rather than relying on an unadvanced
nsPipeInputStream to keep the buffer alive.

I ended up choosing this approach instead for a few reasons:

 * The seekable adapter can be applied to an already-created nsPipeInputStream,
   such as one received from IPC. With the nsPipe approach, making an IPC stream
   seekable either requires telling IPCStreamDestination to use a seekable pipe
   ahead of time, or performing a NS_AsyncCopy from the IPC-provided pipe into a
   different seekable pipe, which is likely wasted effort and would prevent
   optimizations such as RemoteLazyInputStream and DelayedStart streams.
 * The adapter can support other features of the underlying stream, such as
   nsIInputStreamLength, without resorting to adding additional adapter layers
   on top of the returned nsPipe.
 * The performance is unlikely to be substantially different in the most common
   case, which is using Seek(NS_SEEK_SET, 0) to return to the beginning of the
   stream.
 * Less additional complexity is added to the already-complicated internals of
   nsPipe, and instead it is kept in a separate wrapper stream, which is easier
   to review.

Using nsStorageStream, as is used by EnsureUploadStreamIsCloneable, was also
considered, but was rejected as it has similar problems to the seekable nsPipe
approach and also doesn't implement nsIAsyncStream, meaning that one must wait
for the NS_AsyncCopy to be completed before reading the stream.

It may actually be possible to replace the existing uses of nsStorageStream with
a wrapped nsPipe in the future, but that is left as follow-up material, and may
have memory overhead implications due to nsPipe not resizing the final segment,
unlike nsStorageStream.

Differential Revision: https://phabricator.services.mozilla.com/D101805
2021-01-20 16:19:50 +00:00
Simon Giesecke ae63265100 Bug 1679987 - Add nsTokenizedRange adapter to enable range-based for with tokenizers. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D98307
2020-12-16 19:10:13 +00:00
Simon Giesecke 792f5c1317 Bug 1583109 - Add StringJoin(Append) utility functions that join a sequence of items into a string. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D98749
2020-12-14 09:44:53 +00:00
Simon Giesecke 7d166ee1a3 Bug 1680217 - Allow NewRunnableMethod to move in the this pointer from a RefPtr. r=xpcom-reviewers,KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D98440
2020-12-07 21:43:43 +00:00
Simon Giesecke 1c53236b70 Bug 1679272 - Include ScopeExit.h exactly where used. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D98888
2020-12-07 14:25:59 +00:00
Barret Rennie e0e9d2d31b Bug 1660841 - Provide file creation time via nsIFile::creationTime{,ofLink} r=nika
Differential Revision: https://phabricator.services.mozilla.com/D96889
2020-12-03 04:10:47 +00:00
Byron Campen [:bwc] f8ab1fb0f7 Bug 1626278: Test case for MozPromise::AllSettled. r=jya
Differential Revision: https://phabricator.services.mozilla.com/D92652
2020-11-19 18:46:22 +00:00
Valentin Gosu 6fe922232a Bug 1667581 - Batch calls to nsSegmentedBuffer::FreeOMT when dispatching to a background thread r=baku,sg,KrisWright
This is a workaround for bug 1670737 to avoid spamming a saturated
thread pool with too many events.
Also converts some unused code to a gtest.

Differential Revision: https://phabricator.services.mozilla.com/D93995
2020-11-25 18:21:38 +00:00
Simon Giesecke d10d03d076 Bug 1676365 - Move SpinEventLoopUntil to separate header. r=#xpcom-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D96556

Depends on D96554
2020-11-23 16:10:41 +00:00
Simon Giesecke 971b645fe3 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
Kris Maglione 7ae9faa46f Bug 1651774: Update mozilla/use-services rule for native Services implementation. r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D93858
2020-11-06 18:58:33 +00:00
Valentin Gosu 07f304d057 Bug 1675203 - Backed out changeset 0bcd9a5ae49f (Bug 1667581) for causing memory usage regressions a=backout
Differential Revision: https://phabricator.services.mozilla.com/D96007
2020-11-05 10:43:09 +00:00