Merge m-c to b-i

This commit is contained in:
Phil Ringnalda 2014-02-17 15:26:12 -08:00
commit a2418c4e8a
27 changed files with 353 additions and 198 deletions

View File

@ -1005,8 +1005,13 @@ var gBrowserInit = {
}
// Note: loadOneOrMoreURIs *must not* be called if window.arguments.length >= 3.
// Such callers expect that window.arguments[0] is handled as a single URI.
else
else {
if (uriToLoad == "about:newtab" &&
Services.prefs.getBoolPref("browser.newtabpage.enabled")) {
Services.telemetry.getHistogramById("NEWTAB_PAGE_SHOWN").add(true);
}
loadOneOrMoreURIs(uriToLoad);
}
}
#ifdef MOZ_SAFE_BROWSING

View File

@ -85,6 +85,8 @@ let gPage = {
this._mutationObserver = new MutationObserver(() => {
if (this.allowBackgroundCaptures) {
Services.telemetry.getHistogramById("NEWTAB_PAGE_SHOWN").add(true);
for (let site of gGrid.sites) {
if (site) {
site.captureIfMissing();

View File

@ -92,15 +92,9 @@
#elif MOZ_MSVC_REDIST == 1700
@BINPATH@/msvcp110.dll
@BINPATH@/msvcr110.dll
#ifdef MOZ_METRO
@BINPATH@/vccorlib110.dll
#endif
#elif MOZ_MSVC_REDIST == 1800
@BINPATH@/msvcp120.dll
@BINPATH@/msvcr120.dll
#ifdef MOZ_METRO
@BINPATH@/vccorlib120.dll
#endif
#endif
#endif
#endif

View File

@ -659,10 +659,14 @@ void MediaDecoderStateMachine::SendStreamData()
if (mInfo.HasAudio()) {
AudioSegment* audio = new AudioSegment();
mediaStream->AddTrack(TRACK_AUDIO, mInfo.mAudio.mRate, 0, audio);
stream->mStream->DispatchWhenNotEnoughBuffered(TRACK_AUDIO,
GetStateMachineThread(), GetWakeDecoderRunnable());
}
if (mInfo.HasVideo()) {
VideoSegment* video = new VideoSegment();
mediaStream->AddTrack(TRACK_VIDEO, RATE_VIDEO, 0, video);
stream->mStream->DispatchWhenNotEnoughBuffered(TRACK_VIDEO,
GetStateMachineThread(), GetWakeDecoderRunnable());
}
stream->mStreamInitialized = true;
}

View File

@ -2200,7 +2200,9 @@ SourceMediaStream::DispatchWhenNotEnoughBuffered(TrackID aID,
}
if (data->mHaveEnough) {
data->mDispatchWhenNotEnough.AppendElement()->Init(aSignalThread, aSignalRunnable);
if (data->mDispatchWhenNotEnough.IsEmpty()) {
data->mDispatchWhenNotEnough.AppendElement()->Init(aSignalThread, aSignalRunnable);
}
} else {
aSignalThread->Dispatch(aSignalRunnable, 0);
}

View File

@ -672,7 +672,7 @@ public:
* Ensures that aSignalRunnable will be dispatched to aSignalThread
* when we don't have enough buffered data in the track (which could be
* immediately). Will dispatch the runnable immediately if the track
* does not exist.
* does not exist. No op if a runnable is already present for this track.
*/
void DispatchWhenNotEnoughBuffered(TrackID aID,
nsIThread* aSignalThread, nsIRunnable* aSignalRunnable);

View File

@ -2259,11 +2259,11 @@ nsJSContext::EndCycleCollectionCallback(CycleCollectorResults &aResults)
if (sPostGCEventsToObserver) {
NS_NAMED_MULTILINE_LITERAL_STRING(kJSONFmt,
MOZ_UTF16("{ \"timestamp\": %llu, ")
MOZ_UTF16("\"duration\": %llu, ")
MOZ_UTF16("\"max_slice_pause\": %llu, ")
MOZ_UTF16("\"total_slice_pause\": %llu, ")
MOZ_UTF16("\"max_finish_gc_duration\": %llu, ")
MOZ_UTF16("\"max_sync_skippable_duration\": %llu, ")
MOZ_UTF16("\"duration\": %lu, ")
MOZ_UTF16("\"max_slice_pause\": %lu, ")
MOZ_UTF16("\"total_slice_pause\": %lu, ")
MOZ_UTF16("\"max_finish_gc_duration\": %lu, ")
MOZ_UTF16("\"max_sync_skippable_duration\": %lu, ")
MOZ_UTF16("\"suspected\": %lu, ")
MOZ_UTF16("\"visited\": { ")
MOZ_UTF16("\"RCed\": %lu, ")

View File

@ -543,6 +543,14 @@ gfxDWriteFontEntry::ReadCMAP(FontInfoData *aFontInfoData)
mHasCmapTable = NS_SUCCEEDED(rv);
if (mHasCmapTable) {
// Bug 969504: exclude U+25B6 from Segoe UI family, because it's used
// by sites to represent a "Play" icon, but the glyph in Segoe UI Light
// and Semibold on Windows 7 is too thin. (Ditto for leftward U+25C0.)
// Fallback to Segoe UI Symbol is preferred.
if (FamilyName().EqualsLiteral("Segoe UI")) {
charmap->clear(0x25b6);
charmap->clear(0x25c0);
}
gfxPlatformFontList *pfl = gfxPlatformFontList::PlatformFontList();
mCharacterMap = pfl->FindCharMap(charmap);
} else {

View File

@ -0,0 +1,26 @@
function ceil(x) {
return Math.ceil(x);
}
// Compiled as Ceil(double -> int32)
assertEq(ceil(1.1), 2);
assertEq(ceil(-1.1), -1);
assertEq(ceil(-3), -3);
// As we use the identity Math.ceil(x) == -Math.floor(-x) and Floor(-0) bails out,
// this should bail out.
assertEq(ceil(0), 0);
assertEq(ceil(0), 0);
// Reuses the Ceil(double -> int32) path
assertEq(ceil(1.1), 2);
assertEq(ceil(-1.1), -1);
assertEq(ceil(-3), -3);
// Bails out and then compiles as Ceil(double -> double)
assertEq(ceil(-0), -0);
assertEq(ceil(Math.pow(2, 32)), Math.pow(2, 32));
assertEq(ceil(-0), -0);
// Still works but not inlined as double -> int32 (it still uses double -> double)
assertEq(ceil(1.5), 2);

View File

@ -208,7 +208,7 @@ function setupFloorDouble() {
function testFloor() {
for (var i = 0; i < 4; ++i) {
var f = Math.floor(f32[i]);
assertFloat32(g, false); // f is an int32
assertFloat32(f, false); // f is an int32
var g = Math.floor(-0 + f32[i]);
assertFloat32(g, false);
@ -229,3 +229,41 @@ function testFloorDouble() {
}
test(setupFloor, testFloor);
test(setupFloorDouble, testFloorDouble);
function setupCeil() {
f32[0] = -5.5;
f32[1] = -1.5;
f32[2] = 0;
f32[3] = 1.5;
}
function setupCeilDouble() {
f32[4] = NaN;
f32[5] = -0;
f32[6] = Infinity;
f32[7] = -Infinity;
f32[8] = Math.pow(2,31); // too big to fit into a int
}
function testCeil() {
for(var i = 0; i < 2; ++i) {
var f = Math.ceil(f32[i]);
assertFloat32(f, false);
var g = Math.ceil(-0 + f32[i]);
assertFloat32(g, false);
assertEq(f, g);
}
}
function testCeilDouble() {
for(var i = 4; i < 9; ++i) {
var f = Math.fround(Math.ceil(f32[i]));
assertFloat32(f, true);
var g = Math.ceil(-0 + f32[i]);
assertFloat32(g, false);
assertEq(f, g);
}
}
test(setupCeil, testCeil);
test(setupCeilDouble, testCeilDouble);

View File

@ -4618,7 +4618,7 @@ ICGetElem_TypedArray::Compiler::generateStubCode(MacroAssembler &masm)
bool
ICGetElem_Arguments::Compiler::generateStubCode(MacroAssembler &masm)
{
// Variatns of GetElem_Arguments can enter stub frames if entered in CallProp
// Variants of GetElem_Arguments can enter stub frames if entered in CallProp
// context when noSuchMethod support is on.
#if JS_HAS_NO_SUCH_METHOD
#ifdef DEBUG

View File

@ -620,6 +620,21 @@ IonBuilder::inlineMathCeil(CallInfo &callInfo)
return InliningStatus_Inlined;
}
if (IsFloatingPointType(argType) && returnType == MIRType_Int32) {
// Math.ceil(x) == -Math.floor(-x)
callInfo.setImplicitlyUsedUnchecked();
MConstant *minusOne = MConstant::New(alloc(), DoubleValue(-1.0));
current->add(minusOne);
MMul *mul = MMul::New(alloc(), callInfo.getArg(0), minusOne, argType);
current->add(mul);
MFloor *floor = MFloor::New(alloc(), mul);
current->add(floor);
MMul *result = MMul::New(alloc(), floor, minusOne, MIRType_Int32);
current->add(result);
current->push(result);
return InliningStatus_Inlined;
}
if (IsFloatingPointType(argType) && returnType == MIRType_Double) {
callInfo.setImplicitlyUsedUnchecked();
MMathFunction *ins = MMathFunction::New(alloc(), callInfo.getArg(0), MMathFunction::Ceil, nullptr);

View File

@ -42,7 +42,6 @@ UNIFIED_SOURCES += [
'testIntern.cpp',
'testIntString.cpp',
'testIntTypesABI.cpp',
'testJitRValueAlloc.cpp',
'testJSEvaluateScript.cpp',
'testLookup.cpp',
'testLooselyEqual.cpp',
@ -73,6 +72,11 @@ UNIFIED_SOURCES += [
'testXDR.cpp',
]
if CONFIG['ENABLE_ION']:
UNIFIED_SOURCES += [
'testJitRValueAlloc.cpp',
]
DEFINES['EXPORT_JS_API'] = True
# Building against js_static requires that we declare mfbt sybols "exported"
# on its behalf.

View File

@ -1666,6 +1666,11 @@ ContainerState::FindFixedPosFrameForLayerData(const nsIFrame* aAnimatedGeometryR
nsIntRegion* aVisibleRegion,
bool* aIsSolidColorInVisibleRegion)
{
if (!mManager->IsWidgetLayerManager()) {
// Never attach any fixed-pos metadata to inactive layers, it's pointless!
return nullptr;
}
nsPresContext* presContext = mContainerFrame->PresContext();
nsIFrame* viewport = presContext->PresShell()->GetRootFrame();
const nsIFrame* result = nullptr;
@ -1685,6 +1690,10 @@ ContainerState::FindFixedPosFrameForLayerData(const nsIFrame* aAnimatedGeometryR
result = f;
break;
}
if (f == mContainerReferenceFrame) {
// The metadata will go on an ancestor layer if necessary.
return nullptr;
}
}
if (!result) {
return nullptr;

View File

@ -798,7 +798,8 @@ public class ActivityChooserModel extends DataSetObservable {
for (Iterator<HistoricalRecord> i = mHistoricalRecords.iterator(); i.hasNext();) {
final HistoricalRecord record = i.next();
if (record.activity.getPackageName().equals(pkg)) {
removed = mHistoricalRecords.remove(record);
i.remove();
removed = true;
}
}

View File

@ -80,12 +80,12 @@ nsHttpConnection::nsHttpConnection()
, mResponseTimeoutEnabled(false)
, mTCPKeepaliveConfig(kTCPKeepaliveDisabled)
{
LOG(("Creating nsHttpConnection @%p\n", this));
LOG(("Creating nsHttpConnection @%x\n", this));
}
nsHttpConnection::~nsHttpConnection()
{
LOG(("Destroying nsHttpConnection @%p\n", this));
LOG(("Destroying nsHttpConnection @%x\n", this));
ReportDataUsage(false);
if (!mEverUsedSpdy) {
@ -313,7 +313,7 @@ nsHttpConnection::Activate(nsAHttpTransaction *trans, uint32_t caps, int32_t pri
nsresult rv;
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
LOG(("nsHttpConnection::Activate [this=%p trans=%p caps=%x]\n",
LOG(("nsHttpConnection::Activate [this=%p trans=%x caps=%x]\n",
this, trans, caps));
if (!trans->IsNullTransaction())
@ -1247,7 +1247,7 @@ nsHttpConnection::EndIdleMonitoring()
void
nsHttpConnection::CloseTransaction(nsAHttpTransaction *trans, nsresult reason)
{
LOG(("nsHttpConnection::CloseTransaction[this=%p trans=%p reason=%x]\n",
LOG(("nsHttpConnection::CloseTransaction[this=%p trans=%x reason=%x]\n",
this, trans, reason));
MOZ_ASSERT(trans == mTransaction, "wrong transaction");
@ -1809,7 +1809,6 @@ nsHttpConnection::OnInputStreamReady(nsIAsyncInputStream *in)
if (!CanReuse()) {
LOG(("Server initiated close of idle conn %p\n", this));
// CloseIdleConnection may delete "this" - return immediately
gHttpHandler->ConnMgr()->CloseIdleConnection(this);
return NS_OK;
}

View File

@ -27,7 +27,7 @@ nsHttpConnectionInfo::nsHttpConnectionInfo(const nsACString &host, int32_t port,
, mUsingSSL(usingSSL)
, mUsingConnect(false)
{
LOG(("Creating nsHttpConnectionInfo @%p\n", this));
LOG(("Creating nsHttpConnectionInfo @%x\n", this));
mUsingHttpProxy = (proxyInfo && proxyInfo->IsHTTP());

View File

@ -41,6 +41,25 @@ namespace net {
NS_IMPL_ISUPPORTS1(nsHttpConnectionMgr, nsIObserver)
static void
InsertTransactionSorted(nsTArray<nsHttpTransaction*> &pendingQ, nsHttpTransaction *trans)
{
// insert into queue with smallest valued number first. search in reverse
// order under the assumption that many of the existing transactions will
// have the same priority (usually 0).
for (int32_t i=pendingQ.Length()-1; i>=0; --i) {
nsHttpTransaction *t = pendingQ[i];
if (trans->Priority() >= t->Priority()) {
pendingQ.InsertElementAt(i+1, trans);
return;
}
}
pendingQ.InsertElementAt(0, trans);
}
//-----------------------------------------------------------------------------
nsHttpConnectionMgr::nsHttpConnectionMgr()
: mReentrantMonitor("nsHttpConnectionMgr.mReentrantMonitor")
, mMaxConns(0)
@ -55,12 +74,12 @@ nsHttpConnectionMgr::nsHttpConnectionMgr()
, mTimeoutTickArmed(false)
, mTimeoutTickNext(1)
{
LOG(("Creating nsHttpConnectionMgr @%p\n", this));
LOG(("Creating nsHttpConnectionMgr @%x\n", this));
}
nsHttpConnectionMgr::~nsHttpConnectionMgr()
{
LOG(("Destroying nsHttpConnectionMgr @%p\n", this));
LOG(("Destroying nsHttpConnectionMgr @%x\n", this));
if (mTimeoutTick)
mTimeoutTick->Cancel();
}
@ -158,7 +177,8 @@ nsHttpConnectionMgr::PostEvent(nsConnEventHandler handler, int32_t iparam, void
if (!mSocketThreadTarget) {
NS_WARNING("cannot post event if not initialized");
rv = NS_ERROR_NOT_INITIALIZED;
} else {
}
else {
nsRefPtr<nsIRunnable> event = new nsConnEvent(this, handler, iparam, vparam);
rv = mSocketThreadTarget->Dispatch(event, NS_DISPATCH_NORMAL);
}
@ -234,9 +254,11 @@ nsHttpConnectionMgr::Observe(nsISupports *subject,
nsCOMPtr<nsITimer> timer = do_QueryInterface(subject);
if (timer == mTimer) {
PruneDeadConnections();
} else if (timer == mTimeoutTick) {
}
else if (timer == mTimeoutTick) {
TimeoutTick();
} else {
}
else {
MOZ_ASSERT(false, "unexpected timer-callback");
LOG(("Unexpected timer object\n"));
return NS_ERROR_UNEXPECTED;
@ -250,42 +272,39 @@ nsHttpConnectionMgr::Observe(nsISupports *subject,
//-----------------------------------------------------------------------------
nsresult
nsHttpConnectionMgr::AddTransaction(nsHttpTransaction *aTrans, int32_t priority)
nsHttpConnectionMgr::AddTransaction(nsHttpTransaction *trans, int32_t priority)
{
LOG(("nsHttpConnectionMgr::AddTransaction [trans=%p %d]\n", aTrans, priority));
LOG(("nsHttpConnectionMgr::AddTransaction [trans=%x %d]\n", trans, priority));
nsRefPtr<nsHttpTransaction> trans(aTrans);
NS_ADDREF(trans);
nsresult rv = PostEvent(&nsHttpConnectionMgr::OnMsgNewTransaction, priority, trans);
if (NS_SUCCEEDED(rv)) {
trans.forget();
}
if (NS_FAILED(rv))
NS_RELEASE(trans);
return rv;
}
nsresult
nsHttpConnectionMgr::RescheduleTransaction(nsHttpTransaction *aTrans, int32_t priority)
nsHttpConnectionMgr::RescheduleTransaction(nsHttpTransaction *trans, int32_t priority)
{
LOG(("nsHttpConnectionMgr::RescheduleTransaction [trans=%p %d]\n", aTrans, priority));
LOG(("nsHttpConnectionMgr::RescheduleTransaction [trans=%x %d]\n", trans, priority));
nsRefPtr<nsHttpTransaction> trans(aTrans);
NS_ADDREF(trans);
nsresult rv = PostEvent(&nsHttpConnectionMgr::OnMsgReschedTransaction, priority, trans);
if (NS_SUCCEEDED(rv)) {
trans.forget();
}
if (NS_FAILED(rv))
NS_RELEASE(trans);
return rv;
}
nsresult
nsHttpConnectionMgr::CancelTransaction(nsHttpTransaction *aTrans, nsresult reason)
nsHttpConnectionMgr::CancelTransaction(nsHttpTransaction *trans, nsresult reason)
{
LOG(("nsHttpConnectionMgr::CancelTransaction [trans=%p reason=%x]\n", aTrans, reason));
LOG(("nsHttpConnectionMgr::CancelTransaction [trans=%x reason=%x]\n", trans, reason));
nsRefPtr<nsHttpTransaction> trans(aTrans);
NS_ADDREF(trans);
nsresult rv = PostEvent(&nsHttpConnectionMgr::OnMsgCancelTransaction,
static_cast<int32_t>(reason), trans);
if (NS_SUCCEEDED(rv)) {
trans.forget();
}
if (NS_FAILED(rv))
NS_RELEASE(trans);
return rv;
}
@ -302,9 +321,8 @@ nsHttpConnectionMgr::DoShiftReloadConnectionCleanup(nsHttpConnectionInfo *aCI)
nsresult rv = PostEvent(&nsHttpConnectionMgr::OnMsgDoShiftReloadConnectionCleanup,
0, connInfo);
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv))
connInfo.forget();
}
return rv;
}
@ -378,9 +396,8 @@ nsHttpConnectionMgr::SpeculativeConnect(nsHttpConnectionInfo *ci,
nsresult rv =
PostEvent(&nsHttpConnectionMgr::OnMsgSpeculativeConnect, 0, args);
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv))
args.forget();
}
return rv;
}
@ -395,15 +412,14 @@ nsHttpConnectionMgr::GetSocketThreadTarget(nsIEventTarget **target)
}
nsresult
nsHttpConnectionMgr::ReclaimConnection(nsHttpConnection *aConn)
nsHttpConnectionMgr::ReclaimConnection(nsHttpConnection *conn)
{
LOG(("nsHttpConnectionMgr::ReclaimConnection [conn=%p]\n", aConn));
LOG(("nsHttpConnectionMgr::ReclaimConnection [conn=%x]\n", conn));
nsRefPtr<nsHttpConnection> conn(aConn);
NS_ADDREF(conn);
nsresult rv = PostEvent(&nsHttpConnectionMgr::OnMsgReclaimConnection, 0, conn);
if (NS_SUCCEEDED(rv)) {
conn.forget();
}
if (NS_FAILED(rv))
NS_RELEASE(conn);
return rv;
}
@ -428,9 +444,8 @@ nsHttpConnectionMgr::CompleteUpgrade(nsAHttpConnection *aConn,
new nsCompleteUpgradeData(aConn, aUpgradeListener);
nsresult rv;
rv = PostEvent(&nsHttpConnectionMgr::OnMsgCompleteUpgrade, 0, data);
if (NS_FAILED(rv)) {
if (NS_FAILED(rv))
delete data;
}
return rv;
}
@ -443,15 +458,14 @@ nsHttpConnectionMgr::UpdateParam(nsParamName name, uint16_t value)
}
nsresult
nsHttpConnectionMgr::ProcessPendingQ(nsHttpConnectionInfo *aCI)
nsHttpConnectionMgr::ProcessPendingQ(nsHttpConnectionInfo *ci)
{
LOG(("nsHttpConnectionMgr::ProcessPendingQ [ci=%s]\n", aCI->HashKey().get()));
LOG(("nsHttpConnectionMgr::ProcessPendingQ [ci=%s]\n", ci->HashKey().get()));
nsRefPtr<nsHttpConnectionInfo> ci(aCI);
NS_ADDREF(ci);
nsresult rv = PostEvent(&nsHttpConnectionMgr::OnMsgProcessPendingQ, 0, ci);
if (NS_SUCCEEDED(rv)) {
ci.forget();
}
if (NS_FAILED(rv))
NS_RELEASE(ci);
return rv;
}
@ -479,9 +493,8 @@ nsHttpConnectionMgr::UpdateRequestTokenBucket(EventTokenBucket *aBucket)
// to post the new value to the socket thread.
nsresult rv = PostEvent(&nsHttpConnectionMgr::OnMsgUpdateRequestTokenBucket,
0, bucket.get());
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv))
bucket.forget();
}
return rv;
}
@ -535,7 +548,6 @@ nsHttpConnectionMgr::CloseIdleConnection(nsHttpConnection *conn)
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
LOG(("nsHttpConnectionMgr::CloseIdleConnection %p conn=%p",
this, conn));
nsRefPtr<nsHttpConnection> deleteProtector(conn);
if (!conn->ConnectionInfo())
return NS_ERROR_UNEXPECTED;
@ -547,7 +559,7 @@ nsHttpConnectionMgr::CloseIdleConnection(nsHttpConnection *conn)
return NS_ERROR_UNEXPECTED;
conn->Close(NS_ERROR_ABORT);
conn = nullptr;
NS_RELEASE(conn);
mNumIdleConns--;
ConditionallyStopPruneDeadConnectionsTimer();
return NS_OK;
@ -841,10 +853,10 @@ nsHttpConnectionMgr::PurgeExcessIdleConnectionsCB(const nsACString &key,
// There are no idle conns left in this connection entry
return PL_DHASH_NEXT;
}
nsRefPtr<nsHttpConnection> conn(ent->mIdleConns[0]);
nsHttpConnection *conn = ent->mIdleConns[0];
ent->mIdleConns.RemoveElementAt(0);
conn->Close(NS_ERROR_ABORT);
conn = nullptr;
NS_RELEASE(conn);
self->mNumIdleConns--;
self->ConditionallyStopPruneDeadConnectionsTimer();
}
@ -890,15 +902,15 @@ nsHttpConnectionMgr::PruneDeadConnectionsCB(const nsACString &key,
uint32_t timeToNextExpire = UINT32_MAX;
int32_t count = ent->mIdleConns.Length();
if (count > 0) {
for (int32_t i = count - 1; i >= 0; --i) {
if (!ent->mIdleConns[i]->CanReuse()) {
nsRefPtr<nsHttpConnection> conn(ent->mIdleConns[i]);
for (int32_t i=count-1; i>=0; --i) {
nsHttpConnection *conn = ent->mIdleConns[i];
if (!conn->CanReuse()) {
ent->mIdleConns.RemoveElementAt(i);
conn->Close(NS_ERROR_ABORT);
NS_RELEASE(conn);
self->mNumIdleConns--;
} else {
timeToNextExpire = std::min(timeToNextExpire,
ent->mIdleConns[i]->TimeToLive());
timeToNextExpire = std::min(timeToNextExpire, conn->TimeToLive());
}
}
}
@ -911,7 +923,8 @@ nsHttpConnectionMgr::PruneDeadConnectionsCB(const nsACString &key,
// marking it dont reuse will create an active tear down if
// the spdy session is idle.
conn->DontReuse();
} else {
}
else {
timeToNextExpire = std::min(timeToNextExpire,
conn->TimeToLive());
}
@ -967,32 +980,42 @@ nsHttpConnectionMgr::ShutdownPassCB(const nsACString &key,
{
nsHttpConnectionMgr *self = (nsHttpConnectionMgr *) closure;
// close all active connections and release list references
nsHttpTransaction *trans;
nsHttpConnection *conn;
// close all active connections
while (ent->mActiveConns.Length()) {
nsRefPtr<nsHttpConnection> conn(ent->mActiveConns[0]);
conn = ent->mActiveConns[0];
ent->mActiveConns.RemoveElementAt(0);
self->DecrementActiveConnCount(conn);
conn->Close(NS_ERROR_ABORT);
NS_RELEASE(conn);
}
// close all idle connections and release list references
// close all idle connections
while (ent->mIdleConns.Length()) {
nsRefPtr<nsHttpConnection> conn(ent->mIdleConns[0]);
conn = ent->mIdleConns[0];
ent->mIdleConns.RemoveElementAt(0);
self->mNumIdleConns--;
conn->Close(NS_ERROR_ABORT);
NS_RELEASE(conn);
}
// If all idle connections are removed,
// we can stop pruning dead connections.
self->ConditionallyStopPruneDeadConnectionsTimer();
// close all pending transactions and release list references
// close all pending transactions
while (ent->mPendingQ.Length()) {
nsRefPtr<nsHttpTransaction> trans(ent->mPendingQ[0]);
trans = ent->mPendingQ[0];
ent->mPendingQ.RemoveElementAt(0);
trans->Close(NS_ERROR_ABORT);
NS_RELEASE(trans);
}
// close all half open tcp connections
@ -1047,6 +1070,7 @@ nsHttpConnectionMgr::ProcessPendingQForEntry(nsConnectionEntry *ent, bool consid
if (ent->mPendingQ.RemoveElement(trans)) {
dispatchedSuccessfully = true;
NS_RELEASE(trans);
continue; // dont ++i as we just made the array shorter
}
@ -1239,10 +1263,11 @@ nsHttpConnectionMgr::ClosePersistentConnections(nsConnectionEntry *ent)
LOG(("nsHttpConnectionMgr::ClosePersistentConnections [ci=%s]\n",
ent->mConnInfo->HashKey().get()));
while (ent->mIdleConns.Length()) {
nsRefPtr<nsHttpConnection> conn(ent->mIdleConns[0]);
nsHttpConnection *conn = ent->mIdleConns[0];
ent->mIdleConns.RemoveElementAt(0);
mNumIdleConns--;
conn->Close(NS_ERROR_ABORT);
NS_RELEASE(conn);
}
int32_t activeCount = ent->mActiveConns.Length();
@ -1455,9 +1480,8 @@ nsHttpConnectionMgr::AddToShortestPipeline(nsConnectionEntry *ent,
activeTrans = bestConn->Transaction();
nsresult rv = activeTrans->AddTransaction(trans);
if (NS_FAILED(rv)) {
if (NS_FAILED(rv))
return false;
}
LOG((" scheduling trans %p on pipeline at position %d\n",
trans, trans->PipelinePosition()));
@ -1563,7 +1587,7 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
nsRefPtr<nsHttpConnection> conn = GetSpdyPreferredConn(ent);
if (conn) {
if ((caps & NS_HTTP_ALLOW_KEEPALIVE) || !conn->IsExperienced()) {
LOG((" dispatch to spdy: [conn=%p]\n", conn.get()));
LOG((" dispatch to spdy: [conn=%x]\n", conn.get()));
trans->RemoveDispatchedAsBlocking(); /* just in case */
DispatchTransaction(ent, trans, conn);
return NS_OK;
@ -1589,7 +1613,8 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
}
}
}
} else {
}
else {
// Mark the transaction and its load group as blocking right now to prevent
// other transactions from being reordered in the queue due to slow syns.
trans->DispatchedAsBlocking();
@ -1631,15 +1656,18 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
conn = ent->mIdleConns[0];
ent->mIdleConns.RemoveElementAt(0);
mNumIdleConns--;
nsHttpConnection *temp = conn;
NS_RELEASE(temp);
// we check if the connection can be reused before even checking if
// it is a "matching" connection.
if (!conn->CanReuse()) {
LOG((" dropping stale connection: [conn=%p]\n", conn.get()));
LOG((" dropping stale connection: [conn=%x]\n", conn.get()));
conn->Close(NS_ERROR_ABORT);
conn = nullptr;
} else {
LOG((" reusing connection [conn=%p]\n", conn.get()));
}
else {
LOG((" reusing connection [conn=%x]\n", conn.get()));
conn->EndIdleMonitoring();
}
@ -1714,7 +1742,7 @@ nsHttpConnectionMgr::DispatchTransaction(nsConnectionEntry *ent,
nsresult rv;
LOG(("nsHttpConnectionMgr::DispatchTransaction "
"[ci=%s trans=%p caps=%x conn=%p priority=%d]\n",
"[ci=%s trans=%x caps=%x conn=%x priority=%d]\n",
ent->mConnInfo->HashKey().get(), trans, caps, conn, priority));
// It is possible for a rate-paced transaction to be dispatched independent
@ -1774,7 +1802,7 @@ nsHttpConnectionMgr::DispatchAbstractTransaction(nsConnectionEntry *ent,
MOZ_ASSERT(!conn->UsingSpdy(),
"Spdy Must Not Use DispatchAbstractTransaction");
LOG(("nsHttpConnectionMgr::DispatchAbstractTransaction "
"[ci=%s trans=%p caps=%x conn=%p]\n",
"[ci=%s trans=%x caps=%x conn=%x]\n",
ent->mConnInfo->HashKey().get(), aTrans, caps, conn));
/* Use pipeline datastructure even if connection does not currently qualify
@ -1792,7 +1820,8 @@ nsHttpConnectionMgr::DispatchAbstractTransaction(nsConnectionEntry *ent,
if (!NS_SUCCEEDED(rv))
return rv;
transaction = pipeline;
} else {
}
else {
LOG((" not using pipeline datastructure due to class solo.\n"));
transaction = aTrans;
}
@ -1805,7 +1834,6 @@ nsHttpConnectionMgr::DispatchAbstractTransaction(nsConnectionEntry *ent,
rv = conn->Activate(transaction, caps, priority);
if (NS_FAILED(rv)) {
LOG((" conn->Activate failed [rv=%x]\n", rv));
nsRefPtr<nsHttpConnection> deleteProtector(conn);
ent->mActiveConns.RemoveElement(conn);
if (conn == ent->mYellowConnection)
ent->OnYellowComplete();
@ -1815,7 +1843,9 @@ nsHttpConnectionMgr::DispatchAbstractTransaction(nsConnectionEntry *ent,
// sever back references to connection, and do so without triggering
// a call to ReclaimConnection ;-)
transaction->SetConnection(nullptr);
handle->Reset();
NS_RELEASE(handle->mConn);
// destroy the connection
NS_RELEASE(conn);
}
// As transaction goes out of scope it will drop the last refernece to the
@ -1841,7 +1871,7 @@ nsHttpConnectionMgr::BuildPipeline(nsConnectionEntry *ent,
nsRefPtr<nsHttpPipeline> pipeline = new nsHttpPipeline();
pipeline->AddTransaction(firstTrans);
pipeline.forget(result);
NS_ADDREF(*result = pipeline);
return NS_OK;
}
@ -1922,9 +1952,10 @@ nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans)
if (rv == NS_ERROR_NOT_AVAILABLE) {
LOG((" adding transaction to pending queue "
"[trans=%p pending-count=%u]\n",
trans, ent->mPendingQ.Length() + 1));
trans, ent->mPendingQ.Length()+1));
// put this transaction on the pending queue...
InsertTransactionSorted(ent->mPendingQ, trans);
NS_ADDREF(trans);
return NS_OK;
}
@ -1932,10 +1963,12 @@ nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans)
return rv;
}
void
nsHttpConnectionMgr::AddActiveConn(nsHttpConnection *conn,
nsConnectionEntry *ent)
{
NS_ADDREF(conn);
ent->mActiveConns.AppendElement(conn);
mNumActiveConns++;
ActivateTimeoutTick();
@ -1995,7 +2028,7 @@ nsHttpConnectionMgr::ProcessSpdyPendingQ(nsConnectionEntry *ent)
if (!conn || !conn->CanDirectlyActivate())
return;
nsTArray<nsRefPtr<nsHttpTransaction> > leftovers;
nsTArray<nsHttpTransaction*> leftovers;
uint32_t index;
// Dispatch all the transactions we can
@ -2016,15 +2049,17 @@ nsHttpConnectionMgr::ProcessSpdyPendingQ(nsConnectionEntry *ent)
// close the transaction
MOZ_ASSERT(false, "Dispatch SPDY Transaction");
LOG(("ProcessSpdyPendingQ Dispatch Transaction failed trans=%p\n",
trans));
trans));
trans->Close(rv);
}
NS_RELEASE(trans);
}
// Slurp up the rest of the pending queue into our leftovers bucket (we
// might have some left if conn->CanDirectlyActivate returned false)
for (; index < ent->mPendingQ.Length(); ++index) {
leftovers.AppendElement(ent->mPendingQ[index]);
nsHttpTransaction *trans = ent->mPendingQ[index];
leftovers.AppendElement(trans);
}
// Put the leftovers back in the pending queue and get rid of the
@ -2120,13 +2155,12 @@ nsHttpConnectionMgr::OnMsgNewTransaction(int32_t priority, void *param)
{
LOG(("nsHttpConnectionMgr::OnMsgNewTransaction [trans=%p]\n", param));
nsRefPtr<nsHttpTransaction> trans =
dont_AddRef(static_cast<nsHttpTransaction *>(param));
nsHttpTransaction *trans = (nsHttpTransaction *) param;
trans->SetPriority(priority);
nsresult rv = ProcessNewTransaction(trans);
if (NS_FAILED(rv)) {
if (NS_FAILED(rv))
trans->Close(rv); // for whatever its worth
}
NS_RELEASE(trans);
}
void
@ -2135,8 +2169,7 @@ nsHttpConnectionMgr::OnMsgReschedTransaction(int32_t priority, void *param)
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
LOG(("nsHttpConnectionMgr::OnMsgReschedTransaction [trans=%p]\n", param));
nsRefPtr<nsHttpTransaction> trans =
dont_AddRef(static_cast<nsHttpTransaction *>(param));
nsHttpTransaction *trans = (nsHttpTransaction *) param;
trans->SetPriority(priority);
nsConnectionEntry *ent = LookupConnectionEntry(trans->ConnectionInfo(),
@ -2149,6 +2182,8 @@ nsHttpConnectionMgr::OnMsgReschedTransaction(int32_t priority, void *param)
InsertTransactionSorted(ent->mPendingQ, trans);
}
}
NS_RELEASE(trans);
}
void
@ -2158,8 +2193,7 @@ nsHttpConnectionMgr::OnMsgCancelTransaction(int32_t reason, void *param)
LOG(("nsHttpConnectionMgr::OnMsgCancelTransaction [trans=%p]\n", param));
nsresult closeCode = static_cast<nsresult>(reason);
nsRefPtr<nsHttpTransaction> trans =
dont_AddRef(static_cast<nsHttpTransaction *>(param));
nsHttpTransaction *trans = (nsHttpTransaction *) param;
//
// if the transaction owns a connection and the transaction is not done,
// then ask the connection to close the transaction. otherwise, close the
@ -2176,8 +2210,10 @@ nsHttpConnectionMgr::OnMsgCancelTransaction(int32_t reason, void *param)
int32_t index = ent->mPendingQ.IndexOf(trans);
if (index >= 0) {
LOG(("nsHttpConnectionMgr::OnMsgCancelTransaction [trans=%p]"
" found in pending queue\n", trans.get()));
" found in pending queue\n", trans));
ent->mPendingQ.RemoveElementAt(index);
nsHttpTransaction *temp = trans;
NS_RELEASE(temp); // b/c NS_RELEASE nulls its argument!
}
}
trans->Close(closeCode);
@ -2196,19 +2232,19 @@ nsHttpConnectionMgr::OnMsgCancelTransaction(int32_t reason, void *param)
if (liveTransaction && liveTransaction->IsNullTransaction()) {
LOG(("nsHttpConnectionMgr::OnMsgCancelTransaction [trans=%p] "
"also canceling Null Transaction %p on conn %p\n",
trans.get(), liveTransaction, activeConn));
trans, liveTransaction, activeConn));
activeConn->CloseTransaction(liveTransaction, closeCode);
}
}
}
NS_RELEASE(trans);
}
void
nsHttpConnectionMgr::OnMsgProcessPendingQ(int32_t, void *param)
{
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
nsRefPtr<nsHttpConnectionInfo> ci =
dont_AddRef(static_cast<nsHttpConnectionInfo *>(param));
nsHttpConnectionInfo *ci = (nsHttpConnectionInfo *) param;
if (!ci) {
LOG(("nsHttpConnectionMgr::OnMsgProcessPendingQ [ci=nullptr]\n"));
@ -2227,6 +2263,8 @@ nsHttpConnectionMgr::OnMsgProcessPendingQ(int32_t, void *param)
// for the specified connection info. walk the connection table...
mCT.Enumerate(ProcessOneTransactionCB, this);
}
NS_RELEASE(ci);
}
void
@ -2264,8 +2302,7 @@ nsHttpConnectionMgr::OnMsgReclaimConnection(int32_t, void *param)
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
LOG(("nsHttpConnectionMgr::OnMsgReclaimConnection [conn=%p]\n", param));
nsRefPtr<nsHttpConnection> conn =
dont_AddRef(static_cast<nsHttpConnection *>(param));
nsHttpConnection *conn = (nsHttpConnection *) param;
//
// 1) remove the connection from the active list
@ -2275,15 +2312,16 @@ nsHttpConnectionMgr::OnMsgReclaimConnection(int32_t, void *param)
nsConnectionEntry *ent = LookupConnectionEntry(conn->ConnectionInfo(),
conn, nullptr);
nsRefPtr<nsHttpConnectionInfo> ci;
nsHttpConnectionInfo *ci = nullptr;
if (!ent) {
// this should never happen
LOG(("nsHttpConnectionMgr::OnMsgReclaimConnection ent == null\n"));
MOZ_ASSERT(false, "no connection entry");
ci = conn->ConnectionInfo();
} else {
ci = ent->mConnInfo;
NS_ADDREF(ci = conn->ConnectionInfo());
}
else {
NS_ADDREF(ci = ent->mConnInfo);
// If the connection is in the active list, remove that entry
// and the reference held by the mActiveConns list.
@ -2303,7 +2341,8 @@ nsHttpConnectionMgr::OnMsgReclaimConnection(int32_t, void *param)
if (ent->mActiveConns.RemoveElement(conn)) {
if (conn == ent->mYellowConnection)
ent->OnYellowComplete();
nsHttpConnection *temp = conn;
NS_RELEASE(temp);
DecrementActiveConnCount(conn);
ConditionallyStopTimeoutTick();
}
@ -2324,6 +2363,7 @@ nsHttpConnectionMgr::OnMsgReclaimConnection(int32_t, void *param)
break;
}
NS_ADDREF(conn);
ent->mIdleConns.InsertElementAt(idx, conn);
mNumIdleConns++;
conn->BeginIdleMonitoring();
@ -2334,13 +2374,15 @@ nsHttpConnectionMgr::OnMsgReclaimConnection(int32_t, void *param)
uint32_t timeToLive = conn->TimeToLive();
if(!mTimer || NowInSeconds() + timeToLive < mTimeOfNextWakeUp)
PruneDeadConnectionsAfter(timeToLive);
} else {
}
else {
LOG((" connection cannot be reused; closing connection\n"));
conn->Close(NS_ERROR_ABORT);
}
}
OnMsgProcessPendingQ(0, ci.forget().get()); // releases |ci ref|
OnMsgProcessPendingQ(0, ci); // releases |ci|
NS_RELEASE(conn);
}
void
@ -2403,6 +2445,8 @@ nsHttpConnectionMgr::nsConnectionEntry::~nsConnectionEntry()
{
if (mSpdyPreferred)
gHttpHandler->ConnMgr()->RemoveSpdyPreferredEnt(mCoalescingKey);
NS_RELEASE(mConnInfo);
}
void
@ -2525,26 +2569,6 @@ nsHttpConnectionMgr::TimeoutTickCB(const nsACString &key,
return PL_DHASH_NEXT;
}
void
nsHttpConnectionMgr::
InsertTransactionSorted(nsTArray<nsRefPtr<nsHttpTransaction> > &pendingQ,
nsHttpTransaction *trans)
{
// Insert into queue with smallest valued number first. Search in reverse
// order under the assumption that many of the existing transactions will
// have the same priority (usually 0).
// List holds a reference on all members of mPendingQ
for (int32_t i = pendingQ.Length() - 1; i >= 0; --i) {
nsHttpTransaction *t = pendingQ[i];
if (trans->Priority() >= t->Priority()) {
pendingQ.InsertElementAt(i + 1, trans);
return;
}
}
pendingQ.InsertElementAt(0, trans);
}
//-----------------------------------------------------------------------------
// nsHttpConnectionMgr::nsConnectionHandle
@ -2552,6 +2576,7 @@ nsHttpConnectionMgr::nsConnectionHandle::~nsConnectionHandle()
{
if (mConn) {
gHttpHandler->ReclaimConnection(mConn);
NS_RELEASE(mConn);
}
}
@ -2632,7 +2657,8 @@ nsHttpConnectionMgr::OnMsgSpeculativeConnect(int32_t, void *param)
!RestrictConnections(ent, ignorePossibleSpdyConnections) &&
!AtActiveConnectionLimit(ent, args->mTrans->Caps())) {
CreateTransport(ent, args->mTrans, args->mTrans->Caps(), true);
} else {
}
else {
LOG((" Transport not created due to existing connection count\n"));
}
}
@ -2982,7 +3008,8 @@ nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out)
mStreamOut = nullptr;
mStreamIn = nullptr;
mSocketTransport = nullptr;
} else {
}
else {
TimeDuration rtt = TimeStamp::Now() - mBackupSynStarted;
rv = conn->Init(mEnt->mConnInfo,
gHttpHandler->ConnMgr()->mMaxRequestDelay,
@ -3015,11 +3042,12 @@ nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out)
if (index != -1) {
MOZ_ASSERT(!mSpeculative,
"Speculative Half Open found mTranscation");
nsRefPtr<nsHttpTransaction> temp(mEnt->mPendingQ[index]);
nsRefPtr<nsHttpTransaction> temp = dont_AddRef(mEnt->mPendingQ[index]);
mEnt->mPendingQ.RemoveElementAt(index);
gHttpHandler->ConnMgr()->AddActiveConn(conn, mEnt);
rv = gHttpHandler->ConnMgr()->DispatchTransaction(mEnt, temp, conn);
} else {
}
else {
// this transaction was dispatched off the pending q before all the
// sockets established themselves.
@ -3054,7 +3082,8 @@ nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out)
conn->Classify(nsAHttpTransaction::CLASS_SOLO);
rv = gHttpHandler->ConnMgr()->
DispatchAbstractTransaction(mEnt, trans, mCaps, conn, 0);
} else {
}
else {
// otherwise just put this in the persistent connection pool
LOG(("nsHalfOpenSocket::OnOutputStreamReady no transaction match "
"returning conn %p to pool\n", conn.get()));
@ -3208,6 +3237,7 @@ nsConnectionEntry::nsConnectionEntry(nsHttpConnectionInfo *ci)
, mPreferIPv4(false)
, mPreferIPv6(false)
{
NS_ADDREF(mConnInfo);
if (gHttpHandler->GetPipelineAggressive()) {
mGreenDepth = kPipelineUnlimited;
mPipelineState = PS_GREEN;
@ -3333,7 +3363,8 @@ nsConnectionEntry::OnPipelineFeedbackInfo(
"Penalty now %d, throttle[%d] = %d\n", mConnInfo->Host(),
classification, info, mPipeliningPenalty, classification,
mPipeliningClassPenalty[classification]));
} else {
}
else {
// hand out credits for neutral and good events such as
// "headers look ok" events
@ -3368,7 +3399,8 @@ nsConnectionEntry::OnYellowComplete()
LOG(("transition %s to green\n", mConnInfo->Host()));
mPipelineState = PS_GREEN;
mGreenDepth = mInitialGreenDepth;
} else {
}
else {
// The purpose of the yellow state is to witness at least
// one successful pipelined transaction without seeing any
// kind of negative feedback before opening the flood gates.
@ -3412,7 +3444,8 @@ nsConnectionEntry::CreditPenalty()
// update last credit mark to reflect elapsed time
mLastCreditTime += TimeDuration::FromSeconds(creditsEarned << 4);
} else {
}
else {
failed = true; /* just assume this */
}

View File

@ -265,10 +265,10 @@ private:
nsConnectionEntry(nsHttpConnectionInfo *ci);
~nsConnectionEntry();
nsRefPtr<nsHttpConnectionInfo> mConnInfo;
nsTArray<nsRefPtr<nsHttpTransaction> > mPendingQ; // pending transaction queue
nsTArray<nsRefPtr<nsHttpConnection> > mActiveConns; // active connections
nsTArray<nsRefPtr<nsHttpConnection> > mIdleConns; // idle persistent connections
nsHttpConnectionInfo *mConnInfo;
nsTArray<nsHttpTransaction*> mPendingQ; // pending transaction queue
nsTArray<nsHttpConnection*> mActiveConns; // active connections
nsTArray<nsHttpConnection*> mIdleConns; // idle persistent connections
nsTArray<nsHalfOpenSocket*> mHalfOpens; // half open connections
// calculate the number of half open sockets that have not had at least 1
@ -379,18 +379,16 @@ private:
// need for consumer code to know when to give the connection back to the
// connection manager.
//
class nsConnectionHandle MOZ_FINAL : public nsAHttpConnection
class nsConnectionHandle : public nsAHttpConnection
{
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSAHTTPCONNECTION(mConn)
nsConnectionHandle(nsHttpConnection *conn) : mConn(conn) { }
nsConnectionHandle(nsHttpConnection *conn) { NS_ADDREF(mConn = conn); }
virtual ~nsConnectionHandle();
void Reset() { mConn = nullptr; }
private:
nsRefPtr<nsHttpConnection> mConn;
nsHttpConnection *mConn;
};
// nsHalfOpenSocket is used to hold the state of an opening TCP socket
@ -522,8 +520,6 @@ private:
void StartedConnect();
void RecvdConnect();
static void InsertTransactionSorted(nsTArray<nsRefPtr<nsHttpTransaction> > &,
nsHttpTransaction *);
nsConnectionEntry *GetOrCreateConnectionEntry(nsHttpConnectionInfo *);
nsresult MakeNewConnection(nsConnectionEntry *ent,

View File

@ -111,14 +111,19 @@ NewURI(const nsACString &aSpec,
int32_t aDefaultPort,
nsIURI **aURI)
{
nsRefPtr<nsStandardURL> url = new nsStandardURL();
nsStandardURL *url = new nsStandardURL();
if (!url)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(url);
nsresult rv = url->Init(nsIStandardURL::URLTYPE_AUTHORITY,
aDefaultPort, aSpec, aCharset, aBaseURI);
if (NS_FAILED(rv)) {
NS_RELEASE(url);
return rv;
}
url.forget(aURI);
*aURI = url; // no QI needed
return NS_OK;
}
@ -129,7 +134,8 @@ NewURI(const nsACString &aSpec,
nsHttpHandler *gHttpHandler = nullptr;
nsHttpHandler::nsHttpHandler()
: mHttpVersion(NS_HTTP_VERSION_1_1)
: mConnMgr(nullptr)
, mHttpVersion(NS_HTTP_VERSION_1_1)
, mProxyHttpVersion(NS_HTTP_VERSION_1_1)
, mCapabilities(NS_HTTP_ALLOW_KEEPALIVE)
, mReferrerLevel(0xff) // by default we always send a referrer
@ -225,7 +231,7 @@ nsHttpHandler::~nsHttpHandler()
// make sure the connection manager is shutdown
if (mConnMgr) {
mConnMgr->Shutdown();
mConnMgr = nullptr;
NS_RELEASE(mConnMgr);
}
// Note: don't call NeckoChild::DestroyNeckoChild() here, as it's too late
@ -383,6 +389,9 @@ nsHttpHandler::InitConnectionMgr()
if (!mConnMgr) {
mConnMgr = new nsHttpConnectionMgr();
if (!mConnMgr)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(mConnMgr);
}
rv = mConnMgr->Init(mMaxConnections,

View File

@ -345,7 +345,7 @@ private:
nsHttpAuthCache mPrivateAuthCache;
// the connection manager
nsRefPtr<nsHttpConnectionMgr> mConnMgr;
nsHttpConnectionMgr *mConnMgr;
//
// prefs

View File

@ -62,7 +62,8 @@ private:
//-----------------------------------------------------------------------------
nsHttpPipeline::nsHttpPipeline()
: mStatus(NS_OK)
: mConnection(nullptr)
, mStatus(NS_OK)
, mRequestIsPartial(false)
, mResponseIsPartial(false)
, mClosed(false)
@ -82,6 +83,8 @@ nsHttpPipeline::~nsHttpPipeline()
// make sure we aren't still holding onto any transactions!
Close(NS_ERROR_ABORT);
NS_IF_RELEASE(mConnection);
if (mPushBackBuf)
free(mPushBackBuf);
}
@ -94,7 +97,7 @@ nsHttpPipeline::AddTransaction(nsAHttpTransaction *trans)
if (mRequestQ.Length() || mResponseQ.Length())
mUtilizedPipeline = true;
trans->AddRef(); // ref held by mRequestQ
NS_ADDREF(trans);
mRequestQ.AppendElement(trans);
uint32_t qlen = PipelineDepth();
@ -202,11 +205,10 @@ nsHttpPipeline::OnHeadersAvailable(nsAHttpTransaction *trans,
}
void
nsHttpPipeline::CloseTransaction(nsAHttpTransaction *aTrans, nsresult reason)
nsHttpPipeline::CloseTransaction(nsAHttpTransaction *trans, nsresult reason)
{
nsRefPtr<nsAHttpTransaction> trans(dont_AddRef(aTrans));
LOG(("nsHttpPipeline::CloseTransaction [this=%p trans=%x reason=%x]\n",
this, trans.get(), reason));
this, trans, reason));
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
MOZ_ASSERT(NS_FAILED(reason), "expecting failure code");
@ -241,7 +243,7 @@ nsHttpPipeline::CloseTransaction(nsAHttpTransaction *aTrans, nsresult reason)
DontReuse();
trans->Close(reason);
trans = nullptr;
NS_RELEASE(trans);
if (killPipeline) {
// reschedule anything from this pipeline onto a different connection
@ -383,11 +385,12 @@ nsHttpPipeline::TakeSubTransactions(
int32_t i, count = mRequestQ.Length();
for (i = 0; i < count; ++i) {
nsRefPtr<nsAHttpTransaction> trans(dont_AddRef(Request(i)));
nsAHttpTransaction *trans = Request(i);
// set the transaction conneciton object back to the underlying
// nsHttpConnectionHandle
trans->SetConnection(mConnection);
outTransactions.AppendElement(trans);
NS_RELEASE(trans);
}
mRequestQ.Clear();
@ -406,13 +409,14 @@ nsHttpPipeline::SetConnection(nsAHttpConnection *conn)
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
MOZ_ASSERT(!mConnection, "already have a connection");
mConnection = conn;
NS_IF_ADDREF(mConnection = conn);
}
nsAHttpConnection *
nsHttpPipeline::Connection()
{
LOG(("nsHttpPipeline::Connection [this=%p conn=%x]\n", this, mConnection.get()));
LOG(("nsHttpPipeline::Connection [this=%p conn=%x]\n", this, mConnection));
MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
return mConnection;
@ -684,7 +688,7 @@ nsHttpPipeline::WriteSegments(nsAHttpSegmentWriter *writer,
// Release the transaction if it is not IsProxyConnectInProgress()
if (trans == Response(0)) {
nsRefPtr<nsAHttpTransaction> listReference(dont_AddRef(trans));
NS_RELEASE(trans);
mResponseQ.RemoveElementAt(0);
mResponseIsPartial = false;
++mHttp1xTransactionCount;
@ -727,6 +731,7 @@ uint32_t
nsHttpPipeline::CancelPipeline(nsresult originalReason)
{
uint32_t i, reqLen, respLen, total;
nsAHttpTransaction *trans;
reqLen = mRequestQ.Length();
respLen = mResponseQ.Length();
@ -742,12 +747,12 @@ nsHttpPipeline::CancelPipeline(nsresult originalReason)
// any pending requests can ignore this error and be restarted
// unless it is during a CONNECT tunnel request
for (i = 0; i < reqLen; ++i) {
// Each element on the list has a reference held by the list
nsRefPtr<nsAHttpTransaction> trans(dont_AddRef(Request(i)));
trans = Request(i);
if (mConnection && mConnection->IsProxyConnectInProgress())
trans->Close(originalReason);
else
trans->Close(NS_ERROR_NET_RESET);
NS_RELEASE(trans);
}
mRequestQ.Clear();
@ -756,8 +761,9 @@ nsHttpPipeline::CancelPipeline(nsresult originalReason)
// Higher levels of callers ensure that we don't process non-idempotent
// tranasction with the NS_HTTP_ALLOW_PIPELINING bit set
for (i = 1; i < respLen; ++i) {
nsRefPtr<nsAHttpTransaction> trans(dont_AddRef(Response(i)));
trans = Response(i);
trans->Close(NS_ERROR_NET_RESET);
NS_RELEASE(trans);
}
if (respLen > 1)
@ -795,10 +801,9 @@ nsHttpPipeline::Close(nsresult reason)
gHttpHandler->ConnMgr()->PipelineFeedbackInfo(
ci, nsHttpConnectionMgr::RedCanceledPipeline, nullptr, 0);
if (!Response(0)) {
nsAHttpTransaction *trans = Response(0);
if (!trans)
return;
}
nsRefPtr<nsAHttpTransaction> trans(dont_AddRef(Response(0)));
// The current transaction can be restarted via reset
// if the response has not started to arrive and the reason
@ -814,7 +819,7 @@ nsHttpPipeline::Close(nsresult reason)
trans->Close(reason);
}
trans = nullptr;
NS_RELEASE(trans);
mResponseQ.Clear();
}

View File

@ -58,7 +58,7 @@ private:
// overload of nsAHttpTransaction::QueryPipeline()
nsHttpPipeline *QueryPipeline();
nsRefPtr<nsAHttpConnection> mConnection;
nsAHttpConnection *mConnection;
nsTArray<nsAHttpTransaction*> mRequestQ; // array of transactions
nsTArray<nsAHttpTransaction*> mResponseQ; // array of transactions
nsresult mStatus;

View File

@ -89,6 +89,8 @@ LogHeaders(const char *lineStart)
nsHttpTransaction::nsHttpTransaction()
: mCallbacksLock("transaction mCallbacks lock")
, mRequestSize(0)
, mConnection(nullptr)
, mConnInfo(nullptr)
, mRequestHead(nullptr)
, mResponseHead(nullptr)
, mContentLength(-1)
@ -147,6 +149,9 @@ nsHttpTransaction::~nsHttpTransaction()
// Force the callbacks to be released right now
mCallbacks = nullptr;
NS_IF_RELEASE(mConnection);
NS_IF_RELEASE(mConnInfo);
delete mResponseHead;
delete mForTakeResponseHead;
delete mChunkedDecoder;
@ -264,7 +269,7 @@ nsHttpTransaction::Init(uint32_t caps,
!activityDistributorActive);
if (NS_FAILED(rv)) return rv;
mConnInfo = cinfo;
NS_ADDREF(mConnInfo = cinfo);
mCallbacks = callbacks;
mConsumerTarget = target;
mCaps = caps;
@ -440,7 +445,8 @@ nsHttpTransaction::TakeSubTransactions(
void
nsHttpTransaction::SetConnection(nsAHttpConnection *conn)
{
mConnection = conn;
NS_IF_RELEASE(mConnection);
NS_IF_ADDREF(mConnection = conn);
if (conn) {
MOZ_EVENT_TRACER_EXEC(static_cast<nsAHttpTransaction*>(this),
@ -955,9 +961,8 @@ nsHttpTransaction::Close(nsresult reason)
mTimings.responseEnd.IsNull() && !mTimings.responseStart.IsNull())
mTimings.responseEnd = TimeStamp::Now();
if (relConn) {
mConnection = nullptr;
}
if (relConn && mConnection)
NS_RELEASE(mConnection);
// save network statistics in the end of transaction
SaveNetworkStats(true);
@ -1111,7 +1116,7 @@ nsHttpTransaction::Restart()
// clear old connection state...
mSecurityInfo = 0;
mConnection = nullptr;
NS_IF_RELEASE(mConnection);
// disable pipelining for the next attempt in case pipelining caused the
// reset. this is being overly cautious since we don't know if pipelining

View File

@ -185,11 +185,10 @@ private:
nsCOMPtr<nsIInputStream> mRequestStream;
uint64_t mRequestSize;
nsRefPtr<nsHttpConnectionInfo> mConnInfo;
nsRefPtr<nsAHttpConnection> mConnection;
nsAHttpConnection *mConnection; // hard ref
nsHttpConnectionInfo *mConnInfo; // hard ref
nsHttpRequestHead *mRequestHead; // weak ref
nsHttpResponseHead *mResponseHead; // owning ref
nsHttpResponseHead *mResponseHead; // hard ref
nsAHttpSegmentReader *mReader;
nsAHttpSegmentWriter *mWriter;

View File

@ -4014,6 +4014,11 @@
"extended_statistics_ok": true,
"description": "Number of sites blocked from the new tab page."
},
"NEWTAB_PAGE_SHOWN": {
"expires_in_version": "35",
"kind": "boolean",
"description": "Number of times about:newtab was shown from opening a new tab or window."
},
"PANORAMA_INITIALIZATION_TIME_MS": {
"expires_in_version": "never",
"kind": "exponential",

View File

@ -78,10 +78,6 @@ DELAYLOAD_DLLS += [
]
if CONFIG['MOZ_METRO']:
if CONFIG['MOZ_DEBUG']:
DELAYLOAD_DLLS += ['VCCORLIB' + CONFIG['CRTDLLVERSION'] + 'D.DLL']
else:
DELAYLOAD_DLLS += ['VCCORLIB' + CONFIG['CRTDLLVERSION'] + '.DLL']
DELAYLOAD_DLLS += [
'API-MS-WIN-CORE-WINRT-L' + CONFIG['CRTEXPDLLVERSION'] + '.DLL',
'API-MS-WIN-CORE-WINRT-STRING-L' + CONFIG['CRTEXPDLLVERSION'] + '.DLL',