Merge mozilla-central to autoland on a CLOSED TREE

This commit is contained in:
Alexandru Marc 2024-11-21 11:32:23 +02:00
commit c3d046b004
3 changed files with 4 additions and 37 deletions

View File

@ -58,7 +58,6 @@
#include "mozilla/Unused.h" #include "mozilla/Unused.h"
#include "Fetch.h" #include "Fetch.h"
#include "FetchLog.h"
#include "FetchUtil.h" #include "FetchUtil.h"
#include "InternalRequest.h" #include "InternalRequest.h"
#include "InternalResponse.h" #include "InternalResponse.h"
@ -262,8 +261,6 @@ AlternativeDataStreamListener::OnDataAvailable(nsIRequest* aRequest,
nsIInputStream* aInputStream, nsIInputStream* aInputStream,
uint64_t aOffset, uint64_t aOffset,
uint32_t aCount) { uint32_t aCount) {
FETCH_LOG(
("FetchDriver::OnDataAvailable this=%p, request=%p", this, aRequest));
if (mStatus == AlternativeDataStreamListener::LOADING) { if (mStatus == AlternativeDataStreamListener::LOADING) {
MOZ_ASSERT(mPipeAlternativeOutputStream); MOZ_ASSERT(mPipeAlternativeOutputStream);
uint32_t read = 0; uint32_t read = 0;
@ -1050,8 +1047,6 @@ void FetchDriver::FailWithNetworkError(nsresult rv) {
NS_IMETHODIMP NS_IMETHODIMP
FetchDriver::OnStartRequest(nsIRequest* aRequest) { FetchDriver::OnStartRequest(nsIRequest* aRequest) {
FETCH_LOG(
("FetchDriver::OnStartRequest this=%p, request=%p", this, aRequest));
AssertIsOnMainThread(); AssertIsOnMainThread();
// Note, this can be called multiple times if we are doing an opaqueredirect. // Note, this can be called multiple times if we are doing an opaqueredirect.
@ -1358,19 +1353,6 @@ FetchDriver::OnStartRequest(nsIRequest* aRequest) {
return NS_OK; return NS_OK;
} }
// Only retarget if not already retargeted
nsCOMPtr<nsISerialEventTarget> target;
nsCOMPtr<nsIThreadRetargetableRequest> req = do_QueryInterface(aRequest);
if (req) {
rv = req->GetDeliveryTarget(getter_AddRefs(target));
if (NS_SUCCEEDED(rv) && target && !target->IsOnCurrentThread()) {
FETCH_LOG(
("FetchDriver::OnStartRequest this=%p, request=%p already retargeted",
this, aRequest));
return NS_OK;
}
}
nsCOMPtr<nsIEventTarget> sts = nsCOMPtr<nsIEventTarget> sts =
do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv); do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv);
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
@ -1379,7 +1361,6 @@ FetchDriver::OnStartRequest(nsIRequest* aRequest) {
return rv; return rv;
} }
FETCH_LOG(("FetchDriver retargeting: request %p", aRequest));
// Try to retarget off main thread. // Try to retarget off main thread.
if (nsCOMPtr<nsIThreadRetargetableRequest> rr = do_QueryInterface(aRequest)) { if (nsCOMPtr<nsIThreadRetargetableRequest> rr = do_QueryInterface(aRequest)) {
RefPtr<TaskQueue> queue = RefPtr<TaskQueue> queue =
@ -1529,7 +1510,6 @@ FetchDriver::OnDataAvailable(nsIRequest* aRequest, nsIInputStream* aInputStream,
NS_IMETHODIMP NS_IMETHODIMP
FetchDriver::OnStopRequest(nsIRequest* aRequest, nsresult aStatusCode) { FetchDriver::OnStopRequest(nsIRequest* aRequest, nsresult aStatusCode) {
FETCH_LOG(("FetchDriver::OnStopRequest this=%p, request=%p", this, aRequest));
AssertIsOnMainThread(); AssertIsOnMainThread();
MOZ_DIAGNOSTIC_ASSERT(!mOnStopRequestCalled); MOZ_DIAGNOSTIC_ASSERT(!mOnStopRequestCalled);

View File

@ -570,8 +570,7 @@ void HttpChannelChild::OnAfterLastPart(const nsresult& aStatus) {
void HttpChannelChild::DoOnStartRequest(nsIRequest* aRequest) { void HttpChannelChild::DoOnStartRequest(nsIRequest* aRequest) {
nsresult rv; nsresult rv;
LOG(("HttpChannelChild::DoOnStartRequest [this=%p, request=%p]\n", this, LOG(("HttpChannelChild::DoOnStartRequest [this=%p]\n", this));
aRequest));
// We handle all the listener chaining before OnStartRequest at this moment. // We handle all the listener chaining before OnStartRequest at this moment.
// Prevent additional listeners being added to the chain after the request // Prevent additional listeners being added to the chain after the request
@ -808,11 +807,9 @@ void HttpChannelChild::DoOnDataAvailable(nsIRequest* aRequest,
nsIInputStream* aStream, nsIInputStream* aStream,
uint64_t aOffset, uint32_t aCount) { uint64_t aOffset, uint32_t aCount) {
AUTO_PROFILER_LABEL("HttpChannelChild::DoOnDataAvailable", NETWORK); AUTO_PROFILER_LABEL("HttpChannelChild::DoOnDataAvailable", NETWORK);
LOG(("HttpChannelChild::DoOnDataAvailable [this=%p, request=%p]\n", this, LOG(("HttpChannelChild::DoOnDataAvailable [this=%p]\n", this));
aRequest));
if (mCanceled) return; if (mCanceled) return;
mGotDataAvailable = true;
if (mListener) { if (mListener) {
nsCOMPtr<nsIStreamListener> listener(mListener); nsCOMPtr<nsIStreamListener> listener(mListener);
nsresult rv = listener->OnDataAvailable(aRequest, aStream, aOffset, aCount); nsresult rv = listener->OnDataAvailable(aRequest, aStream, aOffset, aCount);
@ -1204,8 +1201,7 @@ void HttpChannelChild::CollectMixedContentTelemetry() {
void HttpChannelChild::DoOnStopRequest(nsIRequest* aRequest, void HttpChannelChild::DoOnStopRequest(nsIRequest* aRequest,
nsresult aChannelStatus) { nsresult aChannelStatus) {
AUTO_PROFILER_LABEL("HttpChannelChild::DoOnStopRequest", NETWORK); AUTO_PROFILER_LABEL("HttpChannelChild::DoOnStopRequest", NETWORK);
LOG(("HttpChannelChild::DoOnStopRequest [this=%p, request=%p]\n", this, LOG(("HttpChannelChild::DoOnStopRequest [this=%p]\n", this));
aRequest));
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!LoadIsPending()); MOZ_ASSERT(!LoadIsPending());
@ -3062,15 +3058,7 @@ HttpChannelChild::RetargetDeliveryTo(nsISerialEventTarget* aNewTarget) {
MOZ_ASSERT(mOnDataAvailableStartTime.IsNull()); MOZ_ASSERT(mOnDataAvailableStartTime.IsNull());
{ {
MutexAutoLock lock(mEventTargetMutex); MutexAutoLock lock(mEventTargetMutex);
// Don't assert if the target hasn't changed, or if we haven't gotten RetargetDeliveryToImpl(aNewTarget, lock);
// OnDataAvailable (backed off on this last bit, see bug 1917901)
MOZ_DIAGNOSTIC_ASSERT(!mODATarget || (mODATarget == aNewTarget) ||
!mGotDataAvailable);
if (!mODATarget || (mODATarget == aNewTarget) || !mGotDataAvailable) {
RetargetDeliveryToImpl(aNewTarget, lock);
} else {
return NS_ERROR_FAILURE;
}
} }
return NS_OK; return NS_OK;

View File

@ -317,7 +317,6 @@ class HttpChannelChild final : public PHttpChannelChild,
// Target thread for delivering ODA. // Target thread for delivering ODA.
nsCOMPtr<nsISerialEventTarget> mODATarget MOZ_GUARDED_BY(mEventTargetMutex); nsCOMPtr<nsISerialEventTarget> mODATarget MOZ_GUARDED_BY(mEventTargetMutex);
Atomic<bool, mozilla::Relaxed> mGotDataAvailable{false};
// Used to ensure atomicity of mNeckoTarget / mODATarget; // Used to ensure atomicity of mNeckoTarget / mODATarget;
Mutex mEventTargetMutex{"HttpChannelChild::EventTargetMutex"}; Mutex mEventTargetMutex{"HttpChannelChild::EventTargetMutex"};