mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-12 02:07:33 +09:00
Issue #1442 - Part 23 - Align FetchStream with Firefox 68ESR. https://bugzilla.mozilla.org/show_bug.cgi?id=1612308 https://bugzilla.mozilla.org/show_bug.cgi?id=1445587 Partial part 2 implementing synchronization changes.
This commit is contained in:
parent
41409ab613
commit
836d36dc6d
3 changed files with 139 additions and 32 deletions
|
|
@ -52,6 +52,14 @@ private:
|
|||
nsIInputStream* aInputStream);
|
||||
~FetchStream();
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
AssertIsOnOwningThread();
|
||||
#else
|
||||
void
|
||||
AssertIsOnOwningThread() {}
|
||||
#endif
|
||||
|
||||
static void
|
||||
RequestDataCallback(JSContext* aCx, JS::HandleObject aStream,
|
||||
void* aUnderlyingSource, uint8_t aFlags,
|
||||
|
|
@ -81,10 +89,19 @@ private:
|
|||
FinalizeCallback(void* aUnderlyingSource, uint8_t aFlags);
|
||||
|
||||
void
|
||||
ErrorPropagation(JSContext* aCx, JS::HandleObject aStream, nsresult aRv);
|
||||
ErrorPropagation(JSContext* aCx,
|
||||
const MutexAutoLock& aProofOfLock,
|
||||
JS::HandleObject aStream, nsresult aRv);
|
||||
|
||||
void
|
||||
CloseAndReleaseObjects(JSContext* aCx, JS::HandleObject aStream);
|
||||
CloseAndReleaseObjects(JSContext* aCx,
|
||||
const MutexAutoLock& aProofOfLock,
|
||||
JS::HandleObject aSteam);
|
||||
|
||||
class WorkerShutdown;
|
||||
|
||||
void
|
||||
ReleaseObjects(const MutexAutoLock& aProofOfLock);
|
||||
|
||||
void
|
||||
ReleaseObjects();
|
||||
|
|
@ -92,6 +109,9 @@ private:
|
|||
// Common methods
|
||||
|
||||
enum State {
|
||||
// This is the beginning state before any reading operation.
|
||||
eInitializing,
|
||||
|
||||
// RequestDataCallback has not been called yet. We haven't started to read
|
||||
// data from the stream yet.
|
||||
eWaiting,
|
||||
|
|
@ -111,7 +131,12 @@ private:
|
|||
eClosed,
|
||||
};
|
||||
|
||||
// Touched only on the target thread.
|
||||
// We need a mutex because JS engine can release FetchStream on a non-owning
|
||||
// thread. We must be sure that the releasing of resources doesn't trigger
|
||||
// race conditions.
|
||||
Mutex mMutex;
|
||||
|
||||
// Protected by mutex.
|
||||
State mState;
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> mGlobal;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue