mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1064706 - Send timing info to content process r=honzab
This commit is contained in:
parent
6cd624c0b0
commit
91ed528bcd
@ -12,6 +12,7 @@
|
||||
#include "nsStringGlue.h"
|
||||
#include "prio.h"
|
||||
#include "mozilla/net/DNS.h"
|
||||
#include "TimingStruct.h"
|
||||
|
||||
namespace IPC {
|
||||
|
||||
@ -146,6 +147,39 @@ struct ParamTraits<mozilla::net::NetAddr>
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<mozilla::net::ResourceTimingStruct>
|
||||
{
|
||||
static void Write(Message* aMsg, const mozilla::net::ResourceTimingStruct& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.domainLookupStart);
|
||||
WriteParam(aMsg, aParam.domainLookupEnd);
|
||||
WriteParam(aMsg, aParam.connectStart);
|
||||
WriteParam(aMsg, aParam.connectEnd);
|
||||
WriteParam(aMsg, aParam.requestStart);
|
||||
WriteParam(aMsg, aParam.responseStart);
|
||||
WriteParam(aMsg, aParam.responseEnd);
|
||||
|
||||
WriteParam(aMsg, aParam.fetchStart);
|
||||
WriteParam(aMsg, aParam.redirectStart);
|
||||
WriteParam(aMsg, aParam.redirectEnd);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, mozilla::net::ResourceTimingStruct* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->domainLookupStart) &&
|
||||
ReadParam(aMsg, aIter, &aResult->domainLookupEnd) &&
|
||||
ReadParam(aMsg, aIter, &aResult->connectStart) &&
|
||||
ReadParam(aMsg, aIter, &aResult->connectEnd) &&
|
||||
ReadParam(aMsg, aIter, &aResult->requestStart) &&
|
||||
ReadParam(aMsg, aIter, &aResult->responseStart) &&
|
||||
ReadParam(aMsg, aIter, &aResult->responseEnd) &&
|
||||
ReadParam(aMsg, aIter, &aResult->fetchStart) &&
|
||||
ReadParam(aMsg, aIter, &aResult->redirectStart) &&
|
||||
ReadParam(aMsg, aIter, &aResult->redirectEnd);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // mozilla_net_NeckoMessageUtils_h
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "SerializedLoadContext.h"
|
||||
#include "nsInputStreamPump.h"
|
||||
#include "InterceptedChannel.h"
|
||||
#include "nsPerformance.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::ipc;
|
||||
@ -545,34 +546,39 @@ class StopRequestEvent : public ChannelEvent
|
||||
{
|
||||
public:
|
||||
StopRequestEvent(HttpChannelChild* child,
|
||||
const nsresult& channelStatus)
|
||||
const nsresult& channelStatus,
|
||||
const ResourceTimingStruct& timing)
|
||||
: mChild(child)
|
||||
, mChannelStatus(channelStatus) {}
|
||||
, mChannelStatus(channelStatus)
|
||||
, mTiming(timing) {}
|
||||
|
||||
void Run() { mChild->OnStopRequest(mChannelStatus); }
|
||||
void Run() { mChild->OnStopRequest(mChannelStatus, mTiming); }
|
||||
private:
|
||||
HttpChannelChild* mChild;
|
||||
nsresult mChannelStatus;
|
||||
ResourceTimingStruct mTiming;
|
||||
};
|
||||
|
||||
bool
|
||||
HttpChannelChild::RecvOnStopRequest(const nsresult& channelStatus)
|
||||
HttpChannelChild::RecvOnStopRequest(const nsresult& channelStatus,
|
||||
const ResourceTimingStruct& timing)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(!mFlushedForDiversion,
|
||||
"Should not be receiving any more callbacks from parent!");
|
||||
|
||||
if (mEventQ->ShouldEnqueue()) {
|
||||
mEventQ->Enqueue(new StopRequestEvent(this, channelStatus));
|
||||
mEventQ->Enqueue(new StopRequestEvent(this, channelStatus, timing));
|
||||
} else {
|
||||
MOZ_ASSERT(!mDivertingToParent, "ShouldEnqueue when diverting to parent!");
|
||||
|
||||
OnStopRequest(channelStatus);
|
||||
OnStopRequest(channelStatus, timing);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
HttpChannelChild::OnStopRequest(const nsresult& channelStatus)
|
||||
HttpChannelChild::OnStopRequest(const nsresult& channelStatus,
|
||||
const ResourceTimingStruct& timing)
|
||||
{
|
||||
LOG(("HttpChannelChild::OnStopRequest [this=%p status=%x]\n",
|
||||
this, channelStatus));
|
||||
@ -585,6 +591,22 @@ HttpChannelChild::OnStopRequest(const nsresult& channelStatus)
|
||||
return;
|
||||
}
|
||||
|
||||
mTransactionTimings.domainLookupStart = timing.domainLookupStart;
|
||||
mTransactionTimings.domainLookupEnd = timing.domainLookupEnd;
|
||||
mTransactionTimings.connectStart = timing.connectStart;
|
||||
mTransactionTimings.connectEnd = timing.connectEnd;
|
||||
mTransactionTimings.requestStart = timing.requestStart;
|
||||
mTransactionTimings.responseStart = timing.responseStart;
|
||||
mTransactionTimings.responseEnd = timing.responseEnd;
|
||||
mAsyncOpenTime = timing.fetchStart;
|
||||
mRedirectStartTimeStamp = timing.redirectStart;
|
||||
mRedirectEndTimeStamp = timing.redirectEnd;
|
||||
|
||||
nsPerformance* documentPerformance = GetPerformance();
|
||||
if (documentPerformance) {
|
||||
documentPerformance->AddEntry(this, this);
|
||||
}
|
||||
|
||||
DoPreOnStopRequest(channelStatus);
|
||||
|
||||
{ // We must flush the queue before we Send__delete__
|
||||
|
@ -120,7 +120,7 @@ protected:
|
||||
const nsCString& data,
|
||||
const uint64_t& offset,
|
||||
const uint32_t& count) MOZ_OVERRIDE;
|
||||
bool RecvOnStopRequest(const nsresult& statusCode);
|
||||
bool RecvOnStopRequest(const nsresult& statusCode, const ResourceTimingStruct& timing);
|
||||
bool RecvOnProgress(const uint64_t& progress, const uint64_t& progressMax) MOZ_OVERRIDE;
|
||||
bool RecvOnStatus(const nsresult& status) MOZ_OVERRIDE;
|
||||
bool RecvFailedAsyncOpen(const nsresult& status) MOZ_OVERRIDE;
|
||||
@ -206,7 +206,7 @@ private:
|
||||
const nsCString& data,
|
||||
const uint64_t& offset,
|
||||
const uint32_t& count);
|
||||
void OnStopRequest(const nsresult& channelStatus);
|
||||
void OnStopRequest(const nsresult& channelStatus, const ResourceTimingStruct& timing);
|
||||
void OnProgress(const uint64_t& progress, const uint64_t& progressMax);
|
||||
void OnStatus(const nsresult& status);
|
||||
void FailedAsyncOpen(const nsresult& status);
|
||||
|
@ -250,6 +250,7 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
||||
return SendFailedAsyncOpen(rv);
|
||||
|
||||
mChannel = static_cast<nsHttpChannel *>(channel.get());
|
||||
mChannel->SetTimingEnabled(true);
|
||||
if (mPBOverride != kPBOverride_Unset) {
|
||||
mChannel->SetPrivate(mPBOverride == kPBOverride_Private ? true : false);
|
||||
}
|
||||
@ -703,8 +704,19 @@ HttpChannelParent::OnStopRequest(nsIRequest *aRequest,
|
||||
|
||||
MOZ_RELEASE_ASSERT(!mDivertingFromChild,
|
||||
"Cannot call OnStopRequest if diverting is set!");
|
||||
ResourceTimingStruct timing;
|
||||
mChannel->GetDomainLookupStart(&timing.domainLookupStart);
|
||||
mChannel->GetDomainLookupEnd(&timing.domainLookupEnd);
|
||||
mChannel->GetConnectStart(&timing.connectStart);
|
||||
mChannel->GetConnectEnd(&timing.connectEnd);
|
||||
mChannel->GetRequestStart(&timing.requestStart);
|
||||
mChannel->GetResponseStart(&timing.responseStart);
|
||||
mChannel->GetResponseEnd(&timing.responseEnd);
|
||||
mChannel->GetAsyncOpen(&timing.fetchStart);
|
||||
mChannel->GetRedirectStart(&timing.redirectStart);
|
||||
mChannel->GetRedirectEnd(&timing.redirectEnd);
|
||||
|
||||
if (mIPCClosed || !SendOnStopRequest(aStatusCode))
|
||||
if (mIPCClosed || !SendOnStopRequest(aStatusCode, timing))
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ using class nsHttpHeaderArray from "nsHttpHeaderArray.h";
|
||||
using class nsHttpResponseHead from "nsHttpResponseHead.h";
|
||||
using struct nsHttpAtom from "nsHttp.h";
|
||||
using mozilla::net::NetAddr from "mozilla/net/DNS.h";
|
||||
using struct mozilla::net::ResourceTimingStruct from "mozilla/net/TimingStruct.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
@ -103,7 +104,7 @@ child:
|
||||
uint64_t offset,
|
||||
uint32_t count);
|
||||
|
||||
OnStopRequest(nsresult channelStatus);
|
||||
OnStopRequest(nsresult channelStatus, ResourceTimingStruct timing);
|
||||
|
||||
OnProgress(uint64_t progress, uint64_t progressMax);
|
||||
|
||||
|
@ -20,6 +20,12 @@ struct TimingStruct {
|
||||
TimeStamp responseEnd;
|
||||
};
|
||||
|
||||
struct ResourceTimingStruct : TimingStruct {
|
||||
TimeStamp fetchStart;
|
||||
TimeStamp redirectStart;
|
||||
TimeStamp redirectEnd;
|
||||
};
|
||||
|
||||
}} // namespace mozilla::net
|
||||
|
||||
#endif
|
||||
|
@ -34,6 +34,7 @@ EXPORTS.mozilla.net += [
|
||||
'HttpInfo.h',
|
||||
'PHttpChannelParams.h',
|
||||
'PSpdyPush.h',
|
||||
'TimingStruct.h',
|
||||
]
|
||||
|
||||
# ASpdySession.cpp and nsHttpAuthCache cannot be built in unified mode because
|
||||
|
Loading…
Reference in New Issue
Block a user