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

220 Коммитов

Автор SHA1 Сообщение Дата
JW Wang 1192c9ff4d Bug 1416084. P2 - wake up readers when download is suspended. r=bechen,gerald
It is possible that download is suspended after all bytes are received but
before OnStopRequest is notified. In that case, we will fail to wake up the
readers waiting to read the partial block and cause bug 1412737 comment 30.

MozReview-Commit-ID: GUk4lXO6Upk

--HG--
extra : rebase_source : 2fc277fa54842e434c3f69a474c44fb4c58c976e
2018-01-15 10:25:11 +08:00
JW Wang 0ac7a8be1f Bug 1416084. P1 - reapply bug 1412737 P4: wake up readers only when we have blocks committed to the cache. r=bechen,gerald
Per bug 1412737 P2 changes, a reader will always read data from the cache or
from the last block in the memory. NotifyDataReceived() will be slightly more
efficient if we don't wake up readers unnecessarily when there are no new blocks
committed to the cache.

MozReview-Commit-ID: Afcy5OOeIk3

--HG--
extra : rebase_source : 64916432081d23234e4cc923c343a9724d6c77db
2018-01-15 10:09:02 +08:00
JW Wang 45984a084a Bug 1428951 - add a getter for MediaCacheStream::GetDebugInfo() to take the cache monitor on the main thread. r=bechen,gerald
MozReview-Commit-ID: 8qkZg0MJsGQ

--HG--
extra : rebase_source : 0ff2f6ebe8908bd5dade301f6c2c52e718a23c47
2018-01-09 10:29:10 +08:00
JW Wang 51a137168e Bug 1427699. P2 - rewrite InitAsCloneInternal() to mimic the case where data is downloaded from a channel. r=gerald
Note we add mClient->CacheClientSuspend() so the network state of the element
is changed to IDLE because we have no channel to fetch data initially.

MozReview-Commit-ID: DgJbMxvJBzH

--HG--
extra : rebase_source : 69a3ef35d4b5faaaa645fabe02246d49aebce22e
extra : source : 61ec40ce378a444ec0f74d474c28b6a9db3aa830
2018-01-05 16:31:39 +08:00
JW Wang 5f75454142 Bug 1428242. P3 - use a non-reentrant monitor. r=bechen,gerald
MozReview-Commit-ID: GCXBHugTLJV

--HG--
extra : rebase_source : 099334dd48b7aa2817578f618d3ab12e1b01cf8f
2018-01-05 10:49:38 +08:00
JW Wang c5fd248bb7 Bug 1428242. P2 - MediaCache::ReadCacheFile() doesn't need to drop the cache monitor. r=bechen,gerald
Since we now never take the lock on the main thread, we can safely do file IO
while holding the lock without blocking the main thread.

This reverts the change of Bug 1354389 P1.

MozReview-Commit-ID: EhEwTjINQIT

--HG--
extra : rebase_source : 7eca1226d53a26025188e01837de645a1c879d7b
2018-01-05 10:48:14 +08:00
JW Wang 66c3598324 Bug 1428242. P1 - assert we always take the MediaCache monitor off the main thread. r=bechen,gerald
MozReview-Commit-ID: 6fxhzTOFaWx

--HG--
extra : rebase_source : ad507e823ed90356e6b1b7452460fa8462240021
extra : intermediate-source : 1dc9fa1ba116ef65fddc076bf5508701d85d788b
extra : source : d5a6e82b6f344c59814c30b950577fd67ee0b7e3
2017-12-20 15:28:52 +08:00
JW Wang fb4b1616ab Bug 1428184 - copy mStreams before iterating the array. r=bechen,gerald
It is bad to modify the array while iterating it.

MozReview-Commit-ID: JbpoRmM7GqP

--HG--
extra : rebase_source : 92523a0741aa6014808b182954f653fce54161fd
2018-01-05 11:34:59 +08:00
JW Wang 3834402eca Bug 1427931. P2 - assert MediaCacheStream::Pin/Unpin is called off the main thread. r=bechen,gerald
MozReview-Commit-ID: 7tanbwvNfEh

--HG--
extra : rebase_source : cac6f3cf525884a280bca20684a8d9ba89716b7d
2018-01-04 10:30:07 +08:00
JW Wang 31fbfceb45 Bug 1427667 - move the call to mMediaCache->ReleaseStream() from the destructor to CloseInternal(). r=bechen,gerald
So we won't need to take the cache monitor on the main thread.

MozReview-Commit-ID: FavZKcfaHn8

--HG--
extra : rebase_source : 8a0483a5db9db3d39dccf110ba363144f5e9b6dd
extra : intermediate-source : 214edc1ef96cc2f8b60a86ce068cb8b0593cb1f7
extra : source : ce13b43e884185a988205d0f3e860cf823458b37
2017-12-19 17:51:51 +08:00
JW Wang 240c0a0c9a Bug 1427666 - MediaCacheStream::InitAsCloneInternal() should notify the client that new data is available. r=bechen,gerald
We should call ChannelMediaResource::CacheClientNotifyDataReceived() no matter
new data is coming from the channel or copied from the original cache stream
so the decoder has a chance to compute 'canplaythrough' and buffer ranges.

MozReview-Commit-ID: I4cLow2VzJg

--HG--
extra : rebase_source : ede936c94a6d728cf6c596863e45aa45d2617d45
2018-01-03 10:33:11 +08:00
JW Wang bb6429d366 Bug 1426578. P5 - offload Init() to another thread. r=bechen,gerald
MozReview-Commit-ID: Fv7eq39GNsk

--HG--
extra : rebase_source : 483cd70c65a4f724b40aaa11eece60b6a2a85e25
extra : source : db2632bf1828721b94bda877bf23bc59d189206e
2017-12-19 17:38:40 +08:00
JW Wang ea7483e4ce Bug 1426578. P4 - offload InitAsClone() to another thread. r=bechen,gerald
MozReview-Commit-ID: H8bQRmkJ8jU

--HG--
extra : rebase_source : a6fd3ec4d48974a36c0eec24503d10258ed5f5d4
extra : source : 2ffac43de24706551d3e183072d4e53c137ecb5f
2017-12-19 17:32:55 +08:00
JW Wang e43ca27ba0 Bug 1426578. P3 - make MediaCacheStream::InitAsClone() infallible. r=bechen,gerald
It must be infallible for there is no way to propagate the error back to the
main thread when part of the init functions run on another thread. It is OK to
clone a stream that ends abnormally as long as we don't copy the error status
of EOS. The cloned stream will open a new channel when necessary.

Note we also copy the partial block from the original stream to get as much
data as possible and thus reducing the chance of reopening the channel.

MozReview-Commit-ID: 37iYQonFdBU

--HG--
extra : rebase_source : 6bb9983bc8d1f2675557a14acf1824dba4a98fff
extra : intermediate-source : a20ff9a873db93c85750bb2af5bf05c27c9da3c3
extra : source : 0763fb0e7b4ed1096e406dadccb3ca698f39b207
2017-12-16 23:50:07 +08:00
JW Wang 1aec590c73 Bug 1426578. P2 - always access MediaCache::mStreams while the cache monitor is held. r=bechen,gerald
Note we offload MediaCache::CloseStreamsForPrivateBrowsing() to another thread
so we don't need to take the cache monitor on the main thread.

MozReview-Commit-ID: 9hYszHZ0OJJ

--HG--
extra : rebase_source : 652b4ca783a52d28b0948e81d7b54ed79094230d
extra : intermediate-source : 46316625deb99585c42026010d994fa22b5b3dca
extra : source : 8c9e8ac739eb347b3b8ba24229cafcf2a3e3c4cd
2017-12-15 11:23:27 +08:00
JW Wang 0c88150fb7 Bug 1426578. P1 - tweak the constructor and init functions of ChannelMediaResource/MediaCacheStream. r=bechen,gerald
We want to init as many members as possible before taking the cache monitor.
This makes it easier to move part of the init functions to another thread.

MozReview-Commit-ID: 6mmO356nCyQ

--HG--
extra : rebase_source : 0e5093e01227e2008200cc1fa02aaac445833614
extra : intermediate-source : 2a6bf63954734d0c6470b425a9a8a77f8a805dc3
extra : source : 782ebf089ec17570650ce1635a591c3a9838d7a3
2017-12-14 16:08:17 +08:00
JW Wang 61603d61fe Bug 1426061. P2 - offload MediaCacheStream::Close() to another thread. r=bechen,gerald
So we won't take the cache lock on the main thread.

MozReview-Commit-ID: KYSB0vonOZ2

--HG--
extra : rebase_source : 142884bb450a5469b2634a676ce2d4f3c1790954
extra : intermediate-source : 0911c55511374cd19719743531c136fc122e4ab0
extra : source : 2f46a7eddea484fc5dec773d9d57896e524e014d
2017-12-15 10:29:29 +08:00
JW Wang 32de19ef80 Bug 1426061. P1 - always access MediaCacheStream::mClosed while holding the lock. r=bechen,gerald
We will offload MediaCacheStream::Close() to another thread and need to access
mClosed off the main thread.

MozReview-Commit-ID: 891rzC8dOON

--HG--
extra : rebase_source : 5cf18c4cdfe32dcc1894d5849b74a16582dcde51
extra : intermediate-source : 77febb3f2ca53cd5bb4834b110a4ff44a21556b0
extra : source : b4513de1038e6413477d09ef531f076ecb3955b3
2017-12-14 16:22:53 +08:00
JW Wang 99bec39793 Bug 1426056. P4 - fix a case where we don't reopen the channel. r=bechen,gerald
In MediaCacheStream::NotifyResume(), it will not reopen the channel if
|mChannelOffset==mStreamLength && 0 <= mSeekTarget < mStreamLength| while we should.

MozReview-Commit-ID: 2knkgy6FEVw

--HG--
extra : rebase_source : 28e7910572bd25d189b942f9961f77ec336dea19
2017-12-19 14:35:25 +08:00
JW Wang d7abdb2b86 Bug 1426056. P3 - assert MediaCacheStream::GetLength() is called off the main thread. r=bechen,gerald
MozReview-Commit-ID: 7L8C4f2Lg3C

--HG--
extra : rebase_source : bfa198778bab4b7e0f39d52b292754c2feeff5ec
extra : intermediate-source : 075391df39fd04af006dab86937b37fe3eec80b9
extra : source : ab007303c8bfe447b6a6128adfc55337127923a2
2017-12-07 15:50:41 +08:00
JW Wang 37e466a4bf Bug 1426056. P2 - remove unused members. r=bechen,gerald
MozReview-Commit-ID: 6CjxrFzutkP

--HG--
extra : rebase_source : b9c9a858e08ea0aa35c074ac7734d62b1d8fe219
extra : intermediate-source : ce131c8c66ef1dc89c69fd0e2332b838419a3cc3
extra : source : e6ece8e702100d23540caf9fbcfea561dcb3e172
2017-12-07 15:45:15 +08:00
JW Wang 313522ae1f Bug 1426056. P1 - move the decision of resuming download to another thread. r=bechen,gerald
So we won't access mStreamLength/mChannelOffset (which are protected by the
cache monitor) on the main thread.

MozReview-Commit-ID: 2pKEttZOfB9

--HG--
extra : rebase_source : a683d7297e241f2aeaf60ba9ad558763d17ee094
extra : intermediate-source : 0a6c10e10d1e558b19799b720935bbdaa56728bf
extra : source : 282de2a9189e5e05f5f817174ebcffe1b592bb1a
2017-12-07 15:43:36 +08:00
JW Wang a6dc3c33c1 Bug 1425170. P2 - remove unused members. r=bechen,gerald
MozReview-Commit-ID: TJZzVuEI8J

--HG--
extra : rebase_source : 3f6208a74c2a2d88373936a3dc4ee5c873fc297a
2017-12-14 10:19:41 +08:00
JW Wang 0764603851 Bug 1424937 - read as many bytes as possible before giving up reading due to download ends abnormally. r=bechen,gerald
MozReview-Commit-ID: 39vdgyY5NCT

--HG--
extra : rebase_source : d476d0d2b725b94ed750c575bbb6708098f89bb3
2017-12-13 18:28:16 +08:00
JW Wang dffc1aa9bb Bug 1423465. P6 - assert some MediaCacheStream functions are run off the main thread. r=bechen,gerald
MozReview-Commit-ID: I0GWj6I82Iv

--HG--
extra : rebase_source : 1f0271b1eae63391d23f5997359227af73d427d5
extra : intermediate-source : 30c996ff54197b85b97393762b7598cbbb528c0c
extra : source : 1f3a35716479caf1e493472762e28c586ef5f7dd
2017-12-05 15:23:43 +08:00
JW Wang 26a216be5d Bug 1423465. P3 - assert MediaCacheStream::SetPlaybackRate() is called off the main thread. r=bechen,gerald
MozReview-Commit-ID: CZCLkRa0T2v

--HG--
extra : rebase_source : d0a8afda90bd429891ead94788de81d743c1216c
extra : intermediate-source : 4adc4ebb716f29f0a2de5510ff36607283024687
extra : source : 1ed4c290b9294e965f2d9a80ace20776a5e84ead
2017-12-05 14:15:38 +08:00
JW Wang 0d7066652a Bug 1421864 - move mChannelStatistics from ChannelMediaResource to MediaCacheStream. r=bechen,gerald
So it is callable from non-main thread.

MozReview-Commit-ID: atYmz4u2c9

--HG--
extra : rebase_source : 2e10064730b3e7e1ecb1a4fd65cf2e2da0390290
extra : source : 5680a6942f6985f9c6bbf284a9768ab910b37804
2017-11-29 16:49:54 +08:00
JW Wang 0e04b33f33 Bug 1421134. P2 - run MediaCacheStream::SetReadMode() off the main thread. r=bechen,gerald
MozReview-Commit-ID: A6ui5dtWhNt

--HG--
extra : rebase_source : fef676273887d5db2fd798a6bcc25fbc936c375d
extra : source : beaec56918f2dbd0e1bd052d92a31fbcca1cd084
2017-11-28 10:51:47 +08:00
JW Wang 1ae4603e61 Bug 1421134. P1 - default MediaCacheStream::mCurrentMode to MODE_METADATA. r=bechen,gerald
We always read metadata when decoding starts. This allows us to remove the call
to mResource->SetReadMode(MediaCacheStream::MODE_METADATA) in ChannelMediaDecoder::Load().

MozReview-Commit-ID: AQMq4HxDZdT

--HG--
extra : rebase_source : 141c43bb93f274d8320a270b5c7289bd1eab134d
extra : source : 7de3d88ddb5c99352f4b5bd0b5e648a52a4a67a5
2017-11-28 10:43:50 +08:00
JW Wang 57ea5cf9d9 Bug 1420819 - run MediaCache::Flush() off the main thread. r=bechen,gerald
MozReview-Commit-ID: 4QR1TvORZlz

--HG--
extra : rebase_source : 1451c437c6daf80b15b6f23552900e2ef2467324
extra : intermediate-source : 3a0bdc29f6c70ac2a1479dbc7f10ebbd52a68456
extra : source : da25c3537d9b4665dff55f615467bcb62e5dde56
2017-11-27 15:04:21 +08:00
JW Wang 99bc08968c Bug 1420798 - apply the 'ProofOfLock' pattern to MediaCache. r=bechen,gerald
See comment 0 for the detail.

We will replace ReentrantMonitor with Monitor in the future.

MozReview-Commit-ID: 63ygEFWXHZd

--HG--
extra : rebase_source : 71d1049663e5af5ca178402f84fabdc4ab0f8758
extra : intermediate-source : 20d349df7c16227b6fa1cd3c1d38b1065c93da8c
extra : source : 9cdcfd446686eace7258d18262d8dd92c0f70331
2017-11-22 17:14:02 +08:00
JW Wang ce20f92811 Bug 1420016 - remove ChannelMediaResource::IsSuspendedByCache(). r=bechen,gerald
For it is used internally by CacheClientNotifySuspendedStatusChanged() only.

MozReview-Commit-ID: 8XVUHhdERYR

--HG--
extra : rebase_source : 60b97821b3e1c13bf1ba706ad1431b9e323df319
extra : intermediate-source : 6891fae737691efcf0885ff90fc7af777f9493d8
extra : source : 8c49a2fbc12f59c83809d233c9c0e9fa404cdd21
2017-11-23 11:30:07 +08:00
JW Wang eb912e4057 Bug 1418918. P2 - add thread/monitor assertions. r=bechen,gerald
MozReview-Commit-ID: 3J8pRFnpm77

--HG--
extra : rebase_source : 722b2f5df7d2b6f95d806b334a9382f80ac4ea07
extra : intermediate-source : cb6319d0c879e9d57a46ff261bb9e1d5a16e2ad9
extra : source : 5b99626480b1c190f03a61635b7a2174b38c87b1
2017-11-20 16:30:05 +08:00
JW Wang 106e488634 Bug 1418918. P1 - remove unused FlushPartialBlock(). r=bechen,gerald
MozReview-Commit-ID: GSda1KfPWXE

--HG--
extra : rebase_source : 8bb0b962e6fec586dd68587d6e43b542d37f6a2d
extra : intermediate-source : d58472fa128100ed3bbc8e07d4e72ac7cc5bfe09
extra : source : e3925d43d873e20ad95a48550f271b832f852b7d
2017-11-20 16:00:22 +08:00
JW Wang ff8c3ed9fd Bug 1418917. P2 - NotifyClientSuspended() should check mClosed. r=bechen,gerald
MozReview-Commit-ID: 9mBPwfyfWCV

--HG--
extra : rebase_source : 7fc6194a99d656f8e9a80430e41486c2ab7f117c
extra : intermediate-source : a601c40d46b2db64372345a3c5e39a1eeab7e326
extra : source : b5d520b8ddbf9926fe6e3a87d667a6c10c9dde5f
2017-11-20 14:21:22 +08:00
JW Wang e672887f6f Bug 1418917. P1 - run some functions off the main thread. r=bechen,gerald
MozReview-Commit-ID: Fn9OveV69hX

--HG--
extra : rebase_source : 36ed72bea695f07694d83c418ba45d89cf1f03be
extra : intermediate-source : e25c80e8ea6991b4f06bc4305b602c792a5b1e8a
extra : source : d20765cfa8575943c62b933563e36ee9ffa4e765
2017-11-16 15:41:36 +08:00
JW Wang f874190157 Bug 1418430. P2 - simplify the if statement of "reopen on error". r=bechen,gerald
A truth table is listed to illustrate all conditions of length/offset/reopen.

The original code doesn't handle the following cases correctly:
1. length == offset == 0, shouldn't reopen the channel for there is no data to download.
2. length == -1 && offset > 0, should reopen the channel if seekable.

MozReview-Commit-ID: IisnrA8hK4M

--HG--
extra : rebase_source : c5826f314b09b2ae9c3e7f2cc1f6ce285fc612df
2017-11-22 11:21:57 +08:00
JW Wang df2b00d7a6 Bug 1418430. P1 - always check "reopen on error" when a connection is closed. r=bechen,gerald
The server might send us fewer bytes than requested. So we also need
"reopen on error" in this case as well.

MozReview-Commit-ID: Fi82x4h1TZ0

--HG--
extra : rebase_source : 3a19838de9c11545f00778623735c7e9a5cb1439
2017-11-22 10:35:48 +08:00
JW Wang a920cf49b3 Bug 1418219 - merge NotifyDataLength() and NotifyDataStarted(). r=bechen,gerald
MozReview-Commit-ID: g857eQ4YVK

--HG--
extra : rebase_source : 45e71baa300772442bba43f39eacefb571a523c9
extra : intermediate-source : d674e5a676212dae59b12e8173802be40de77bf7
extra : source : 21f73b0a0e59b7575794b317719abe7a39a984e0
2017-11-16 12:05:19 +08:00
JW Wang c5401dfc03 Bug 1418213 - always run MediaCacheStream::NotifyDataReceived() off the main thread. r=bechen,gerald
MozReview-Commit-ID: GBQ0lEf8rVI

--HG--
extra : rebase_source : cbcd69dd220c06e2e1cc0d12e33d23ce2f4e21ef
extra : intermediate-source : 9e304fc5f5ee0b4d44f0e54a4cb2a6a9fe90979d
extra : source : 1b29a7cde3c40ba3a35ee19eee63ad68e6d12176
2017-11-15 17:56:10 +08:00
JW Wang b3feb3794f Bug 1415090. P5 - remove MediaCacheStream::NotifyChannelRecreated(). r=bechen,gerald
NotifyDataEnded() runs off the main thread which might set mChannelEnded
wrongly after NotifyChannelRecreated reset it on the main thread.

We should reset the flags in NotifyDataStarted() which indicate a new load has begun.

MozReview-Commit-ID: Gi6PFXwMJqc

--HG--
extra : rebase_source : 85bb2c25a55cce4b3c3f023bf4c02fe5d1de7552
extra : source : 2f8c5518bf615f9190f87032568fc53037bc6fc1
2017-11-16 14:50:49 +08:00
JW Wang a2fd07c6c9 Bug 1415090. P4 - don't modify mResourceID off the main thread. r=bechen,gerald
There are some works to do when we allow a stream whose download ends abnormally
to continue sharing the resource:

1. Abort Read() when download error happens. We might still have a chance to
   get all the data successfully. However, it doesn't really matter since
   the stream data is incomplete and we will encounter decode errors sooner
   or later.
2. Update() needs to check mChannelEnded since an ended stream will not
   download data needed by other streams.

MozReview-Commit-ID: LGCecQ5rpzq

--HG--
extra : rebase_source : 17a91a1cfd145344c3c0a29b80665cb99ce20746
extra : source : 0947c12b035acc9fba02e89dc87b3a17f84cf2e5
2017-11-15 16:45:57 +08:00
JW Wang 187b5299fb Bug 1415090. P3 - run MediaCacheStream::NotifyDataEnded() off the main thread. r=bechen,gerald
Since NotifyDataEnded() run its code asynchronously, it is possible that a new
channel is created and NotifyDataStarted() is called before NotifyDataEndedInternal()
has a chance to run. We check the load ID to exit the function if necessary.

We also need to fix data races when running NotifyDataEndedInternal() off the
main thread in next patches.

MozReview-Commit-ID: IIAc7dxHike

--HG--
extra : rebase_source : 58e45f924058a986b8d86bfaeff2791ee8a5f4bc
extra : intermediate-source : b2a7fa7514723e214b8da40cfc0ec40b1de9a345
extra : source : 1ff93dc8f8c451b804133c780cedef2ee3d348e5
2017-11-10 15:06:39 +08:00
JW Wang 54de8d43d3 Bug 1415090. P2 - move the "reopen on error" code from ChannelMediaResource::OnStopRequest() to MediaCacheStream::NotifyDataEnded(). r=bechen,gerald
MozReview-Commit-ID: BA1tSk6ZqPS

--HG--
extra : rebase_source : 7434d1052be71bdb3cd24f430081fe57e86c4c6d
extra : intermediate-source : eef8f69c9c0f6e50d20ae9c7e46396d597eef425
extra : source : 95f24d107ce05b1b69e5a5f269c50670c7a31bf1
2017-11-10 14:40:22 +08:00
JW Wang 5a99c6b197 Bug 1417774 - remove unused MediaResource::Tell(). r=bechen
MozReview-Commit-ID: 3qlP4sSh9kM

--HG--
extra : rebase_source : 4002fec6f8c43abb640f9206cd715f3ecb02b373
2017-11-15 17:18:52 +08:00
JW Wang ecbca6c33e Bug 1416643. P2 - always access mDidNotifyDataEnded within the lock. r=bechen,gerald
MozReview-Commit-ID: 3us659lCEZE

--HG--
extra : rebase_source : 9deace7a2e83ae42132f593bb7c638c5e2977638
2017-11-15 15:24:26 +08:00
JW Wang b88c401e49 Bug 1416643. P1 - remove checks for mDidNotifyDataEnded/mNotifyDataEndedStatus from IsAvailableForSharing(). r=bechen,gerald
We will need to modify these members off the main thead while IsAvailableForSharing()
is a main thread only function.

InitAsClone() will return an error if the original stream ends abnormally.

MozReview-Commit-ID: 1qRyboca2YZ

--HG--
extra : rebase_source : 4617a911a1de052833bd0085b883a8ae4d639c7d
2017-11-15 15:14:21 +08:00
JW Wang 3f7e23ff46 Bug 1416085 - use Span<> to replace low level pointer arithmetic in Read(). r=bechen,gerald
MozReview-Commit-ID: 6l7cG2Xn0R7

--HG--
extra : rebase_source : ce80c480f03cfbe170a7c5340cbac526aa4f7a23
extra : intermediate-source : f02f1542258668ea47203a51f807ece6429f0ace
extra : source : 28c38703128e47ee7808e68550d7fca9b2558d0a
2017-11-03 16:56:58 +08:00
JW Wang 406e41ed03 Bug 1412737. P2 - Read() should return only when enough bytes are read or EOS/error is encountered. r=bechen,gerald
This will remove the need to retry reading for the callers.

Note since data is usually downloaded faster than being consumed, we don't
benefit much in reading data from a partial block in the memory. Chances are
we still need to wait for the block to commit to the cache so the reader can
continue. So we change the code to always read data from the cache or from
the last block when it is completed (reaching EOS).

This change allows up to somewhat optimize NotifyDataReceived() which won't
have to wake up readers if no blocks are committed to the cache.

MozReview-Commit-ID: KwgNSOawuAE

--HG--
extra : rebase_source : af29b9f5d8b7ee1ed41bda5d23e1e94209e323b7
extra : intermediate-source : 863cb113d20b9cc1222de001bacbefa7eb8ac5c1
extra : source : 09683d9ffe477c27164769dc93e9eb9ee0af21bd
2017-11-01 16:53:29 +08:00
JW Wang d0f5f6b094 Bug 1412737. P1 - improve error handling. r=bechen,gerald
MozReview-Commit-ID: 776P80x63y8

--HG--
extra : rebase_source : 4737175f074e546d8e667f99829079855f55f119
extra : intermediate-source : 610e5fa2452c58f2e6d4a973210342c6be71d90d
extra : source : 719772d4b77154b419e501eabbf466a679325720
2017-10-31 14:54:13 +08:00