diff options
author | Moonchild <moonchild@palemoon.org> | 2020-10-23 08:10:01 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-10-23 08:10:01 +0000 |
commit | 28119b040d73e1e2c70ed18342a1eeca3c847293 (patch) | |
tree | 9c34e8e81f45e604de1cb14c21c40335dd906dac /netwerk/base/nsStreamLoader.h | |
parent | 3b224b2b26a553e575ebee805e3cc74c8f35e4b3 (diff) | |
download | UXP-28119b040d73e1e2c70ed18342a1eeca3c847293.tar UXP-28119b040d73e1e2c70ed18342a1eeca3c847293.tar.gz UXP-28119b040d73e1e2c70ed18342a1eeca3c847293.tar.lz UXP-28119b040d73e1e2c70ed18342a1eeca3c847293.tar.xz UXP-28119b040d73e1e2c70ed18342a1eeca3c847293.zip |
[netwerk] Make nsIncrementalStreamLoader's GetNumBytesRead threadsafe.
This prevents a potential race and simplifies the code a bit by keeping the
bytes read separate instead of using mData, which is modified from another
thread from OnDataAvailable.
Relaxed atomics are fine for these, since they don't guard any memory.
Diffstat (limited to 'netwerk/base/nsStreamLoader.h')
-rw-r--r-- | netwerk/base/nsStreamLoader.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/netwerk/base/nsStreamLoader.h b/netwerk/base/nsStreamLoader.h index 671fc441f..b611a1aed 100644 --- a/netwerk/base/nsStreamLoader.h +++ b/netwerk/base/nsStreamLoader.h @@ -47,6 +47,8 @@ protected: nsCOMPtr<nsIRequest> mRequest; nsCOMPtr<nsIRequestObserver> mRequestObserver; + mozilla::Atomic<uint32_t, mozilla::Relaxed> mBytesRead; + // Buffer to accumulate incoming data. We preallocate if contentSize is // available. mozilla::Vector<uint8_t, 0> mData; |