Bug 1633935 - P4 Remove On[Start|Stop]Request/OnTransportAndData in PHttpChannel, r=mayhemer,nika,necko-reviewers

We move OnStartRequest from PHttpChannel to PHttpBackgroundChannel, thus adjusting
message-metadata.ini

Depends on D76970

Differential Revision: https://phabricator.services.mozilla.com/D76971
This commit is contained in:
Junior Hsu 2020-06-30 00:33:01 +00:00
parent f0b8d33e0b
commit 780b817a08
5 changed files with 3 additions and 130 deletions

View File

@ -12,10 +12,10 @@ segment_capacity = 16384
segment_capacity = 8192
[PContent::StoreAndBroadcastBlobURLRegistration]
segment_capacity = 8192
[PHttpChannel::OnStartRequest]
segment_capacity = 8192
[PHttpChannel::Redirect1Begin]
segment_capacity = 8192
[PHttpBackgroundChannel::OnStartRequest]
segment_capacity = 8192
[PHttpBackgroundChannel::OnTransportAndData]
segment_capacity = 8192
[PNecko::PHttpChannelConstructor]

View File

@ -411,56 +411,6 @@ void HttpChannelChild::ProcessOnStartRequest(
aArgs);
}));
}
mozilla::ipc::IPCResult HttpChannelChild::RecvOnStartRequest(
const nsHttpResponseHead& aResponseHead, const bool& aUseResponseHead,
const nsHttpHeaderArray& aRequestHeaders,
const HttpChannelOnStartRequestArgs& aArgs) {
AUTO_PROFILER_LABEL("HttpChannelChild::RecvOnStartRequest", NETWORK);
LOG(("HttpChannelChild::RecvOnStartRequest [this=%p]\n", this));
// mFlushedForDiversion and mDivertingToParent should NEVER be set at this
// stage, as they are set in the listener's OnStartRequest.
MOZ_RELEASE_ASSERT(
!mFlushedForDiversion,
"mFlushedForDiversion should be unset before OnStartRequest!");
MOZ_RELEASE_ASSERT(
!mDivertingToParent,
"mDivertingToParent should be unset before OnStartRequest!");
mEventQ->RunOrEnqueue(new NeckoTargetChannelFunctionEvent(
this, [self = UnsafePtr<HttpChannelChild>(this), aResponseHead,
aUseResponseHead, aRequestHeaders, aArgs]() {
self->OnStartRequest(aResponseHead, aUseResponseHead, aRequestHeaders,
aArgs);
}));
{
// Child's mEventQ is to control the execution order of the IPC messages
// from both main thread IPDL and PBackground IPDL.
// To guarantee the ordering, PBackground IPC messages that are sent after
// OnStartRequest will be throttled until OnStartRequest hits the Child's
// mEventQ.
MutexAutoLock lock(mBgChildMutex);
// We don't need to notify the background channel if this is a multipart
// stream, since all messages will be sent over the main-thread IPDL in
// that case.
// TODO: Never reach here. Remove later.
// if (mBgChild && !aArgs.multiPartID()) {
// MOZ_RELEASE_ASSERT(gSocketTransportService);
// DebugOnly<nsresult> rv = gSocketTransportService->Dispatch(
// NewRunnableMethod(
// "HttpBackgroundChannelChild::OnStartRequestReceived", mBgChild,
// &HttpBackgroundChannelChild::OnStartRequestReceived),
// NS_DISPATCH_NORMAL);
// }
}
return IPC_OK();
}
static void ResourceTimingStructArgsToTimingsStruct(
const ResourceTimingStructArgs& aArgs, TimingStruct& aTimings) {
aTimings.domainLookupStart = aArgs.domainLookupStart();
@ -579,39 +529,6 @@ void HttpChannelChild::OnStartRequest(
DoOnStartRequest(this, nullptr);
}
mozilla::ipc::IPCResult HttpChannelChild::RecvOnTransportAndData(
const nsresult& aChannelStatus, const nsresult& aTransportStatus,
const uint64_t& aOffset, const uint32_t& aCount, const nsCString& aData) {
AUTO_PROFILER_LABEL("HttpChannelChild::RecvOnTransportAndData", NETWORK);
LOG(("HttpChannelChild::RecvOnTransportAndData [this=%p]\n", this));
mEventQ->RunOrEnqueue(new NeckoTargetChannelFunctionEvent(
this, [self = UnsafePtr<HttpChannelChild>(this), aChannelStatus,
aTransportStatus, aOffset, aCount, aData]() {
self->OnTransportAndData(aChannelStatus, aTransportStatus, aOffset,
aCount, aData);
}));
return IPC_OK();
}
mozilla::ipc::IPCResult HttpChannelChild::RecvOnStopRequest(
const nsresult& aChannelStatus, const ResourceTimingStructArgs& aTiming,
const TimeStamp& aLastActiveTabOptHit,
const nsHttpHeaderArray& aResponseTrailers,
nsTArray<ConsoleReportCollected>&& aConsoleReports) {
AUTO_PROFILER_LABEL("HttpChannelChild::RecvOnStopRequest", NETWORK);
LOG(("HttpChannelChild::RecvOnStopRequest [this=%p]\n", this));
mEventQ->RunOrEnqueue(new NeckoTargetChannelFunctionEvent(
this, [self = UnsafePtr<HttpChannelChild>(this), aChannelStatus, aTiming,
aResponseTrailers,
consoleReports = CopyableTArray{std::move(aConsoleReports)}]() {
self->OnStopRequest(aChannelStatus, aTiming, aResponseTrailers,
consoleReports);
}));
return IPC_OK();
}
mozilla::ipc::IPCResult HttpChannelChild::RecvOnAfterLastPart(
const nsresult& aStatus) {
mEventQ->RunOrEnqueue(new NeckoTargetChannelFunctionEvent(

View File

@ -132,20 +132,6 @@ class HttpChannelChild final : public PHttpChannelChild,
nsresult CrossProcessRedirectFinished(nsresult aStatus);
protected:
mozilla::ipc::IPCResult RecvOnStartRequest(
const nsHttpResponseHead& aResponseHead, const bool& aUseResponseHead,
const nsHttpHeaderArray& aRequestHeaders,
const HttpChannelOnStartRequestArgs& aArgs) override;
mozilla::ipc::IPCResult RecvOnTransportAndData(
const nsresult& aChannelStatus, const nsresult& aTransportStatus,
const uint64_t& aOffset, const uint32_t& aCount,
const nsCString& aData) override;
mozilla::ipc::IPCResult RecvOnStopRequest(
const nsresult& aChannelStatus, const ResourceTimingStructArgs& aTiming,
const TimeStamp& aLastActiveTabOptHit,
const nsHttpHeaderArray& aResponseTrailers,
nsTArray<ConsoleReportCollected>&& aConsoleReports) override;
mozilla::ipc::IPCResult RecvFailedAsyncOpen(const nsresult& status) override;
mozilla::ipc::IPCResult RecvRedirect1Begin(
const uint32_t& registrarId, const URIParams& newURI,

View File

@ -27,9 +27,6 @@ child:
// Combines a single OnDataAvailable and its associated OnProgress &
// OnStatus calls into one IPDL message
// This is duplicated on PHttpChannel, which gets used for multi-part
// streams to make synchronization when we get OnStartRequest multiple
// times easier.
async OnTransportAndData(nsresult channelStatus,
nsresult transportStatus,
uint64_t offset,
@ -37,9 +34,7 @@ child:
nsCString data,
bool dataFromSocketProcess);
// This is duplicated on PHttpChannel, which gets used for multi-part
// streams to make synchronization when we get OnStartRequest multiple
// times easier.
async OnStopRequest(nsresult channelStatus,
ResourceTimingStructArgs timing,
TimeStamp lastActiveTabOptimization,

View File

@ -103,31 +103,6 @@ parent:
async __delete__();
child:
async OnStartRequest(nsHttpResponseHead responseHead,
bool useResponseHead,
nsHttpHeaderArray requestHeaders,
HttpChannelOnStartRequestArgs args);
// Combines a single OnDataAvailable and its associated OnProgress &
// OnStatus calls into one IPDL message
// This is a duplicate of the message on PHttpBackgroundChannel, and gets
// used for multi-pary streams to make synchronization when we get OnStartRequest
// multiple times easier.
async OnTransportAndData(nsresult channelStatus,
nsresult transportStatus,
uint64_t offset,
uint32_t count,
nsCString data);
// This is a duplicate of the message on PHttpBackgroundChannel, and gets
// used for multi-pary streams to make synchronization when we get OnStartRequest
// multiple times easier.
async OnStopRequest(nsresult channelStatus,
ResourceTimingStructArgs timing,
TimeStamp lastActiveTabOptimization,
nsHttpHeaderArray responseTrailers,
ConsoleReportCollected[] consoleReport);
// Used to cancel child channel if we hit errors during creating and
// AsyncOpen of nsHttpChannel on the parent.
async FailedAsyncOpen(nsresult status);