bug 1133177 - network logging and cleanups (part 1) r=hurley

This commit is contained in:
Patrick McManus 2015-02-19 12:21:03 -05:00
parent d368457451
commit c096f4fa41
4 changed files with 31 additions and 14 deletions

View File

@ -791,13 +791,10 @@ nsHttpChannel::SetupTransaction()
nsCOMPtr<nsIInterfaceRequestor> callbacks;
NS_NewNotificationCallbacksAggregation(mCallbacks, mLoadGroup,
getter_AddRefs(callbacks));
if (!callbacks)
return NS_ERROR_OUT_OF_MEMORY;
// create the transaction object
mTransaction = new nsHttpTransaction();
if (!mTransaction)
return NS_ERROR_OUT_OF_MEMORY;
LOG(("nsHttpChannel %p created nsHttpTransaction %p\n", this, mTransaction.get()));
// See bug #466080. Transfer LOAD_ANONYMOUS flag to socket-layer.
if (mLoadFlags & LOAD_ANONYMOUS)

View File

@ -1734,10 +1734,12 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
LOG(("nsHttpConnectionMgr::TryDispatchTransaction without conn "
"[trans=%p ci=%s caps=%x wildcardok=%d onlyreused=%d]\n",
trans, ent->mConnInfo->HashKey().get(),
"[trans=%p ci=%p ci=%s caps=%x wildcardok=%d onlyreused=%d "
"active=%d idle=%d]\n", trans,
ent->mConnInfo.get(), ent->mConnInfo->HashKey().get(),
uint32_t(trans->Caps()), !trans->DontRouteViaWildCard(),
onlyReusedConnection));
onlyReusedConnection, ent->mActiveConns.Length(),
ent->mIdleConns.Length()));
nsHttpTransaction::Classifier classification = trans->Classification();
uint32_t caps = trans->Caps();
@ -1792,7 +1794,8 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
if (NS_SUCCEEDED(loadGroupCI->GetBlockingTransactionCount(&blockers)) &&
blockers) {
// need to wait for blockers to clear
LOG((" blocked by load group: [blockers=%d]\n", blockers));
LOG((" blocked by load group: [lgci=%p trans=%p blockers=%d]\n",
loadGroupCI, trans, blockers));
return NS_ERROR_NOT_AVAILABLE;
}
}
@ -1810,6 +1813,7 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
if (AddToShortestPipeline(ent, trans,
classification,
mMaxOptimisticPipelinedRequests)) {
LOG((" dispatched step 1 trans=%p\n", trans));
return NS_OK;
}
}
@ -1826,7 +1830,7 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
((mNumActiveConns - mNumSpdyActiveConns) >= gHttpHandler->RequestTokenBucketMinParallelism()) &&
!(caps & (NS_HTTP_LOAD_AS_BLOCKING | NS_HTTP_LOAD_UNBLOCKED))) {
if (!trans->TryToRunPacedRequest()) {
LOG((" blocked due to rate pacing\n"));
LOG((" blocked due to rate pacing trans=%p\n", trans));
return NS_ERROR_NOT_AVAILABLE;
}
}
@ -1863,6 +1867,7 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
// the transaction dispatched on it.
AddActiveConn(conn, ent);
DispatchTransaction(ent, trans, conn);
LOG((" dispatched step 2 (idle) trans=%p\n", trans));
return NS_OK;
}
}
@ -1876,6 +1881,7 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
if (AddToShortestPipeline(ent, trans,
classification,
mMaxOptimisticPipelinedRequests)) {
LOG((" dispatched step 3 (pipeline) trans=%p\n", trans));
return NS_OK;
}
}
@ -1885,12 +1891,14 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
nsresult rv = MakeNewConnection(ent, trans);
if (NS_SUCCEEDED(rv)) {
// this function returns NOT_AVAILABLE for asynchronous connects
LOG((" dispatched step 4 (async new conn) trans=%p\n", trans));
return NS_ERROR_NOT_AVAILABLE;
}
if (rv != NS_ERROR_NOT_AVAILABLE) {
// not available return codes should try next step as they are
// not hard errors. Other codes should stop now
LOG((" failed step 4 (%x) trans=%p\n", rv, trans));
return rv;
}
}
@ -1900,6 +1908,7 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
if (AddToShortestPipeline(ent, trans,
classification,
mMaxPipelinedRequests)) {
LOG((" dispatched step 5 trans=%p\n", trans));
return NS_OK;
}
}
@ -1912,6 +1921,7 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
unusedSpdyPersistentConnection->DontReuse();
}
LOG((" not dispatched (queued) trans=%p\n", trans));
return NS_ERROR_NOT_AVAILABLE; /* queue it */
}

View File

@ -1758,6 +1758,14 @@ nsHttpTransaction::CancelPipeline(uint32_t reason)
mClassification = CLASS_SOLO;
}
void
nsHttpTransaction::SetLoadGroupConnectionInfo(nsILoadGroupConnectionInfo *aLoadGroupCI)
{
LOG(("nsHttpTransaction %p SetLoadGroupConnectionInfo %p\n", this, aLoadGroupCI));
mLoadGroupCI = aLoadGroupCI;
}
// Called when the transaction marked for blocking is associated with a connection
// (i.e. added to a new h1 conn, an idle http connection, or placed into
// a http pipeline). It is safe to call this multiple times with it only
@ -1773,7 +1781,7 @@ nsHttpTransaction::DispatchedAsBlocking()
if (!mLoadGroupCI)
return;
LOG(("nsHttpTransaction adding blocking channel %p from "
LOG(("nsHttpTransaction adding blocking transaction %p from "
"loadgroup %p\n", this, mLoadGroupCI.get()));
mLoadGroupCI->AddBlockingTransaction();
@ -1789,13 +1797,13 @@ nsHttpTransaction::RemoveDispatchedAsBlocking()
uint32_t blockers = 0;
nsresult rv = mLoadGroupCI->RemoveBlockingTransaction(&blockers);
LOG(("nsHttpTransaction removing blocking channel %p from "
LOG(("nsHttpTransaction removing blocking transaction %p from "
"loadgroup %p. %d blockers remain.\n", this,
mLoadGroupCI.get(), blockers));
if (NS_SUCCEEDED(rv) && !blockers) {
LOG(("nsHttpTransaction %p triggering release of blocked channels.\n",
this));
LOG(("nsHttpTransaction %p triggering release of blocked channels "
" with loadgroupci=%p\n", this, mLoadGroupCI.get()));
gHttpHandler->ConnMgr()->ProcessPendingQ();
}
@ -1806,6 +1814,8 @@ void
nsHttpTransaction::ReleaseBlockingTransaction()
{
RemoveDispatchedAsBlocking();
LOG(("nsHttpTransaction %p loadgroupci set to null "
"in ReleaseBlockingTransaction() - was %p\n", this, mLoadGroupCI.get()));
mLoadGroupCI = nullptr;
}

View File

@ -133,7 +133,7 @@ public:
// overload of nsAHttpTransaction::LoadGroupConnectionInfo()
nsILoadGroupConnectionInfo *LoadGroupConnectionInfo() MOZ_OVERRIDE { return mLoadGroupCI.get(); }
void SetLoadGroupConnectionInfo(nsILoadGroupConnectionInfo *aLoadGroupCI) { mLoadGroupCI = aLoadGroupCI; }
void SetLoadGroupConnectionInfo(nsILoadGroupConnectionInfo *aLoadGroupCI);
void DispatchedAsBlocking();
void RemoveDispatchedAsBlocking();