Commit Graph

107 Commits

Author SHA1 Message Date
Bevis Tseng
a7505864a8 Bug 1378930 - Part 2: Remove the aName parameter from SchedulerGroup/DocGroup/DispatcherTrait. r=billm
--HG--
extra : rebase_source : 11319e568a51d16754a6a9990f76c35c86c2bda7
2017-07-26 16:13:35 +08:00
Gerald Squelart
fd79ed9c4e Bug 1379091 - Let block cache tell MediaCache its block use limit - r=cpearce
MozReview-Commit-ID: 5ZCD3NoeYEP

--HG--
extra : rebase_source : 0fe76cfa6b15053dc5cf2b392c5d649e6888e6c6
2017-07-10 10:23:02 +12:00
Gerald Squelart
eebc1367f0 Bug 1378518 - Use offset-to-block utilities to check MediaCache offset ranges - r=jwwang
MozReview-Commit-ID: 8IsctoABVrb

--HG--
extra : rebase_source : 85d6b405c78207bee730f9482b784e22a063f473
2017-07-06 15:42:56 +12:00
Gerald Squelart
dc59f14eff Bug 1378518 - Better MediaCache GetMaxBlocks() computation - r=jwwang
Retrieve pref from MediaPrefs, which is more efficient than
Preferences::GetInt().

Also refactored computations to avoid unnecessary type conversions.

MozReview-Commit-ID: Ii27lthRRNI

--HG--
extra : rebase_source : d1ea46060cd2c35b7fd07a191184c0318187c080
2017-07-06 16:12:58 +12:00
Gerald Squelart
3faa7098b0 Bug 1374441 - Backed out bug 1374173 (MediaCacheStream Seek&Read refactoring) - r=jwwang
Bug 1374173 seems to be the cause of all MediaCache intermittent assertion
failures. It's not an important bug, so let's back-out and verify that
intermittents disappear.

MozReview-Commit-ID: 2X8iW1hWu99

--HG--
extra : rebase_source : e22443a5b9d5ba9a6ce4b126953a880e8e469cd2
2017-06-23 13:18:07 +12:00
Jean-Yves Avenard
10d2da1b08 Bug 1374596: P7. Fix includes as per coding style. r=padenot
MozReview-Commit-ID: 5WfOWcOoxg0

--HG--
extra : rebase_source : 988c09623e83a0d9188d9ff5d705314e2c43e756
2017-06-20 17:56:55 +02:00
Gerald Squelart
39907d6bb8 Bug 1374173 - SeekInternal is only used to SEEK_SET - r=jwwang
So its code can be simplified by removing the code doing other operations.

MozReview-Commit-ID: 32g7lp2XLNE

--HG--
extra : rebase_source : 23846b37c73a9dd2b5770e86254f4a07f21def53
2017-06-13 16:13:33 +12:00
Gerald Squelart
07609a56a6 Bug 1374173 - Make MediaCacheStream::Seek and Read internal - r=jwwang
MozReview-Commit-ID: 9tPETuUYDrV

--HG--
extra : rebase_source : d4b5371851f69eb645602b09970c04f13f44f76c
2017-06-13 15:57:46 +12:00
Gerald Squelart
4a3a84f39f Bug 1371882 - Remove unneeded MediaCache::mContentLength - r=cpearce
Now that MediaCache doesn't use the content length to decide which block cache
to use, and can know it's the file-backed MediaCache (to reset the pointer,
and for telemetry purposes), we don't need to store mContentLength anymore.

MozReview-Commit-ID: KjxarKFe9WK

--HG--
extra : rebase_source : e2cb397c6d5e37a8390479f4245255ef52265483
2017-06-15 17:32:26 +12:00
Gerald Squelart
2f8acfe718 Bug 1371882 - MemoryBlockCache is responsible for tracking the combined size of all its buffers - r=cpearce
MemoryBlockCache won't allow initializing, or growing an existing buffer,
above the limit (min of 'media.memory_caches_combined_limit_kb' or
sysmem*'media.memory_caches_combined_limit_pc_sysmem'/100).

MozReview-Commit-ID: 6MkwFp2eeth

--HG--
extra : rebase_source : 17345f6fe9f00fddfbef87090665afccaabb2cf5
2017-06-15 17:10:54 +12:00
Gerald Squelart
319f8220ec Bug 1371882 - Let GetMediaCache decide which block cache to use - r=cpearce
This allows a fallback to the file-backed MediaCache, if a MemoryBlockCache
could not be created and initialized (which may happen in the next patch,
where MemoryBlockCache will take care of not using more than
MediaMemoryCachesCombinedLimit).

MediaCache::Init() is not needed anymore, as its only work was to initialize
its block cache.

MozReview-Commit-ID: ItAdOPuxEvt

--HG--
extra : rebase_source : 08461d61b8d738edb8c2088bca4e33213b8ae4e1
2017-06-15 16:32:06 +12:00
Gerald Squelart
5a0a2a8c04 Bug 1371882 - MediaCache::Flush reinitializes block cache instead of recreating it - r=cpearce
This saves from destruction&re-construction efforts, makes the flushing less
prone to first-initialization failures.
And it will allow moving the choice of block cache outside of MediaCache::Init.

MozReview-Commit-ID: 8vSunM3rRkL

--HG--
extra : rebase_source : d244c9ff0cb34f9b2171e5f5848501cc1d71d2bc
2017-06-15 16:12:30 +12:00
Gerald Squelart
732f34fc15 Bug 1371882 - MediaCache is now ref-counted - r=cpearce
MediaCacheStreams have owning shared pointers to their MediaCache, and
a MediaCache owns itself while an update is in flight.
A non-owning pointer `gMediaCache` is only used by GetMediaCache and
~MediaCache to manage the one file-backed MediaCache.

MozReview-Commit-ID: AQHuXWGrKt6

--HG--
extra : rebase_source : f256e20080b8701f87418209aa42c5a0fe3f5239
2017-06-15 15:02:25 +12:00
Gerald Squelart
16c8e8bc32 Bug 1371882 - Remove MediaBlockCacheBase::Close() - r=cpearce
The only external use of Close was always followed by an implicit destruction
(by resetting the RefPtr), so we don't need to expose it, and it can be done
from the destructor.

FileBlockCache keeps its Close() function for internal use.
Also, FileBlockCache::mIsOpen is redundant, as it's true iff mThread is not
null.

MozReview-Commit-ID: LV7YVrwJvGG

--HG--
extra : rebase_source : 23decadf249b9e63190b3e19d81edc4a090afcef
2017-06-15 14:10:05 +12:00
Gerald Squelart
ac5fcad310 Bug 1371882 - Avoid MemoryBlockCache when combined sizes > 'media.memory_caches_combined_limit_...' - r=cpearce
Don't go over the lowest of 'media.memory_caches_combined_limit_kb'
(kilobytes) or 'media.memory_caches_combined_limit_pc_sysmem' (percents of
system memory).

Added more logging around creation/destruction of MediaCaches.

MozReview-Commit-ID: Cdz4ycyn1RR

--HG--
extra : rebase_source : 63168234f186c3ef9c0289a189a647d67d8526a4
2017-06-12 15:42:26 +12:00
Gerald Squelart
2f4776d6e2 Bug 1371882 - MediaCache uses MemoryBlockCache when content length is known - r=cpearce
MozReview-Commit-ID: 35A4Vc95NtB

--HG--
extra : rebase_source : 8cae198053b6b5ec062137176b8eba377f5bcc83
2017-06-09 18:56:34 +12:00
Gerald Squelart
b3828d2355 Bug 1371882 - Rename MediaCache::mFileCache to mBlockCache - r=cpearce
Because blocks may not necessarily be held in files anymore.

MozReview-Commit-ID: 2GNc7B5w2Jt

--HG--
extra : rebase_source : 4ceda80ca6736b159d8b726cdcfb8d7f74cf8529
2017-06-14 17:01:46 +12:00
Gerald Squelart
98f4458011 Bug 1371882 - Virtualize FileBlockCache's API into MediaBlockCacheBase - r=cpearce
MozReview-Commit-ID: Eya0RWiyiEP

--HG--
rename : dom/media/FileBlockCache.h => dom/media/MediaBlockCacheBase.h
extra : rebase_source : e4e847924e2df5bf0e7f2b7e92068fc104ca9bb6
2017-06-09 14:26:22 +12:00
Gerald Squelart
527c7d3dee Bug 1371882 - If content length <= 'media.memory_cache_max_size', use a discrete memory-backed MediaCache - r=cpearce
MozReview-Commit-ID: HH1R6LjKkxb

--HG--
extra : rebase_source : 2ce35a504c6709624bc7d161003b8331f6f25d1e
2017-06-09 23:15:04 +12:00
Gerald Squelart
d86f260baa Bug 1371882 - Move MEDIACACHESTREAM_NOTIFIED_LENGTH telemetry collection to MediaCacheStream::Init - r=cpearce
The initial telemetry collection was done in NotifyDataLength() because that
was the first point where the length was introduced; but some extra code was
needed to ensure that were collecting the first length.
Now that this initial length is passed directly to Init(), we can report that
number instead.
In the "worst" case, it will actually be a bit more correct about what we
initially wanted to report, i.e., the initial length given by the HTTP
response header; and it's what we really want to know, now that we are using
this number to make a decision about which MediaCache to use.

MozReview-Commit-ID: 11Th8pensZt

--HG--
extra : rebase_source : 97a6d2dcbfad6c9b37819bfe6471baff2ec7e335
2017-06-12 14:27:46 +12:00
Gerald Squelart
9c6ad7eb88 Bug 1371882 - MediaCacheStream::Init forwards the known content length to the MediaCache factory - r=cpearce
This will give enough information (for now) for GetMediaCache to decide whether
to use the (one global shared) file-backed MediaCache, or a discrete memory-
backed MediaCache.
(Note that GetMediaCache doesn't use this length yet in this patch.)

MozReview-Commit-ID: 5B2E3sIsc4k

--HG--
extra : rebase_source : 940e782665bf2c3640bbe7389fca02ea7c1482cd
2017-06-08 15:59:43 +12:00
Gerald Squelart
023730a1ca Bug 1371882 - Make gMediaCache private inside MediaCache, to avoid misuse - r=cpearce
MozReview-Commit-ID: 6MyKmG7DNaG

--HG--
extra : rebase_source : 0e26d2e405166de8f0160a78faf4cf52fd68fa9e
2017-06-08 17:12:13 +12:00
Gerald Squelart
703d03eb67 Bug 1371882 - Delay MediaCache destruction if update queued - r=cpearce
MozReview-Commit-ID: LIjZFUIrTtX

--HG--
extra : rebase_source : a17ee8d9eb1c32c19e92b4a0ca71a037f32c8459
2017-06-08 16:45:21 +12:00
Gerald Squelart
420fc822c0 Bug 1371882 - Removed unnecessary gMediaCache-> from MediaCache member functions - r=cpearce
MozReview-Commit-ID: BKjH9hfoL5g

--HG--
extra : rebase_source : d83836ad127895197fba32cd69d282fe9b1c27df
2017-06-08 16:20:37 +12:00
Gerald Squelart
d63ca8dd12 Bug 1371882 - MediaCacheStream::mInitialized is redundant, mMediaCache is non-null after initialization - r=cpearce
MozReview-Commit-ID: 6VIPMLmzuEP

--HG--
extra : rebase_source : 80df4e3bda168660812d420e26c6117c7ccc4b88
2017-06-09 13:48:06 +12:00
Gerald Squelart
fc0f5efec9 Bug 1371882 - MediaCacheStream accesses its MediaCache through a member pointer - r=cpearce
MozReview-Commit-ID: CM1rXqAc4FT

--HG--
extra : rebase_source : a4eaadb9c4bd40034e16a811878cf7663b6a66ce
2017-06-08 17:30:40 +12:00
Gerald Squelart
54ab31eb36 Bug 1371882 - MediaCache::constructor/destructor/Init() don't need to be public - r=cpearce
MozReview-Commit-ID: 9naYvPbGn14

--HG--
extra : rebase_source : d1116e03d4bbef1c6bd1a6be676eb89605a78494
2017-06-09 12:53:11 +12:00
Gerald Squelart
901a3dbeea Bug 1371882 - static MediaCache::GetMediaCache to get file-backed MediaCache - r=cpearce
This is the new recommended way to create&initialize the file-backed
MediaCache.

In future patches, this will also allow the creation of memory-backed
MediaCache objects.

MozReview-Commit-ID: 6RUlNW2eBPP

--HG--
extra : rebase_source : 0b3e6fae71207076812b5cb9172d4497d3e68ea2
2017-06-08 15:09:40 +12:00
Gerald Squelart
2bfadd1441 Bug 1371882 - MediaCache::ResourceStreamIterator is given the MediaCache to work with - r=cpearce
MozReview-Commit-ID: 3Xl4WNESdnY

--HG--
extra : rebase_source : d69d52c68512041dd61c5782e3406aa66a487a28
2017-06-08 15:32:13 +12:00
Gerald Squelart
fca2c5bdbd Bug 1371882 - MediaCacheFlusher allows for multiple MediaCache's - r=cpearce
MediaCacheFlusher constructs itself when needed by the first MediaCache, and
destroys itself when the last MediaCache unregisters itself.

Some MediaCache member functions had to be made non-static, so they could be
called for each instance.

MozReview-Commit-ID: 5Dh9mEKbZHg

--HG--
extra : rebase_source : 1570e30787ba486f9436b4b05aa3cfa0329d1ee7
2017-06-08 14:32:13 +12:00
Mats Palmgren
a74a8a2035 Bug 1371953 - Avoid unnecesary hashtable lookups by using RemoveEntry(EntryType*) rather than RemoveEntry(key) in a couple of places. r=gerald
MozReview-Commit-ID: 8Uu9QX4QhRi
2017-06-14 01:54:26 +02:00
Gerald Squelart
0fa477a0cd Bug 1371205 - MEDIACACHESTREAM_NOTIFIED_LENGTH captures the HTTP header length given to MediaCacheStream - r=cpearce,francois
MozReview-Commit-ID: 9muZcpfD2vG

--HG--
extra : rebase_source : 11de88ac8f0788c3e04ef206bcdacc4ef112a139
2017-06-08 20:26:24 +12:00
Gerald Squelart
41b2a8ff81 Bug 1369538 - Telemetry MEDIACACHESTREAM_LENGTH_KB - r=cpearce,francois
Capture each media stream's length (as provided, otherwise as actually
downloaded), to gauge whether keeping media in memory would have a significant
impact.

MozReview-Commit-ID: 4yUQrbgLcGG

--HG--
extra : rebase_source : bed0ea1d58f864463926478b0f8ea59e7084c4af
2017-06-02 10:43:45 +12:00
Carsten "Tomcat" Book
72ff833516 Backed out changeset 12e990a89018 (bug 1369538) for causing new intermittent leak in browser_devices_get_user_media_in_frame.js 2017-06-02 10:37:59 +02:00
Gerald Squelart
dbea6f45b8 Bug 1369538 - Telemetry MEDIACACHESTREAM_LENGTH_KB - r=cpearce,francois
Capture each media stream's length (as provided, otherwise as actually
downloaded), to gauge whether keeping media in memory would have a significant
impact.

MozReview-Commit-ID: 4yUQrbgLcGG

--HG--
extra : rebase_source : bed0ea1d58f864463926478b0f8ea59e7084c4af
2017-06-02 10:43:45 +12:00
Gerald Squelart
4d566af858 Bug 1366936 - Telemetry: Watermark of number of block owners during MediaCache sessions - r=cpearce,francois
MozReview-Commit-ID: Ed1Eah9TuSJ

--HG--
extra : rebase_source : b539ba0f551c821d0b093435f0fdba958ecd3aaa
2017-05-23 14:59:16 +12:00
Gerald Squelart
8183f3fe78 Bug 1366929 - Telemetry: Watermark (in KB) reached by each MediaCache session - r=cpearce
MozReview-Commit-ID: 6BDFFYq1JnJ

--HG--
extra : rebase_source : dd67c472369d3c0db714333e1eb9f7c665514b17
2017-05-23 14:44:06 +12:00
JW Wang
c6c155a08e Bug 1364001. P1 - add an API to throttle download. r=cpearce
MozReview-Commit-ID: HdmAgvo1GE3

--HG--
extra : rebase_source : 97f0aa3e40c6c774ad7681ee2aae69393c47e741
extra : intermediate-source : 9f2e1751e19f88625d2a89dba0b1648f97d2478f
extra : source : b68fed514292e5e8c7815633052daeee24f64a95
2017-05-11 16:49:36 +08:00
JW Wang
69b3ff3c30 Bug 1358726 - fix the assertion failure in AllocateAndWriteBlock(). r=gerald
block->mOwners might be empty if all streams for the resource id are
closed. We don't bother write the data to the cache since there is no
stream to use it.

MozReview-Commit-ID: KKiyZqLBjim

--HG--
extra : rebase_source : 7fa0a6d841dff91dd7142aac5a336b950342ac67
2017-04-23 21:18:07 +08:00
JW Wang
57f154251e Bug 1357244. P2 - enforce the invariant that a block is in mFreeBlocks iff it has no owners. r=gerald
http://searchfox.org/mozilla-central/rev/4bd7a206dea5382c97a8a0c30beef668cc449f5b/dom/media/MediaCache.cpp#1529
Note we might return here with mOwners is empty and break the invariant.

MozReview-Commit-ID: JC5OtEU0B8O

--HG--
extra : rebase_source : f842601db12e047fd73a9b062612da2f2b7c0263
2017-04-18 10:44:38 +08:00
JW Wang
e82ac126f4 Bug 1357244. P1 - use stronger assertions to debug non-debug builds. r=gerald
MozReview-Commit-ID: 8QK7vawpoIQ

--HG--
extra : rebase_source : f1b47b3607c0c03d2ad7c4d0ada3b89304780054
2017-04-18 10:23:56 +08:00
JW Wang
02d7482da7 Bug 1355719 - Use shorter names for logging macros in MediaCache. r=kaku
MozReview-Commit-ID: GY6o1xBu0wO

--HG--
extra : rebase_source : 51ef1d40222564b17218db5240cdbb30df9175fc
extra : source : 11cb40d76dbe3163d1620aea3de9eec82f3e25a0
2017-04-12 14:51:34 +08:00
JW Wang
1430347b77 Bug 1355406 - Change the type of MediaCacheStream::mPartialBlockBuffer to UniquePtr<uint8_t[]>. r=jya
UniquePtr<uint8_t[]> has the same alignment as UniquePtr<int64_t[]> for the
underlying buffer. It also allows us to remove some reinterpret_casts.

MozReview-Commit-ID: 8V1lZdayFQv

--HG--
extra : rebase_source : 61f1943b9f3e464b47865fb0fff2742125f4c688
extra : intermediate-source : 329adb8a4414f32e2f83ba79af06d288d7b25705
extra : source : ba967b187b9dbc8f402db90272f55b9ee9d92692
2017-04-11 16:52:38 +08:00
JW Wang
e6d11e2bb5 Bug 1355393. P2 - write the bytes out when we've collected a whole block. r=cpearce
MozReview-Commit-ID: 3kAk235rZig

--HG--
extra : rebase_source : e7bcb0be101dbe4d3c95140673086e8396ac1b8f
extra : source : f35e9f125bb38c39e093d8958115708cc3dd4487
2017-04-11 16:06:08 +08:00
JW Wang
52344be7f1 Bug 1355393. P1 - let FileBlockCache::WriteBlock() take 2 buffers instead of one. r=cpearce
This allows us to save copies in combining 2 bufffers into one before calling
FileBlockCache::WriteBlock().

MozReview-Commit-ID: 62kQIxp3Ju0

--HG--
extra : rebase_source : a64c160b9ab3d7bbd724be053fea6358ae7885df
extra : source : f699fdb6fdaf1fd5b4dfeb394928c95e33853a53
2017-04-11 15:47:46 +08:00
JW Wang
3b2675d90b Bug 1354389. P3 - fix the callers to handle changes when dropping the monitor. r=cpearce
No change is needed for MediaCacheStream::Read() which calls |mon.Wait()|
and has handled changes when dropping the monitor.

MozReview-Commit-ID: 40h0cHn1WFx

--HG--
extra : rebase_source : 5447339ed7751f3171458d8e5fb1e5f6fe3a786e
2017-04-10 13:57:13 +08:00
JW Wang
64b0fbf69a Bug 1354389. P2 - remove the unused function. r=cpearce
MozReview-Commit-ID: 4Mx89MxJmVO

--HG--
extra : rebase_source : 0427e7597dcf7087485945fd283e91e81de9b912
2017-04-10 11:56:35 +08:00
JW Wang
8a3ec7649b Bug 1354389. P1 - drop the monitor before doing IO. r=cpearce
We don't want to do IO while holding the monitor which might be acquired
on the main thread in MediaCache::Update().

MozReview-Commit-ID: 4cHM35K8Twb

--HG--
extra : rebase_source : 5a00332933abd1812f64fa57c9f5e2947ec979ae
2017-04-10 11:55:26 +08:00
JW Wang
d64d62164c Bug 1194891. P4 - close all streams associated with private browsing windows when PB is done. r=cpearce
MozReview-Commit-ID: MmvMuzuFX3

--HG--
extra : rebase_source : d5f98bd815323e9a79959af49a9585d8f6108d28
extra : source : 7a82be361a50b950b579a5f6b1872d10de80d76f
2017-04-06 16:39:14 +08:00
JW Wang
09e1217347 Bug 1194891. P2 - don't write any data for a closed stream. r=cpearce
MozReview-Commit-ID: 3buPoKxVXbH

--HG--
extra : rebase_source : d28ade4b90d63deb386e4922b3a1251dfd878a31
extra : source : dd4013c9d706212cad669a1fe124af03beb4a32e
2017-04-06 16:24:44 +08:00