Commit Graph

3145 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
fffb25b74f Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +02:00
Andrew Osmond
e76059bf98 Bug 1465496 - Backout part 9 of bug 1462355 to fix talos regressions. r=aosmond 2018-05-30 19:35:40 -04:00
arthur.iakab
fb18cb09bd Merge mozilla inbound to central a=merge 2018-05-31 01:05:10 +03:00
Christian Holler
570031d38c Bug 1464202 - Improve and centralize libFuzzer flag management. r=froydnj
MozReview-Commit-ID: HFrQDAZWtpo

--HG--
extra : rebase_source : ab1da001d7e9280fbfb37858505f1d0d0caf7d54
2018-05-24 21:11:46 +02:00
Valentin Gosu
0735c3877c Bug 1456975 - Check fields in nsMozIconURI deserialization. r=agaynor 2018-05-02 14:53:13 +02:00
Andrew Osmond
14b23692e6 Bug 1462355 - Part 9. Lock animated imgFrame objects at creation rather than deferring. r=tnikkel 2018-05-29 08:36:13 -04:00
Andrew Osmond
d76ab26901 Bug 1462355 - Part 8. Avoid allocating on the heap in DrawableFrameRef. r=tnikkel
We can easily use Maybe<DataSourceSurface::ScopedMap> instead of
allocated the map on the heap. This does require some minor changes to
ScopedMap to properly support moves, but should be much more efficient.
2018-05-29 08:36:13 -04:00
Andrew Osmond
d2e5cfae55 Bug 1462355 - Part 7. Don't hit the SurfaceCache in FrameAnimator::GetCompositedFrame if possible. r=tnikkel
In FrameAnimator::GetCompositedFrame, we call SurfaceCache::Lookup even
when we use the composited frame directly and leave the lookup result
unused. The only value in performing the lookup could be to mark the
surface as used to avoid expiring it too soon, but
FrameAnimator::RequestRefresh should already be doing enough to keep it
alive, if the image isn't locked in the first place.
2018-05-29 08:36:13 -04:00
Andrew Osmond
77b6f542e8 Bug 1462355 - Part 6. Reuse RawAccessFrameRef in FrameAnimator where possible. r=tnikkel
In FrameAnimator::RequestRefresh and AdvanceFrame, we currently create
several RawAccessFrameRef objects to the same frames, either to get
timeouts or perform the blending. With some tweaking, we can avoid
requesting the same frame more than once. This will avoid mutex locks on
the surface provider and the frame itself.
2018-05-29 08:36:12 -04:00
Andrew Osmond
8c7d13e7f7 Bug 1462355 - Part 5. Avoid converting from DrawableFrameRef to RawAccessFrameRef. r=tnikkel
DrawableSurface only exposes DrawableFrameRef to its users. This is
sufficient for the drawing related code in general, but FrameAnimator
really needs RawAccessFrameRef to the underlying pixel data (which may
be paletted). While one can get a RawAccessFrameRef from a
DrawableFrameRef, it requires yet another lock of the imgFrame's mutex.
We can avoid this extra lock if we just allow the callers to get the
right data type in the first place.
2018-05-29 08:36:12 -04:00
Andrew Osmond
8e097f0169 Bug 1462355 - Part 4. Remove imgFrame::GetAnimationData as it is no longer used. r=tnikkel 2018-05-29 08:36:12 -04:00
Andrew Osmond
f1dd034aa6 Bug 1462355 - Part 3. Make FrameAnimator use the new imgFrame/RawAccessFrameRef methods. r=tnikkel 2018-05-29 08:36:12 -04:00
Andrew Osmond
fdd7908a05 Bug 1462355 - Part 2. Expose imgFrame's data pointers via RawAccessFrameRef. r=tnikkel
RawAccessFrameRef ensures there is a valid data pointer to the pixel
data for the frame. It is a common pattern for users of
RawAccessFrameRef to follow up with a request for the data pointer
shortly after creation. We can avoid an extra lock by exposing this data
pointer from RawAccessFrameRef, and populating it via
imgFrame::LockImageData.
2018-05-29 08:36:12 -04:00
Andrew Osmond
01907fa0e3 Bug 1462355 - Part 1c. Make individual image decoders to use updated Decoder/SurfacePipe methods. r=tnikkel 2018-05-29 08:36:12 -04:00
Andrew Osmond
6c32a5f985 Bug 1462355 - Part 1b. Update Decoder and SurfacePipe plumbing to use updated imgFrame methods. r=tnikkel 2018-05-29 08:36:12 -04:00
Andrew Osmond
5d9ffb0638 Bug 1462355 - Part 1a. Make imgFrame animation parameters threadsafe. r=tnikkel
We currently choose to set the animation parameters (blend method, blend
rect, disposal method, timeout) in imgFrame::Finish instead of
imgFrame::InitForDecoder. The decoders themselves already have access to
the necessary information at the time InitForDecoder is called, so there
is no reason to do this. Moving the configuration to initialization will
allow us to relax the mutex protection on these parameters.

This part simply reorganizes imgFrame, and subsequent parts will
introduce the necessary changes to SurfacePipe and decoders.
2018-05-29 08:36:11 -04:00
Andrew Osmond
644583163d Bug 1462650 - Improve imgTools::EncodeScaledImage performance. r=lsalzman
We should avoiding creating a DrawTarget to create a new
DataSourceSurface when the original surface produced by
RasterImage::GetFrameAtSize matches our requirements in
imgTools::EncodeScaledImage. We should also be using Skia instead of
Cairo.

This patch also fixes a few error conditions where we would not have
unmapped the surface properly.
2018-05-25 09:02:20 -04:00
Andrew Osmond
9b6c64c753 Bug 1382683 - Part 3. Add gtests for SurfaceFilter/Pipe::WritePixelBlocks. r=tnikkel 2018-05-25 06:52:05 -04:00
Andrew Osmond
cb1d37e391 Bug 1382683 - Part 2. Switch nsGIFDecoder2 to write pixels in blocks instead of individually. r=tnikkel
nsGIFDecoder2::YieldPixel is sufficiently complex that the optimizer
does not appear to inline it with the rest of the templated methods. As
such there is a high cost to calling it. This patch modifies it to yield
a requested number of pixels before exiting, allowing us to amortize the
cost of calling across a row instead of a pixel. Based on profiling,
this will significantly reduce the time require to decode a frame.
2018-05-25 06:52:03 -04:00
Andrew Osmond
5bcb89ae72 Bug 1382683 - Part 1. Implement SurfacePipe::WritePixelBlocks for faster writing of pixels. r=tnikkel
It has been observed in profiling that the templated methods that write
pixels to an image buffer do not always inline methods properly, leading
to a high cost of writing a single pixel if it is less than trivial. As
such, there is a new SurfacePipe method, WritePixelBlocks, which
requests pixels in blocks. The provided lambda will write up to the
requested number of pixels into the given buffer. WritePixelBlocks
itself will request enough pixels to fill the row, advance the row if
complete and iterate until it is complete or we need more data.
2018-05-25 06:52:01 -04:00
Emilio Cobos Álvarez
dd5f25c2f6 Bug 1465107: Cleanup remaining mochitest / reftest / crashtests stylo expectations. r=xidorn
MozReview-Commit-ID: 1IeURcnoESX
2018-05-30 10:03:50 +02:00
Adrian Wielgosik
fff55359ea Bug 1460940 - Remove nsIDOMDocument uses in image/. r=bz
MozReview-Commit-ID: HUiegmeFLo4

--HG--
extra : rebase_source : cd6453dc5d708fc5cdc75114d163ea2389423d55
2018-05-11 19:46:15 +02:00
Andrew Osmond
4479d80c10 Bug 1453454 - Improve SourceBuffer support for large encoded image data. r=jrmuizel
Regardless of the size of an encoded image, SourceBuffer::Compact would
try to consolidate all of the chunks into a single chunk. If an image is
quite large, it can be actively harmful to do this, because we want a
very large contiguous chunk of memory for no real reason, and spend
extra time on the main thread doing the memcpy/consolidation.

Instead we now cap out the chunk size at 20MB. If we start allocating
chunks of this size, we will not perform compacting when we have
received all of the data. (Save for realloc'ing the last chunk since it
probably isn't full.)

On a related note, if we hit an out-of-memory condition in the middle of
appending data to the SourceBuffer, we would swallow the error. This is
because nsIInputStream::ReadSegments will succeed if any data was
written. This leaves the SourceBuffer out of sync. We now propogate this
error up properly to the higher levels.

fixup
2018-05-09 09:31:07 -04:00
Andrew Osmond
d19566e09c Bug 1454149 - Do not advance animated images which are not displayed. r=tnikkel
All animated images on a page are currently registered with the refresh
driver and advance with the tick refresh. These animations may not even
be in view, and if they are large and thus cause redecoding, cause a
marked increase in CPU usage for no benefit to the user.

This patch adds an additional flag, mCompositedFrameRequested, to the
AnimationState used by FrameAnimator. It is set to true each time the
current animated image frame is requested via
FrameAnimator::GetCompositedFrame. It is set to false each time the
frame is advanced in FrameAnimator::AdvanceFrame (via
FrameAnimator::RequestRefresh). If it is true when
FrameAnimator::RequestRefresh is called, then it will advance the
animation according to the normal rules. If it is false, then it will
set the current animation time to the current time instead of advancing.

This should not cause the animation to fall behind anymore or skip
frames more than it does today. This is because if
FrameAnimator::GetCompositedFrame is not called, then the internal state
of the animation is advancing ahead of what the user sees. Once it is
called, the new frame is far ahead of the previously displayed frame.
The only difference now is that we will display the previous frame for
slightly longer until the next refresh tick.

Note that if an animated image is layerized (should not happen today) or
otherwise uses an ImageContainer, this optimization fails. While we know
whether or not we have an image container, we do not know if anything is
actively using it.
2018-05-09 08:04:20 -04:00
Chris Peterson
71422dcaa9 Bug 1457813 - Part 2: Replace non-asserting NS_PRECONDITIONs with MOZ_ASSERTs. r=froydnj
s/NS_PRECONDITION/MOZ_ASSERT/ and reindent

MozReview-Commit-ID: KuUsnVe2h8L

--HG--
extra : source : c14655ab3df2c9b1465dd8102b9d25683359a37b
2018-04-28 12:50:58 -07:00
shindli
c72db9830d Merge mozilla-central to autoland. a=merge CLOSED TREE 2018-04-27 00:44:51 +03:00
Emilio Cobos Álvarez
0faef276ec Bug 1455885: Make the SVG context paint not use a node property, but a member in SVGDocument. r=jwatt
MozReview-Commit-ID: H6SRTsDL5Rh
2018-04-26 17:07:39 +02:00
Kartikaya Gupta
fc66c485b6 Bug 1456882 - Enable some passing mochitests on linux64-qr. r=jrmuizel
MozReview-Commit-ID: 5VIHjwx6A2j

--HG--
extra : rebase_source : d986028cff52ba52a58887225e272bf04ad88de3
2018-04-25 11:29:07 -04:00
Andrew Osmond
4b77101e8d Bug 1444537 - Part 4. Add gtests for AnimatedFrameBuffer for redecode errors. r=tnikkel 2018-04-24 13:51:38 -04:00
Andrew Osmond
5f0abb12dc Bug 1444537 - Part 3. Fix how redecode errors could cause animated image state inconsistencies. r=tnikkel
We can discard frames from an animated image if the memory footprint
exceeds the threshold. This will cause us to redecode frames on demand
instead. However decoders can fail to produce the same results on
subsequent runs due to differences in memory pressure, etc. If this
happens our state can get inconsistent. In particular, if we keep
failing on the first frame, we end up in an infinite loop on the decoder
thread.

Since we don't have the owning image to signal, as we had to release our
reference to it after the first pass, we can do little but stop decoding.
From the user's perspective, the animation will come to a stop.
2018-04-24 13:51:35 -04:00
Boris Zbarsky
2b6097ae6d Bug 1455055 part 1. Convert nsIDOMEventListener to taking an Event, not an nsIDOMEvent. r=masayuki
This does no cleanup other than what's needed to compile.  Cleanup coming up in
later patches.

MozReview-Commit-ID: 3sOnkj71n09
2018-04-20 00:49:29 -04:00
Jeff Muizelaar
4bb17dde09 Bug 1450015. Enable blob invalidation by default. r=gankro 2018-04-17 21:20:51 -04:00
Andrew Osmond
bb48e74870 Bug 1445479 - Ensure we teardown requests on image cache validation failure paths. r=tnikkel
If an imgCacheValidator object is destroyed without calling
imgCacheValidator::OnStartRequest, or imgRequest::Init fails in
OnStartRequest, we left the bound proxies hanging on an update. Now we
cancel the new request, and bind the validating proxies to said request
to ensure their listeners fail gracefully.
2018-04-17 14:42:35 -04:00
Cosmin Sabou
6c47714197 Backed out 2 changesets (bug 1444537) for causing crashes on test_discardFramesAnimatedImage.html. a=backout
Backed out changeset 0d23d74448c8 (bug 1444537)
Backed out changeset 07f5d48b90cb (bug 1444537)
2018-04-15 02:40:30 +03:00
Andrew Osmond
25213cc7ab Bug 1444537 - Part 4. Add gtests for AnimatedFrameBuffer for redecode errors. r=tnikkel 2018-04-13 10:58:54 -04:00
Andrew Osmond
2e06ac3032 Bug 1444537 - Part 3. Fix how redecode errors could cause animated image state inconsistencies. r=tnikkel
We can discard frames from an animated image if the memory footprint
exceeds the threshold. This will cause us to redecode frames on demand
instead. However decoders can fail to produce the same results on
subsequent runs due to differences in memory pressure, etc. If this
happens our state can get inconsistent. In particular, if we keep
failing on the first frame, we end up in an infinite loop on the decoder
thread.

Since we don't have the owning image to signal, as we had to release our
reference to it after the first pass, we can do little but stop decoding.
From the user's perspective, the animation will come to a stop.
2018-04-13 10:58:52 -04:00
Sebastian Hengst
0819f35e51 Backed out 4 changesets (bug 525063) on request from Andi. a=backout
Backed out changeset 516c4fb1e4b8 (bug 525063)
Backed out changeset 6ff8aaef2866 (bug 525063)
Backed out changeset bf13e4103150 (bug 525063)
Backed out changeset d7d2f08e051c (bug 525063)
2018-04-13 16:01:28 +03:00
Tristan Bourvon
a3a77c0312 Bug 525063 - Initialize uninitialized class attributes in m-c. r=ehsan 2018-04-10 21:11:02 +02:00
Ciure Andrei
3f4a118829 Merge mozilla-central to mozilla-inbound. a=merge CLOSED TREE 2018-04-11 12:00:35 +03:00
Kartikaya Gupta
0f89486f32 Bug 1452658 - Mark many reftests as fuzzy instead of failing for windows-qr. r=jrmuizel
MozReview-Commit-ID: BDvtV6trKkK

--HG--
extra : rebase_source : 0591564f6cea5c782de6baecc24c3defcef0c4fb
2018-04-10 17:48:16 -04:00
Nika Layzell
0c3ba13e4c Bug 1437167 - Part 1: Stop using PRIntervalTime as the argument to CondVar::Wait and Monitor::Wait, r=mstange, r=froydnj 2018-04-10 17:49:47 -04:00
Kartikaya Gupta
9a9c13a09f Bug 1344350 - Mark reftests failing with webrender on windows. r=jrmuizel
Many of these could probably be fuzzed but in the interests of getting
the reftest suite turned on sooner I'm doing a blanket fails-if. This
covers all the reftests where there is more fuzz with webrender on
windows than any of existing annotations account for. In some cases the
fuzz is only a few pixels more than the equivalent Linux fuzz already
annotated, but I'll clean that up in a future bug.

MozReview-Commit-ID: IaKarbnL46d

--HG--
extra : rebase_source : 71889340305b0b12fa8eace722e42bb3faf14419
2018-04-06 11:58:43 -04:00
Emilio Cobos Álvarez
3c69ce8551 Bug 1451405: Notify debug-only image observers off a script-runner. r=bz
MozReview-Commit-ID: ARn8d2Rxp13
2018-04-05 11:45:40 +02:00
Christoph Kerschbaumer
a929955d1f Bug 1439713 - Change nsIContentPolicy shouldLoad to take an <uri, loadInfo> pair instead of the various args. r=bz 2018-03-29 12:16:23 +02:00
Tom Ritter
449237fc51 Bug 1378552 - Reduce the liklihood of inadvertently misusing NullPrincipal::Create(). r=ckerschb
NullPrincipal::Create() (will null OA) may cause an OriginAttributes bypass.
We change Create() so OriginAttributes is no longer optional, and rename
Create() with no arguments to make it more explicit about what the caller is doing.

MozReview-Commit-ID: 7DQGlgh1tgJ
2018-03-22 13:36:20 -05:00
Xidorn Quan
1962625a79 Bug 1448728 part 1 - Make popular headers not include nsWindowSizes.h. r=njn
MozReview-Commit-ID: EC5J9Im3gfu

--HG--
extra : source : 9fa9209aeeb00009143c5c21f21210c93184e61f
2018-03-28 10:44:49 +11:00
Andrew Osmond
c3618a0b1b Bug 1444537 - Part 2. Shutting down the decode pool should make animated decoders bail early. r=tnikkel
When we shutdown the decode pool threads, it does not do a simple join
with the main thread. It will actually process the main thread event
loop, which can cause a bad series of events. The refresh tick could
still be running and advancing our animated images, causing the animated
decoders to continue running, which in turn prevents the decoder threads
from finishing shutting down, and the main thread from joining them.

Now we check on each frame whether or not the decoder should just stop
decoding more frames because the decode pool has started shutdown. If it
has, it will stop immediately.
2018-03-27 10:57:01 -04:00
Andrew Osmond
a21bbb89ce Bug 1444537 - Part 1. Ensure discarding of animated image frames is clear. r=tnikkel
We should only attempt to discard animation image frames after passing
the frame threshold on the very first pass on the animation. Redecodes
are already in the correct state, as it will discard frames as it
advances the animation. This patch makes it clear what it should be
doing when, but there should be no functional change.
2018-03-27 10:56:48 -04:00
Andrew Osmond
3e285b7bbc Bug 1409440. r=tnikkel 2018-03-27 09:01:14 -04:00
Miko Mynttinen
65c6bee9d6 Bug 1445302 - Replace TArray.RemoveElementAt(TArray.Length() - 1) pattern with TArray.RemoveLastElement() or TArray.PopLastElement() r=froydnj
MozReview-Commit-ID: rGjabnP2iz

--HG--
extra : rebase_source : 1ef6c5ce028ac9ebd9f3176d57835c43fe46bada
2018-03-13 14:51:33 +01:00