From d7a6d25806d29565a71e21eba2ee156ed76bf9c7 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Tue, 5 Aug 2014 04:29:11 -0700 Subject: [PATCH 01/60] Bug 1042729 part 1 - Make resume point unique to each instruction. r=h4writer --- js/src/jit/IonBuilder.cpp | 4 ++-- js/src/jit/MIR.cpp | 14 ++++++++++++++ js/src/jit/MIR.h | 1 + js/src/jit/MIRGraph.cpp | 16 ++++++++++------ 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index b2166adef7b..6f5e921f053 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -700,7 +700,7 @@ IonBuilder::build() // register/stack pressure. MCheckOverRecursed *check = MCheckOverRecursed::New(alloc()); current->add(check); - check->setResumePoint(current->entryResumePoint()); + check->setResumePoint(MResumePoint::Copy(alloc(), current->entryResumePoint())); // Parameters have been checked to correspond to the typeset, now we unbox // what we can in an infallible manner. @@ -735,7 +735,7 @@ IonBuilder::build() for (uint32_t i = 0; i < info().endArgSlot(); i++) { MInstruction *ins = current->getEntrySlot(i)->toInstruction(); if (ins->type() == MIRType_Value) - ins->setResumePoint(current->entryResumePoint()); + ins->setResumePoint(MResumePoint::Copy(alloc(), current->entryResumePoint())); } // lazyArguments should never be accessed in |argsObjAliasesFormals| scripts. diff --git a/js/src/jit/MIR.cpp b/js/src/jit/MIR.cpp index 9681f3b929c..c1b76d957f5 100644 --- a/js/src/jit/MIR.cpp +++ b/js/src/jit/MIR.cpp @@ -2351,6 +2351,20 @@ MResumePoint::New(TempAllocator &alloc, MBasicBlock *block, jsbytecode *pc, MRes return resume; } +MResumePoint * +MResumePoint::Copy(TempAllocator &alloc, MResumePoint *src) +{ + MResumePoint *resume = new(alloc) MResumePoint(src->block(), src->pc(), + src->caller(), src->mode()); + // Copy the operands from the original resume point, and not from the + // current block stack. + if (!resume->operands_.init(alloc, src->stackDepth())) + return nullptr; + for (size_t i = 0; i < resume->stackDepth(); i++) + resume->initOperand(i, src->getOperand(i)); + return resume; +} + MResumePoint::MResumePoint(MBasicBlock *block, jsbytecode *pc, MResumePoint *caller, Mode mode) : MNode(block), diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 17486ce4b35..0eb6cfcdde8 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -10253,6 +10253,7 @@ class MResumePoint MOZ_FINAL : public MNode, public InlineForwardListNodeisOsrScopeChain()) - def->toOsrScopeChain()->setResumePoint(res); + cloneRp = def->toOsrScopeChain(); } else if (i == info().returnValueSlot()) { if (def->isOsrReturnValue()) - def->toOsrReturnValue()->setResumePoint(res); + cloneRp = def->toOsrReturnValue(); } else if (info().hasArguments() && i == info().argsObjSlot()) { JS_ASSERT(def->isConstant() || def->isOsrArgumentsObject()); JS_ASSERT_IF(def->isConstant(), def->toConstant()->value() == UndefinedValue()); if (def->isOsrArgumentsObject()) - def->toOsrArgumentsObject()->setResumePoint(res); + cloneRp = def->toOsrArgumentsObject(); } else { JS_ASSERT(def->isOsrValue() || def->isGetArgumentsObjectArg() || def->isConstant() || def->isParameter()); @@ -515,12 +516,15 @@ MBasicBlock::linkOsrValues(MStart *start) JS_ASSERT_IF(def->isConstant(), def->toConstant()->value() == UndefinedValue()); if (def->isOsrValue()) - def->toOsrValue()->setResumePoint(res); + cloneRp = def->toOsrValue(); else if (def->isGetArgumentsObjectArg()) - def->toGetArgumentsObjectArg()->setResumePoint(res); + cloneRp = def->toGetArgumentsObjectArg(); else if (def->isParameter()) - def->toParameter()->setResumePoint(res); + cloneRp = def->toParameter(); } + + if (cloneRp) + cloneRp->setResumePoint(MResumePoint::Copy(graph().alloc(), res)); } } From 8163504d5a1b91f80f707a5709843b0fcee1ec32 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Tue, 5 Aug 2014 04:29:12 -0700 Subject: [PATCH 02/60] Bug 1042729 part 2 - Ensure that a resume point belongs to one instruction. r=h4writer --- js/src/jit/IonAnalysis.cpp | 16 ++++++++------ js/src/jit/IonBuilder.cpp | 1 - js/src/jit/MIR.cpp | 17 +++++++++++++++ js/src/jit/MIR.h | 16 +++++++------- js/src/jit/MIRGraph.cpp | 31 ++++++++++++++++----------- js/src/jit/MIRGraph.h | 2 ++ js/src/jit/ParallelSafetyAnalysis.cpp | 5 +---- 7 files changed, 55 insertions(+), 33 deletions(-) diff --git a/js/src/jit/IonAnalysis.cpp b/js/src/jit/IonAnalysis.cpp index 8da8f83e8dd..a59b81c1b51 100644 --- a/js/src/jit/IonAnalysis.cpp +++ b/js/src/jit/IonAnalysis.cpp @@ -1744,10 +1744,15 @@ jit::AssertBasicGraphCoherency(MIRGraph &graph) for (size_t i = 0; i < block->numPredecessors(); i++) JS_ASSERT(CheckPredecessorImpliesSuccessor(*block, block->getPredecessor(i))); + MOZ_ASSERT_IF(block->entryResumePoint(), !block->entryResumePoint()->instruction()); for (MResumePointIterator iter(block->resumePointsBegin()); iter != block->resumePointsEnd(); iter++) { + // We cannot yet assert that is there is no instruction then this is + // the entry resume point because we are still storing resume points + // in the InlinePropertyTable. + MOZ_ASSERT_IF(iter->instruction(), iter->instruction()->block() == *block); for (uint32_t i = 0, e = iter->numOperands(); i < e; i++) { - if (iter->getUseFor(i)->hasProducer()) - JS_ASSERT(CheckOperandImpliesUse(*iter, iter->getOperand(i))); + MOZ_ASSERT(iter->getUseFor(i)->hasProducer()); + MOZ_ASSERT(CheckOperandImpliesUse(*iter, iter->getOperand(i))); } } for (MPhiIterator phi(block->phisBegin()); phi != block->phisEnd(); phi++) { @@ -1765,11 +1770,8 @@ jit::AssertBasicGraphCoherency(MIRGraph &graph) if (iter->isInstruction()) { if (MResumePoint *resume = iter->toInstruction()->resumePoint()) { - if (MInstruction *ins = resume->instruction()) - JS_ASSERT(ins->block() == iter->block()); - - for (uint32_t i = 0, e = resume->numOperands(); i < e; i++) - MOZ_ASSERT(resume->getUseFor(i)->hasProducer()); + MOZ_ASSERT(resume->instruction() == *iter); + MOZ_ASSERT(resume->block() == *block); } } diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index 6f5e921f053..755fa078bd4 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -6051,7 +6051,6 @@ IonBuilder::resume(MInstruction *ins, jsbytecode *pc, MResumePoint::Mode mode) if (!resumePoint) return false; ins->setResumePoint(resumePoint); - resumePoint->setInstruction(ins); return true; } diff --git a/js/src/jit/MIR.cpp b/js/src/jit/MIR.cpp index c1b76d957f5..7a191c22855 100644 --- a/js/src/jit/MIR.cpp +++ b/js/src/jit/MIR.cpp @@ -231,6 +231,23 @@ MDefinition::analyzeEdgeCasesBackward() { } +void +MInstruction::setResumePoint(MResumePoint *resumePoint) +{ + JS_ASSERT(!resumePoint_); + resumePoint_ = resumePoint; + resumePoint_->setInstruction(this); +} + +void +MInstruction::stealResumePoint(MInstruction *ins) +{ + MOZ_ASSERT(ins->resumePoint_->instruction() == ins); + resumePoint_ = ins->resumePoint_; + ins->resumePoint_ = nullptr; + resumePoint_->replaceInstruction(this); +} + static bool MaybeEmulatesUndefined(MDefinition *op) { diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 0eb6cfcdde8..65dcccfd422 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -779,15 +779,9 @@ class MInstruction : resumePoint_(nullptr) { } - void setResumePoint(MResumePoint *resumePoint) { - JS_ASSERT(!resumePoint_); - resumePoint_ = resumePoint; - } + void setResumePoint(MResumePoint *resumePoint); // Used to transfer the resume point to the rewritten instruction. - void stealResumePoint(MInstruction *ins) { - resumePoint_ = ins->resumePoint_; - ins->resumePoint_ = nullptr; - } + void stealResumePoint(MInstruction *ins); MResumePoint *resumePoint() const { return resumePoint_; } @@ -10302,6 +10296,12 @@ class MResumePoint MOZ_FINAL : public MNode, public InlineForwardListNodediscardUses(); + MResumePointIterator iter = resumePointsBegin(); + while (*iter != rp) { + // We should reach it before reaching the end. + MOZ_ASSERT(iter != resumePointsEnd()); + iter++; + } + resumePoints_.removeAt(iter); +} + void MBasicBlock::prepareForDiscard(MInstruction *ins, ReferencesType refType /* = RefType_Default */) { @@ -724,19 +740,8 @@ MBasicBlock::prepareForDiscard(MInstruction *ins, ReferencesType refType /* = Re MOZ_ASSERT(ins->block() == this); MResumePoint *rp = ins->resumePoint(); - if (refType & RefType_DiscardResumePoint && rp) { - rp->discardUses(); - // Resume point are using a forward list only, so we need to iterate - // to the location of the resume point in order to remove it. - MResumePointIterator iter = resumePointsBegin(); - while (*iter != rp) { - // If the instruction has a resume point, then it should be part - // of the basic block list of resume points. - MOZ_ASSERT(iter != resumePointsEnd()); - iter++; - } - resumePoints_.removeAt(iter); - } + if (refType & RefType_DiscardResumePoint && rp) + discardResumePoint(rp); // We need to assert that instructions have no uses after removing the their // resume points operands as they could be captured by their own resume diff --git a/js/src/jit/MIRGraph.h b/js/src/jit/MIRGraph.h index b246786ea40..d7fafed9428 100644 --- a/js/src/jit/MIRGraph.h +++ b/js/src/jit/MIRGraph.h @@ -61,6 +61,8 @@ class MBasicBlock : public TempObject, public InlineListNode // as needed. void setVariable(uint32_t slot); + void discardResumePoint(MResumePoint *rp); + enum ReferencesType { RefType_AssertNoUses = 1 << 0, RefType_DiscardOperands = 1 << 1, diff --git a/js/src/jit/ParallelSafetyAnalysis.cpp b/js/src/jit/ParallelSafetyAnalysis.cpp index 9b5291450fe..8859f706890 100644 --- a/js/src/jit/ParallelSafetyAnalysis.cpp +++ b/js/src/jit/ParallelSafetyAnalysis.cpp @@ -337,11 +337,8 @@ static void TransplantResumePoint(MInstruction *oldInstruction, MInstruction *replacementInstruction) { MOZ_ASSERT(!oldInstruction->isDiscarded()); - if (MResumePoint *rp = oldInstruction->resumePoint()) { + if (oldInstruction->resumePoint()) replacementInstruction->stealResumePoint(oldInstruction); - if (rp->instruction() == oldInstruction) - rp->setInstruction(replacementInstruction); - } } bool From a9277658ad231b0fefa8c9f870a45484a7d0ddc4 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Tue, 5 Aug 2014 04:29:13 -0700 Subject: [PATCH 03/60] Bug 1042729 part 3 - Ensure priorResumePoints are re-attached to the new BasicBlock or discarded. r=efaust --- js/src/jit/IonBuilder.cpp | 27 +++++++++++++++++++++++++-- js/src/jit/MIR.h | 7 ++++--- js/src/jit/MIRGraph.cpp | 12 ++++++++---- js/src/jit/MIRGraph.h | 12 ++++++++++-- 4 files changed, 47 insertions(+), 11 deletions(-) diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index 755fa078bd4..0414c847efc 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -4321,6 +4321,26 @@ IonBuilder::inlineSingleCall(CallInfo &callInfo, JSFunction *target) return InliningStatus_Inlined; } +class DiscardPropCacheResumePoint +{ + MGetPropertyCache *propCache_; + + public: + DiscardPropCacheResumePoint(MGetPropertyCache *propCache) + : propCache_(propCache) + { + } + + ~DiscardPropCacheResumePoint() { + if (!propCache_) + return; + + InlinePropertyTable *propTable = propCache_->propTable(); + if (MResumePoint *rp = propTable->takePriorResumePoint()) + propCache_->block()->discardPreAllocatedResumePoint(rp); + } +}; + IonBuilder::InliningStatus IonBuilder::inlineCallsite(ObjectVector &targets, ObjectVector &originals, bool lambda, CallInfo &callInfo) @@ -4364,6 +4384,8 @@ IonBuilder::inlineCallsite(ObjectVector &targets, ObjectVector &originals, return inlineSingleCall(callInfo, target); } + DiscardPropCacheResumePoint discardRp(propCache); + // Choose a subset of the targets for polymorphic inlining. BoolVector choiceSet(alloc()); uint32_t numInlined; @@ -4455,9 +4477,10 @@ IonBuilder::inlineTypeObjectFallback(CallInfo &callInfo, MBasicBlock *dispatchBl // Construct a block into which the MGetPropertyCache can be moved. // This is subtle: the pc and resume point are those of the MGetPropertyCache! InlinePropertyTable *propTable = cache->propTable(); + MResumePoint *priorResumePoint = propTable->takePriorResumePoint(); JS_ASSERT(propTable->pc() != nullptr); - JS_ASSERT(propTable->priorResumePoint() != nullptr); - MBasicBlock *getPropBlock = newBlock(prepBlock, propTable->pc(), propTable->priorResumePoint()); + JS_ASSERT(priorResumePoint != nullptr); + MBasicBlock *getPropBlock = newBlock(prepBlock, propTable->pc(), priorResumePoint); if (!getPropBlock) return false; diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 65dcccfd422..f62a2bc8a8c 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -7503,9 +7503,10 @@ class InlinePropertyTable : public TempObject JS_ASSERT(priorResumePoint_ == nullptr); priorResumePoint_ = resumePoint; } - - MResumePoint *priorResumePoint() const { - return priorResumePoint_; + MResumePoint *takePriorResumePoint() { + MResumePoint *rp = priorResumePoint_; + priorResumePoint_ = nullptr; + return rp; } jsbytecode *pc() const { diff --git a/js/src/jit/MIRGraph.cpp b/js/src/jit/MIRGraph.cpp index f305a7cd4c1..8a05684218b 100644 --- a/js/src/jit/MIRGraph.cpp +++ b/js/src/jit/MIRGraph.cpp @@ -203,7 +203,10 @@ MBasicBlock::NewWithResumePoint(MIRGraph &graph, CompileInfo &info, { MBasicBlock *block = new(graph.alloc()) MBasicBlock(graph, info, site, NORMAL); + MOZ_ASSERT(!resumePoint->instruction()); + resumePoint->block()->discardResumePoint(resumePoint, RefType_None); resumePoint->block_ = block; + block->addResumePoint(resumePoint); block->entryResumePoint_ = resumePoint; if (!block->init()) @@ -720,9 +723,10 @@ AssertSafelyDiscardable(MDefinition *def) } void -MBasicBlock::discardResumePoint(MResumePoint *rp) +MBasicBlock::discardResumePoint(MResumePoint *rp, ReferencesType refType /* = RefType_Default */) { - rp->discardUses(); + if (refType & RefType_DiscardOperands) + rp->discardUses(); MResumePointIterator iter = resumePointsBegin(); while (*iter != rp) { // We should reach it before reaching the end. @@ -740,8 +744,8 @@ MBasicBlock::prepareForDiscard(MInstruction *ins, ReferencesType refType /* = Re MOZ_ASSERT(ins->block() == this); MResumePoint *rp = ins->resumePoint(); - if (refType & RefType_DiscardResumePoint && rp) - discardResumePoint(rp); + if ((refType & RefType_DiscardResumePoint) && rp) + discardResumePoint(rp, refType); // We need to assert that instructions have no uses after removing the their // resume points operands as they could be captured by their own resume diff --git a/js/src/jit/MIRGraph.h b/js/src/jit/MIRGraph.h index d7fafed9428..2520b5c051d 100644 --- a/js/src/jit/MIRGraph.h +++ b/js/src/jit/MIRGraph.h @@ -61,15 +61,17 @@ class MBasicBlock : public TempObject, public InlineListNode // as needed. void setVariable(uint32_t slot); - void discardResumePoint(MResumePoint *rp); - enum ReferencesType { + RefType_None = 0, RefType_AssertNoUses = 1 << 0, RefType_DiscardOperands = 1 << 1, RefType_DiscardResumePoint = 1 << 2, + RefType_DefaultNoAssert = RefType_DiscardOperands | RefType_DiscardResumePoint, RefType_Default = RefType_AssertNoUses | RefType_DiscardOperands | RefType_DiscardResumePoint }; + void discardResumePoint(MResumePoint *rp, ReferencesType refType = RefType_Default); + // Remove all references to an instruction such that it can be removed from // the list of instruction, without keeping any dangling pointer to it. This // includes the operands of the instruction, and the resume point if @@ -185,6 +187,12 @@ class MBasicBlock : public TempObject, public InlineListNode resumePoints_.pushFront(resume); } + // Discard pre-allocated resume point. + void discardPreAllocatedResumePoint(MResumePoint *resume) { + MOZ_ASSERT(!resume->instruction()); + discardResumePoint(resume); + } + // Adds a predecessor. Every predecessor must have the same exit stack // depth as the entry state to this block. Adding a predecessor // automatically creates phi nodes and rewrites uses as needed. From a65cb6bff08ad2d474460fb873cdefb937c6a655 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Tue, 5 Aug 2014 04:29:13 -0700 Subject: [PATCH 04/60] Bug 1042729 part 4 - Keep a reference to outer resume point on basic blocks, and make discarding resume point precise. r=jandem --- js/src/jit/IonAnalysis.cpp | 9 ++++++++- js/src/jit/IonBuilder.cpp | 1 + js/src/jit/MIRGraph.cpp | 37 ++++++++++++++++++++++--------------- js/src/jit/MIRGraph.h | 16 ++++++++++++++++ 4 files changed, 47 insertions(+), 16 deletions(-) diff --git a/js/src/jit/IonAnalysis.cpp b/js/src/jit/IonAnalysis.cpp index a59b81c1b51..ccdc9fd6b46 100644 --- a/js/src/jit/IonAnalysis.cpp +++ b/js/src/jit/IonAnalysis.cpp @@ -1744,7 +1744,14 @@ jit::AssertBasicGraphCoherency(MIRGraph &graph) for (size_t i = 0; i < block->numPredecessors(); i++) JS_ASSERT(CheckPredecessorImpliesSuccessor(*block, block->getPredecessor(i))); - MOZ_ASSERT_IF(block->entryResumePoint(), !block->entryResumePoint()->instruction()); + if (block->entryResumePoint()) { + MOZ_ASSERT(!block->entryResumePoint()->instruction()); + MOZ_ASSERT(block->entryResumePoint()->block() == *block); + } + if (block->outerResumePoint()) { + MOZ_ASSERT(!block->outerResumePoint()->instruction()); + MOZ_ASSERT(block->outerResumePoint()->block() == *block); + } for (MResumePointIterator iter(block->resumePointsBegin()); iter != block->resumePointsEnd(); iter++) { // We cannot yet assert that is there is no instruction then this is // the entry resume point because we are still storing resume points diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index 0414c847efc..c2ae3c5c6cf 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -3985,6 +3985,7 @@ IonBuilder::inlineScriptedCall(CallInfo &callInfo, JSFunction *target) MResumePoint::New(alloc(), current, pc, callerResumePoint_, MResumePoint::Outer); if (!outerResumePoint) return false; + current->setOuterResumePoint(outerResumePoint); // Pop formals again, except leave |fun| on stack for duration of call. callInfo.popFormals(current); diff --git a/js/src/jit/MIRGraph.cpp b/js/src/jit/MIRGraph.cpp index 8a05684218b..815608f9633 100644 --- a/js/src/jit/MIRGraph.cpp +++ b/js/src/jit/MIRGraph.cpp @@ -105,8 +105,8 @@ MIRGraph::removeBlock(MBasicBlock *block) } } - block->discardAllResumePoints(); block->discardAllInstructions(); + block->discardAllResumePoints(); // Note: phis are disconnected from the rest of the graph, but are not // removed entirely. If the block being removed is a loop header then @@ -297,6 +297,7 @@ MBasicBlock::MBasicBlock(MIRGraph &graph, CompileInfo &info, const BytecodeSite pc_(site.pc()), lir_(nullptr), entryResumePoint_(nullptr), + outerResumePoint_(nullptr), successorWithPhis_(nullptr), positionInPhiSuccessor_(0), loopDepth_(0), @@ -816,11 +817,10 @@ void MBasicBlock::discardAllInstructionsStartingAt(MInstructionIterator &iter) { while (iter != end()) { - // We only discard operands and flag the instruction as discarded as the - // resume points are exepected to be removed separately. Also we do not - // assert that we have no uses as block might be removed in reverse post - // order. - prepareForDiscard(*iter, RefType_DiscardOperands); + // Discard operands and resume point operands and flag the instruction + // as discarded. Also we do not assert that we have no uses as blocks + // might be removed in reverse post order. + prepareForDiscard(*iter, RefType_DefaultNoAssert); iter = instructions_.removeAt(iter); } } @@ -845,17 +845,24 @@ MBasicBlock::discardAllPhis() void MBasicBlock::discardAllResumePoints(bool discardEntry) { - for (MResumePointIterator iter = resumePointsBegin(); iter != resumePointsEnd(); ) { - MResumePoint *rp = *iter; - if (rp == entryResumePoint() && !discardEntry) { - iter++; - } else { - rp->discardUses(); - iter = resumePoints_.removeAt(iter); - } + if (outerResumePoint_) { + discardResumePoint(outerResumePoint_); + outerResumePoint_ = nullptr; } - if (discardEntry) + + if (discardEntry && entryResumePoint_) clearEntryResumePoint(); + +#ifdef DEBUG + if (!entryResumePoint()) { + MOZ_ASSERT(resumePointsEmpty()); + } else { + MResumePointIterator iter(resumePointsBegin()); + MOZ_ASSERT(iter != resumePointsEnd()); + iter++; + MOZ_ASSERT(iter == resumePointsEnd()); + } +#endif } void diff --git a/js/src/jit/MIRGraph.h b/js/src/jit/MIRGraph.h index 2520b5c051d..b2de6ec85c7 100644 --- a/js/src/jit/MIRGraph.h +++ b/js/src/jit/MIRGraph.h @@ -478,8 +478,16 @@ class MBasicBlock : public TempObject, public InlineListNode return entryResumePoint_; } void clearEntryResumePoint() { + discardResumePoint(entryResumePoint_); entryResumePoint_ = nullptr; } + MResumePoint *outerResumePoint() const { + return outerResumePoint_; + } + void setOuterResumePoint(MResumePoint *outer) { + MOZ_ASSERT(!outerResumePoint_); + outerResumePoint_ = outer; + } MResumePoint *callerResumePoint() { return entryResumePoint()->caller(); } @@ -562,7 +570,15 @@ class MBasicBlock : public TempObject, public InlineListNode uint32_t numDominated_; jsbytecode *pc_; LBlock *lir_; + + // Resume point holding baseline-like frame for the PC corresponding to the + // entry of this basic block. MResumePoint *entryResumePoint_; + + // Resume point holding baseline-like frame for the PC corresponding to the + // beginning of the call-site which is being inlined after this block. + MResumePoint *outerResumePoint_; + MBasicBlock *successorWithPhis_; uint32_t positionInPhiSuccessor_; uint32_t loopDepth_; From 29444640c332b7b1bf7810fcb9ce82782e7500f3 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Tue, 5 Aug 2014 04:29:13 -0700 Subject: [PATCH 05/60] Bug 1042729 part 5 - Only list resume points in debug builds. r=h4writer --- js/src/jit/MIR.h | 6 +++++- js/src/jit/MIRGraph.cpp | 2 ++ js/src/jit/MIRGraph.h | 14 +++++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index f62a2bc8a8c..61a9c82bd42 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -10206,7 +10206,11 @@ class MNewDenseArrayPar : public MBinaryInstruction // A resume point contains the information needed to reconstruct the Baseline // state from a position in the JIT. See the big comment near resumeAfter() in // IonBuilder.cpp. -class MResumePoint MOZ_FINAL : public MNode, public InlineForwardListNode +class MResumePoint MOZ_FINAL : + public MNode +#ifdef DEBUG + , public InlineForwardListNode +#endif { public: enum Mode { diff --git a/js/src/jit/MIRGraph.cpp b/js/src/jit/MIRGraph.cpp index 815608f9633..a08861b8e44 100644 --- a/js/src/jit/MIRGraph.cpp +++ b/js/src/jit/MIRGraph.cpp @@ -728,6 +728,7 @@ MBasicBlock::discardResumePoint(MResumePoint *rp, ReferencesType refType /* = Re { if (refType & RefType_DiscardOperands) rp->discardUses(); +#ifdef DEBUG MResumePointIterator iter = resumePointsBegin(); while (*iter != rp) { // We should reach it before reaching the end. @@ -735,6 +736,7 @@ MBasicBlock::discardResumePoint(MResumePoint *rp, ReferencesType refType /* = Re iter++; } resumePoints_.removeAt(iter); +#endif } void diff --git a/js/src/jit/MIRGraph.h b/js/src/jit/MIRGraph.h index b2de6ec85c7..b91a48c53f5 100644 --- a/js/src/jit/MIRGraph.h +++ b/js/src/jit/MIRGraph.h @@ -27,7 +27,10 @@ class MDefinitionIterator; typedef InlineListIterator MInstructionIterator; typedef InlineListReverseIterator MInstructionReverseIterator; typedef InlineListIterator MPhiIterator; + +#ifdef DEBUG typedef InlineForwardListIterator MResumePointIterator; +#endif class LBlock; @@ -184,7 +187,9 @@ class MBasicBlock : public TempObject, public InlineListNode // Adds a resume point to this block. void addResumePoint(MResumePoint *resume) { +#ifdef DEBUG resumePoints_.pushFront(resume); +#endif } // Discard pre-allocated resume point. @@ -341,6 +346,7 @@ class MBasicBlock : public TempObject, public InlineListNode bool phisEmpty() const { return phis_.empty(); } +#ifdef DEBUG MResumePointIterator resumePointsBegin() const { return resumePoints_.begin(); } @@ -350,6 +356,7 @@ class MBasicBlock : public TempObject, public InlineListNode bool resumePointsEmpty() const { return resumePoints_.empty(); } +#endif MInstructionIterator begin() { return instructions_.begin(); } @@ -562,7 +569,6 @@ class MBasicBlock : public TempObject, public InlineListNode InlineList instructions_; Vector predecessors_; InlineList phis_; - InlineForwardList resumePoints_; FixedList slots_; uint32_t stackPosition_; uint32_t id_; @@ -579,6 +585,12 @@ class MBasicBlock : public TempObject, public InlineListNode // beginning of the call-site which is being inlined after this block. MResumePoint *outerResumePoint_; +#ifdef DEBUG + // Unordered list used to verify that all the resume points which are + // registered are correctly removed when a basic block is removed. + InlineForwardList resumePoints_; +#endif + MBasicBlock *successorWithPhis_; uint32_t positionInPhiSuccessor_; uint32_t loopDepth_; From 35906333f452a2f3f7fe29e64bbd7b65eff9106c Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Fri, 1 Aug 2014 04:10:25 +0200 Subject: [PATCH 06/60] Bug 1039950 - Make the OpenGL program object handles strongly typed. r=jgilbert --- dom/canvas/WebGLContextGL.cpp | 22 +++++----- dom/canvas/WebGLProgram.h | 4 +- gfx/gl/GLBlitHelper.cpp | 12 +++--- gfx/gl/GLBlitHelper.h | 8 ++-- gfx/gl/GLBlitTextureImageHelper.cpp | 1 - gfx/gl/GLBlitTextureImageHelper.h | 3 +- gfx/gl/GLContext.h | 40 ++++++++++------- gfx/gl/GLReadTexImageHelper.cpp | 15 +++---- gfx/gl/GLReadTexImageHelper.h | 4 +- gfx/gl/GLTypes.h | 60 ++++++++++++++++++++++++++ gfx/gl/SkiaGLGlue.cpp | 18 ++++---- gfx/layers/opengl/OGLShaderProgram.cpp | 2 +- gfx/layers/opengl/OGLShaderProgram.h | 4 +- 13 files changed, 129 insertions(+), 64 deletions(-) diff --git a/dom/canvas/WebGLContextGL.cpp b/dom/canvas/WebGLContextGL.cpp index 27e9b6d95a9..c8fcbb19126 100644 --- a/dom/canvas/WebGLContextGL.cpp +++ b/dom/canvas/WebGLContextGL.cpp @@ -130,7 +130,7 @@ WebGLContext::BindAttribLocation(WebGLProgram *prog, GLuint location, if (!ValidateObject("bindAttribLocation: program", prog)) return; - GLuint progname = prog->GLName(); + GLProgram progname = prog->GLName(); if (!ValidateGLSLVariableName(name, "bindAttribLocation")) return; @@ -855,7 +855,7 @@ WebGLContext::GetActiveAttrib(WebGLProgram *prog, uint32_t index) MakeContextCurrent(); GLint len = 0; - GLuint progname = prog->GLName();; + GLProgram progname = prog->GLName();; gl->fGetProgramiv(progname, LOCAL_GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); if (len == 0) return nullptr; @@ -946,7 +946,7 @@ WebGLContext::GetActiveUniform(WebGLProgram *prog, uint32_t index) MakeContextCurrent(); GLint len = 0; - GLuint progname = prog->GLName(); + GLProgram progname = prog->GLName(); gl->fGetProgramiv(progname, LOCAL_GL_ACTIVE_UNIFORM_MAX_LENGTH, &len); if (len == 0) return nullptr; @@ -1024,7 +1024,7 @@ WebGLContext::GetAttribLocation(WebGLProgram *prog, const nsAString& name) nsCString mappedName; prog->MapIdentifier(cname, &mappedName); - GLuint progname = prog->GLName(); + GLProgram progname = prog->GLName(); MakeContextCurrent(); return gl->fGetAttribLocation(progname, mappedName.get()); @@ -1372,7 +1372,7 @@ WebGLContext::GetProgramParameter(WebGLProgram *prog, GLenum pname) if (!ValidateObjectAllowDeleted("getProgramParameter: program", prog)) return JS::NullValue(); - GLuint progname = prog->GLName(); + GLProgram progname = prog->GLName(); MakeContextCurrent(); @@ -1439,7 +1439,7 @@ WebGLContext::GetProgramInfoLog(WebGLProgram *prog, nsACString& retval) return; } - GLuint progname = prog->GLName(); + GLProgram progname = prog->GLName(); MakeContextCurrent(); @@ -1638,7 +1638,7 @@ WebGLContext::GetUniform(JSContext* cx, WebGLProgram *prog, return JS::NullValue(); } - GLuint progname = prog->GLName(); + GLProgram progname = prog->GLName(); MakeContextCurrent(); @@ -1768,7 +1768,7 @@ WebGLContext::GetUniformLocation(WebGLProgram *prog, const nsAString& name) nsCString mappedName; prog->MapIdentifier(cname, &mappedName); - GLuint progname = prog->GLName(); + GLProgram progname = prog->GLName(); MakeContextCurrent(); GLint intlocation = gl->fGetUniformLocation(progname, mappedName.get()); @@ -1902,7 +1902,7 @@ WebGLContext::LinkProgram(WebGLProgram *program) InvalidateBufferFetching(); // we do it early in this function // as some of the validation below changes program state - GLuint progname = program->GLName(); + GLProgram progname = program->GLName(); if (!program->NextGeneration()) { // XXX throw? @@ -2919,7 +2919,7 @@ WebGLContext::UseProgram(WebGLProgram *prog) InvalidateBufferFetching(); - GLuint progname = prog ? prog->GLName() : 0; + GLProgram progname = prog ? prog->GLName() : GLProgram(0); if (prog && !prog->LinkStatus()) return ErrorInvalidOperation("useProgram: program was not linked successfully"); @@ -2948,7 +2948,7 @@ WebGLContext::ValidateProgram(WebGLProgram *prog) } #endif - GLuint progname = prog->GLName(); + GLProgram progname = prog->GLName(); gl->fValidateProgram(progname); } diff --git a/dom/canvas/WebGLProgram.h b/dom/canvas/WebGLProgram.h index ddd2cb0f00d..6d8f93de5c2 100644 --- a/dom/canvas/WebGLProgram.h +++ b/dom/canvas/WebGLProgram.h @@ -39,7 +39,7 @@ public: mAttachedShaders.Clear(); } - GLuint GLName() { return mGLName; } + gl::GLProgram GLName() { return mGLName; } const nsTArray >& AttachedShaders() const { return mAttachedShaders; } bool LinkStatus() { return mLinkStatus; } uint32_t Generation() const { return mGeneration.value(); } @@ -118,7 +118,7 @@ protected: DeleteOnce(); } - GLuint mGLName; + gl::GLProgram mGLName; bool mLinkStatus; // attached shaders of the program object nsTArray > mAttachedShaders; diff --git a/gfx/gl/GLBlitHelper.cpp b/gfx/gl/GLBlitHelper.cpp index 5ae43098b8c..d93bd538ce6 100644 --- a/gfx/gl/GLBlitHelper.cpp +++ b/gfx/gl/GLBlitHelper.cpp @@ -281,7 +281,7 @@ GLBlitHelper::InitTexQuadProgram(BlitType target) bool success = false; - GLuint *programPtr; + gl::GLProgram *programPtr; GLuint *fragShaderPtr; const char* fragShaderSource; switch (target) { @@ -311,7 +311,7 @@ GLBlitHelper::InitTexQuadProgram(BlitType target) return false; } - GLuint& program = *programPtr; + gl::GLProgram& program = *programPtr; GLuint& fragShader = *fragShaderPtr; // Use do-while(false) to let us break on failure @@ -519,11 +519,11 @@ GLBlitHelper::DeleteTexBlitProgram() } if (mTex2DBlit_Program) { mGL->fDeleteProgram(mTex2DBlit_Program); - mTex2DBlit_Program = 0; + mTex2DBlit_Program = GLProgram(0); } if (mTex2DRectBlit_Program) { mGL->fDeleteProgram(mTex2DRectBlit_Program); - mTex2DRectBlit_Program = 0; + mTex2DRectBlit_Program = GLProgram(0); } if (mTexExternalBlit_FragShader) { mGL->fDeleteShader(mTexExternalBlit_FragShader); @@ -535,11 +535,11 @@ GLBlitHelper::DeleteTexBlitProgram() } if (mTexExternalBlit_Program) { mGL->fDeleteProgram(mTexExternalBlit_Program); - mTexExternalBlit_Program = 0; + mTexExternalBlit_Program = GLProgram(0); } if (mTexYUVPlanarBlit_Program) { mGL->fDeleteProgram(mTexYUVPlanarBlit_Program); - mTexYUVPlanarBlit_Program = 0; + mTexYUVPlanarBlit_Program = GLProgram(0); } } diff --git a/gfx/gl/GLBlitHelper.h b/gfx/gl/GLBlitHelper.h index 1f9c6be2586..d3b0eabbe1f 100644 --- a/gfx/gl/GLBlitHelper.h +++ b/gfx/gl/GLBlitHelper.h @@ -105,16 +105,16 @@ class GLBlitHelper MOZ_FINAL GLuint mTexBlit_VertShader; GLuint mTex2DBlit_FragShader; GLuint mTex2DRectBlit_FragShader; - GLuint mTex2DBlit_Program; - GLuint mTex2DRectBlit_Program; + gl::GLProgram mTex2DBlit_Program; + gl::GLProgram mTex2DRectBlit_Program; GLint mYFlipLoc; // Data for image blit path GLuint mTexExternalBlit_FragShader; GLuint mTexYUVPlanarBlit_FragShader; - GLuint mTexExternalBlit_Program; - GLuint mTexYUVPlanarBlit_Program; + gl::GLProgram mTexExternalBlit_Program; + gl::GLProgram mTexYUVPlanarBlit_Program; GLuint mFBO; GLuint mSrcTexY; GLuint mSrcTexCb; diff --git a/gfx/gl/GLBlitTextureImageHelper.cpp b/gfx/gl/GLBlitTextureImageHelper.cpp index 58494eb5c78..cb5696f5e9c 100644 --- a/gfx/gl/GLBlitTextureImageHelper.cpp +++ b/gfx/gl/GLBlitTextureImageHelper.cpp @@ -18,7 +18,6 @@ namespace gl { GLBlitTextureImageHelper::GLBlitTextureImageHelper(GLContext* gl) : mGL(gl) - , mBlitProgram(0) , mBlitFramebuffer(0) { diff --git a/gfx/gl/GLBlitTextureImageHelper.h b/gfx/gl/GLBlitTextureImageHelper.h index edc1b875a9a..48e532936ab 100644 --- a/gfx/gl/GLBlitTextureImageHelper.h +++ b/gfx/gl/GLBlitTextureImageHelper.h @@ -25,7 +25,8 @@ class GLBlitTextureImageHelper MOZ_FINAL GLContext* mGL; // lazy-initialized things - GLuint mBlitProgram, mBlitFramebuffer; + GLProgram mBlitProgram; + GLuint mBlitFramebuffer; void UseBlitProgram(); void SetBlitFramebufferForDestTexture(GLuint aTexture); diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h index 409c0de8472..a088aef81dc 100644 --- a/gfx/gl/GLContext.h +++ b/gfx/gl/GLContext.h @@ -746,9 +746,9 @@ public: AFTER_GL_CALL; } - void fAttachShader(GLuint program, GLuint shader) { + void fAttachShader(GLProgram program, GLuint shader) { BEFORE_GL_CALL; - mSymbols.fAttachShader(program, shader); + mSymbols.fAttachShader(program.Name(), shader); AFTER_GL_CALL; } @@ -759,9 +759,9 @@ public: AFTER_GL_CALL; } - void fBindAttribLocation(GLuint program, GLuint index, const GLchar* name) { + void fBindAttribLocation(GLProgram program, GLuint index, const GLchar* name) { BEFORE_GL_CALL; - mSymbols.fBindAttribLocation(program, index, name); + mSymbols.fBindAttribLocation(program.Name(), index, name); AFTER_GL_CALL; } @@ -966,9 +966,9 @@ public: AFTER_GL_CALL; } - void fDetachShader(GLuint program, GLuint shader) { + void fDetachShader(GLProgram program, GLuint shader) { BEFORE_GL_CALL; - mSymbols.fDetachShader(program, shader); + mSymbols.fDetachShader(program.Name(), shader); AFTER_GL_CALL; } @@ -1077,27 +1077,27 @@ public: AFTER_GL_CALL; } - void fGetActiveAttrib(GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { + void fGetActiveAttrib(GLProgram program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { BEFORE_GL_CALL; - mSymbols.fGetActiveAttrib(program, index, maxLength, length, size, type, name); + mSymbols.fGetActiveAttrib(program.Name(), index, maxLength, length, size, type, name); AFTER_GL_CALL; } - void fGetActiveUniform(GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { + void fGetActiveUniform(GLProgram program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { BEFORE_GL_CALL; - mSymbols.fGetActiveUniform(program, index, maxLength, length, size, type, name); + mSymbols.fGetActiveUniform(program.Name(), index, maxLength, length, size, type, name); AFTER_GL_CALL; } - void fGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei* count, GLuint* shaders) { + void fGetAttachedShaders(GLProgram program, GLsizei maxCount, GLsizei* count, GLuint* shaders) { BEFORE_GL_CALL; - mSymbols.fGetAttachedShaders(program, maxCount, count, shaders); + mSymbols.fGetAttachedShaders(program.Name(), maxCount, count, shaders); AFTER_GL_CALL; } - GLint fGetAttribLocation(GLuint program, const GLchar* name) { + GLint fGetAttribLocation(GLProgram program, const GLchar* name) { BEFORE_GL_CALL; - GLint retval = mSymbols.fGetAttribLocation(program, name); + GLint retval = mSymbols.fGetAttribLocation(program.Name(), name); AFTER_GL_CALL; return retval; } @@ -1166,6 +1166,14 @@ public: } } + void fGetIntegerv(GLenum pname, GLProgram *params) { + MOZ_ASSERT(pname == LOCAL_GL_CURRENT_PROGRAM, "GetIntegerv(int, GLProgram*) must be called for LOCAL_GL_CURRENT_PROGRAM"); + + GLint name; + fGetIntegerv(pname, &name); + *params = GLProgram(name); + } + void GetUIntegerv(GLenum pname, GLuint *params) { fGetIntegerv(pname, reinterpret_cast(params)); } @@ -2011,10 +2019,10 @@ private: } public: - GLuint fCreateProgram() { + GLProgram fCreateProgram() { GLuint ret = raw_fCreateProgram(); TRACKING_CONTEXT(CreatedProgram(this, ret)); - return ret; + return GLProgram(ret); } GLuint fCreateShader(GLenum t) { diff --git a/gfx/gl/GLReadTexImageHelper.cpp b/gfx/gl/GLReadTexImageHelper.cpp index 3c8223ad468..91c3c094c78 100644 --- a/gfx/gl/GLReadTexImageHelper.cpp +++ b/gfx/gl/GLReadTexImageHelper.cpp @@ -23,10 +23,6 @@ using namespace mozilla::gfx; GLReadTexImageHelper::GLReadTexImageHelper(GLContext* gl) : mGL(gl) { - mPrograms[0] = 0; - mPrograms[1] = 0; - mPrograms[2] = 0; - mPrograms[3] = 0; } GLReadTexImageHelper::~GLReadTexImageHelper() @@ -83,7 +79,7 @@ readTextureImageFS_TEXTURE_RECTANGLE[] = "uniform sampler2DRect uTexture;\n" "void main() { gl_FragColor = texture2DRect(uTexture, vTexCoord).bgra; }"; -GLuint +GLProgram GLReadTexImageHelper::TextureImageProgramFor(GLenum aTextureTarget, int aConfig) { @@ -118,7 +114,7 @@ GLReadTexImageHelper::TextureImageProgramFor(GLenum aTextureTarget, mGL->fShaderSource(fs, 1, &readTextureImageFS, nullptr); mGL->fCompileShader(fs); - GLuint program = mGL->fCreateProgram(); + GLProgram program = mGL->fCreateProgram(); mGL->fAttachShader(program, vs); mGL->fAttachShader(program, fs); mGL->fBindAttribLocation(program, 0, "aVertex"); @@ -130,7 +126,7 @@ GLReadTexImageHelper::TextureImageProgramFor(GLenum aTextureTarget, if (!success) { mGL->fDeleteProgram(program); - program = 0; + program = GLProgram(0); } mGL->fDeleteShader(vs); @@ -621,7 +617,8 @@ GLReadTexImageHelper::ReadTexImage(GLuint aTextureId, SurfaceFormat::R8G8B8A8, stride); - GLint oldrb, oldfb, oldprog, oldTexUnit, oldTex; + GLint oldrb, oldfb, oldTexUnit, oldTex; + GLProgram oldprog; GLuint rb, fb; do { @@ -669,7 +666,7 @@ GLReadTexImageHelper::ReadTexImage(GLuint aTextureId, MOZ_ASSERT(mGL->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER) == LOCAL_GL_FRAMEBUFFER_COMPLETE); /* Setup vertex and fragment shader */ - GLuint program = TextureImageProgramFor(aTextureTarget, aConfig); + GLProgram program = TextureImageProgramFor(aTextureTarget, aConfig); MOZ_ASSERT(program); mGL->fUseProgram(program); diff --git a/gfx/gl/GLReadTexImageHelper.h b/gfx/gl/GLReadTexImageHelper.h index 38f4ca3bfc7..621f2185f20 100644 --- a/gfx/gl/GLReadTexImageHelper.h +++ b/gfx/gl/GLReadTexImageHelper.h @@ -33,9 +33,9 @@ class GLReadTexImageHelper MOZ_FINAL // The GLContext is the sole owner of the GLBlitHelper. GLContext* mGL; - GLuint mPrograms[4]; + GLProgram mPrograms[4]; - GLuint TextureImageProgramFor(GLenum aTextureTarget, int aShader); + GLProgram TextureImageProgramFor(GLenum aTextureTarget, int aShader); bool DidGLErrorOccur(const char* str); diff --git a/gfx/gl/GLTypes.h b/gfx/gl/GLTypes.h index b155d2e12ac..9ae58270179 100644 --- a/gfx/gl/GLTypes.h +++ b/gfx/gl/GLTypes.h @@ -50,6 +50,66 @@ typedef intptr_t GLintptr; #endif /* #if !defined(__gltypes_h_) && !defined(__gl_h_) */ +namespace mozilla { +namespace gl { + +enum { + BufferObject, + ShaderObject, + ProgramObject, + ProgramPipelineObject, + TextureObject, + SamplerObject, + RenderbufferObject, + FramebufferObject, + VertexArrayObject, + TransformFeedbackObject, + QueryObject, + SyncObject, +}; + +// Generic GL object handles +/* + * Each GL object type has an associated strongly-typed handle type. + * By default the handles are initialized to the zero OpenGL name but if + * need be can be explicitely initialized to a specific name. + * Some exmaples: + * GLTexture tex; // tex is 0 + * tex = 42 // error + * tex = GLTexture(42); // tex is 42 + * tex = GLTexture(); // tex is 0 again + * + * void f(GLTexture tex); + * f(tex); // ok + * f(42); // error + * f(GLTexture()) // ok, it is the 0 handle + */ + +template +struct ObjectHandle +{ + ObjectHandle(): mName(0) {} + + // The explicit here is to prevent automatic conversions when calling functions + explicit ObjectHandle(GLuint name): mName(name) {} + + operator bool() const { + return mName != 0; + } + + GLuint Name() const { + return mName; + } + +private: + GLuint mName; +}; + +typedef ObjectHandle GLProgram; + +} +} + #include // ARB_sync diff --git a/gfx/gl/SkiaGLGlue.cpp b/gfx/gl/SkiaGLGlue.cpp index 8ea66d55892..50b3bec0df7 100755 --- a/gfx/gl/SkiaGLGlue.cpp +++ b/gfx/gl/SkiaGLGlue.cpp @@ -56,12 +56,12 @@ GrGLvoid glActiveTexture_mozilla(GrGLenum texture) GrGLvoid glAttachShader_mozilla(GrGLuint program, GrGLuint shader) { - return sGLContext.get()->fAttachShader(program, shader); + return sGLContext.get()->fAttachShader(mozilla::gl::GLProgram(program), shader); } GrGLvoid glBindAttribLocation_mozilla(GrGLuint program, GrGLuint index, const GLchar* name) { - return sGLContext.get()->fBindAttribLocation(program, index, name); + return sGLContext.get()->fBindAttribLocation(mozilla::gl::GLProgram(program), index, name); } GrGLvoid glBindBuffer_mozilla(GrGLenum target, GrGLuint buffer) @@ -142,7 +142,7 @@ GrGLvoid glCopyTexSubImage2D_mozilla(GrGLenum target, GrGLint level, GrGLint xof GrGLuint glCreateProgram_mozilla(void) { - return sGLContext.get()->fCreateProgram(); + return sGLContext.get()->fCreateProgram().Name(); } GrGLuint glCreateShader_mozilla(GrGLenum type) @@ -167,7 +167,7 @@ GrGLvoid glDeleteFramebuffers_mozilla(GrGLsizei n, const GrGLuint* framebuffers) GrGLvoid glDeleteProgram_mozilla(GrGLuint program) { - return sGLContext.get()->fDeleteProgram(program); + return sGLContext.get()->fDeleteProgram(mozilla::gl::GLProgram(program)); } GrGLvoid glDeleteRenderbuffers_mozilla(GrGLsizei n, const GrGLuint* renderbuffers) @@ -292,12 +292,12 @@ GrGLvoid glGetIntegerv_mozilla(GrGLenum pname, GrGLint* params) GrGLvoid glGetProgramInfoLog_mozilla(GrGLuint program, GrGLsizei bufsize, GrGLsizei* length, char* infolog) { - return sGLContext.get()->fGetProgramInfoLog(program, bufsize, length, infolog); + return sGLContext.get()->fGetProgramInfoLog(mozilla::gl::GLProgram(program), bufsize, length, infolog); } GrGLvoid glGetProgramiv_mozilla(GrGLuint program, GrGLenum pname, GrGLint* params) { - return sGLContext.get()->fGetProgramiv(program, pname, params); + return sGLContext.get()->fGetProgramiv(mozilla::gl::GLProgram(program), pname, params); } GrGLvoid glGetRenderbufferParameteriv_mozilla(GrGLenum target, GrGLenum pname, GrGLint* params) @@ -396,7 +396,7 @@ const GLubyte* glGetString_mozilla(GrGLenum name) GrGLint glGetUniformLocation_mozilla(GrGLuint program, const char* name) { - return sGLContext.get()->fGetUniformLocation(program, name); + return sGLContext.get()->fGetUniformLocation(mozilla::gl::GLProgram(program), name); } GrGLvoid glLineWidth_mozilla(GrGLfloat width) @@ -406,7 +406,7 @@ GrGLvoid glLineWidth_mozilla(GrGLfloat width) GrGLvoid glLinkProgram_mozilla(GrGLuint program) { - return sGLContext.get()->fLinkProgram(program); + return sGLContext.get()->fLinkProgram(mozilla::gl::GLProgram(program)); } GrGLvoid glPixelStorei_mozilla(GrGLenum pname, GrGLint param) @@ -578,7 +578,7 @@ GrGLvoid glUniformMatrix4fv_mozilla(GrGLint location, GrGLsizei count, GrGLboole GrGLvoid glUseProgram_mozilla(GrGLuint program) { - return sGLContext.get()->fUseProgram(program); + return sGLContext.get()->fUseProgram(mozilla::gl::GLProgram(program)); } GrGLvoid glVertexAttrib4fv_mozilla(GrGLuint index, const GrGLfloat* values) diff --git a/gfx/layers/opengl/OGLShaderProgram.cpp b/gfx/layers/opengl/OGLShaderProgram.cpp index d15d9c703bf..df2b1779a91 100644 --- a/gfx/layers/opengl/OGLShaderProgram.cpp +++ b/gfx/layers/opengl/OGLShaderProgram.cpp @@ -486,7 +486,7 @@ ShaderProgramOGL::CreateProgram(const char *aVertexShaderString, if (!vertexShader || !fragmentShader) return false; - GLint result = mGL->fCreateProgram(); + gl::GLProgram result = mGL->fCreateProgram(); mGL->fAttachShader(result, vertexShader); mGL->fAttachShader(result, fragmentShader); diff --git a/gfx/layers/opengl/OGLShaderProgram.h b/gfx/layers/opengl/OGLShaderProgram.h index 097869c56b8..aef66540590 100644 --- a/gfx/layers/opengl/OGLShaderProgram.h +++ b/gfx/layers/opengl/OGLShaderProgram.h @@ -237,7 +237,7 @@ struct ProgramProfileOGL do { \ GLuint currentProgram; \ mGL->GetUIntegerv(LOCAL_GL_CURRENT_PROGRAM, ¤tProgram); \ - NS_ASSERTION(currentProgram == mProgram, \ + NS_ASSERTION(gl::GLProgram(currentProgram) == mProgram, \ "SetUniform with wrong program active!"); \ } while (0) #else @@ -387,7 +387,7 @@ public: protected: RefPtr mGL; // the OpenGL id of the program - GLuint mProgram; + gl::GLProgram mProgram; ProgramProfileOGL mProfile; enum { STATE_NEW, From 440b819fa422329385321d6ba9946ca8408798a2 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Tue, 5 Aug 2014 14:07:11 +0200 Subject: [PATCH 07/60] Bug 1048859 - Bump version of mozlog to 2.2.1; r=jgraham --HG-- extra : rebase_source : ee125df12d629b84e9989b5e45071e5b748f98b8 --- testing/mozbase/mozlog/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/mozbase/mozlog/setup.py b/testing/mozbase/mozlog/setup.py index 0cd067f6d12..74f93a7ed9c 100644 --- a/testing/mozbase/mozlog/setup.py +++ b/testing/mozbase/mozlog/setup.py @@ -5,7 +5,7 @@ from setuptools import setup, find_packages PACKAGE_NAME = 'mozlog' -PACKAGE_VERSION = '2.2' +PACKAGE_VERSION = '2.2.1' setup(name=PACKAGE_NAME, version=PACKAGE_VERSION, From a8b0422efe1fb7cabc5e58799d0def41e707ba7f Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Tue, 5 Aug 2014 13:25:40 +0100 Subject: [PATCH 08/60] Backed out changeset b4c58f7a3d4b (bug 1039950) for Windows warnings as errors failures --- dom/canvas/WebGLContextGL.cpp | 22 +++++----- dom/canvas/WebGLProgram.h | 4 +- gfx/gl/GLBlitHelper.cpp | 12 +++--- gfx/gl/GLBlitHelper.h | 8 ++-- gfx/gl/GLBlitTextureImageHelper.cpp | 1 + gfx/gl/GLBlitTextureImageHelper.h | 3 +- gfx/gl/GLContext.h | 40 +++++++---------- gfx/gl/GLReadTexImageHelper.cpp | 15 ++++--- gfx/gl/GLReadTexImageHelper.h | 4 +- gfx/gl/GLTypes.h | 60 -------------------------- gfx/gl/SkiaGLGlue.cpp | 18 ++++---- gfx/layers/opengl/OGLShaderProgram.cpp | 2 +- gfx/layers/opengl/OGLShaderProgram.h | 4 +- 13 files changed, 64 insertions(+), 129 deletions(-) diff --git a/dom/canvas/WebGLContextGL.cpp b/dom/canvas/WebGLContextGL.cpp index c8fcbb19126..27e9b6d95a9 100644 --- a/dom/canvas/WebGLContextGL.cpp +++ b/dom/canvas/WebGLContextGL.cpp @@ -130,7 +130,7 @@ WebGLContext::BindAttribLocation(WebGLProgram *prog, GLuint location, if (!ValidateObject("bindAttribLocation: program", prog)) return; - GLProgram progname = prog->GLName(); + GLuint progname = prog->GLName(); if (!ValidateGLSLVariableName(name, "bindAttribLocation")) return; @@ -855,7 +855,7 @@ WebGLContext::GetActiveAttrib(WebGLProgram *prog, uint32_t index) MakeContextCurrent(); GLint len = 0; - GLProgram progname = prog->GLName();; + GLuint progname = prog->GLName();; gl->fGetProgramiv(progname, LOCAL_GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); if (len == 0) return nullptr; @@ -946,7 +946,7 @@ WebGLContext::GetActiveUniform(WebGLProgram *prog, uint32_t index) MakeContextCurrent(); GLint len = 0; - GLProgram progname = prog->GLName(); + GLuint progname = prog->GLName(); gl->fGetProgramiv(progname, LOCAL_GL_ACTIVE_UNIFORM_MAX_LENGTH, &len); if (len == 0) return nullptr; @@ -1024,7 +1024,7 @@ WebGLContext::GetAttribLocation(WebGLProgram *prog, const nsAString& name) nsCString mappedName; prog->MapIdentifier(cname, &mappedName); - GLProgram progname = prog->GLName(); + GLuint progname = prog->GLName(); MakeContextCurrent(); return gl->fGetAttribLocation(progname, mappedName.get()); @@ -1372,7 +1372,7 @@ WebGLContext::GetProgramParameter(WebGLProgram *prog, GLenum pname) if (!ValidateObjectAllowDeleted("getProgramParameter: program", prog)) return JS::NullValue(); - GLProgram progname = prog->GLName(); + GLuint progname = prog->GLName(); MakeContextCurrent(); @@ -1439,7 +1439,7 @@ WebGLContext::GetProgramInfoLog(WebGLProgram *prog, nsACString& retval) return; } - GLProgram progname = prog->GLName(); + GLuint progname = prog->GLName(); MakeContextCurrent(); @@ -1638,7 +1638,7 @@ WebGLContext::GetUniform(JSContext* cx, WebGLProgram *prog, return JS::NullValue(); } - GLProgram progname = prog->GLName(); + GLuint progname = prog->GLName(); MakeContextCurrent(); @@ -1768,7 +1768,7 @@ WebGLContext::GetUniformLocation(WebGLProgram *prog, const nsAString& name) nsCString mappedName; prog->MapIdentifier(cname, &mappedName); - GLProgram progname = prog->GLName(); + GLuint progname = prog->GLName(); MakeContextCurrent(); GLint intlocation = gl->fGetUniformLocation(progname, mappedName.get()); @@ -1902,7 +1902,7 @@ WebGLContext::LinkProgram(WebGLProgram *program) InvalidateBufferFetching(); // we do it early in this function // as some of the validation below changes program state - GLProgram progname = program->GLName(); + GLuint progname = program->GLName(); if (!program->NextGeneration()) { // XXX throw? @@ -2919,7 +2919,7 @@ WebGLContext::UseProgram(WebGLProgram *prog) InvalidateBufferFetching(); - GLProgram progname = prog ? prog->GLName() : GLProgram(0); + GLuint progname = prog ? prog->GLName() : 0; if (prog && !prog->LinkStatus()) return ErrorInvalidOperation("useProgram: program was not linked successfully"); @@ -2948,7 +2948,7 @@ WebGLContext::ValidateProgram(WebGLProgram *prog) } #endif - GLProgram progname = prog->GLName(); + GLuint progname = prog->GLName(); gl->fValidateProgram(progname); } diff --git a/dom/canvas/WebGLProgram.h b/dom/canvas/WebGLProgram.h index 6d8f93de5c2..ddd2cb0f00d 100644 --- a/dom/canvas/WebGLProgram.h +++ b/dom/canvas/WebGLProgram.h @@ -39,7 +39,7 @@ public: mAttachedShaders.Clear(); } - gl::GLProgram GLName() { return mGLName; } + GLuint GLName() { return mGLName; } const nsTArray >& AttachedShaders() const { return mAttachedShaders; } bool LinkStatus() { return mLinkStatus; } uint32_t Generation() const { return mGeneration.value(); } @@ -118,7 +118,7 @@ protected: DeleteOnce(); } - gl::GLProgram mGLName; + GLuint mGLName; bool mLinkStatus; // attached shaders of the program object nsTArray > mAttachedShaders; diff --git a/gfx/gl/GLBlitHelper.cpp b/gfx/gl/GLBlitHelper.cpp index d93bd538ce6..5ae43098b8c 100644 --- a/gfx/gl/GLBlitHelper.cpp +++ b/gfx/gl/GLBlitHelper.cpp @@ -281,7 +281,7 @@ GLBlitHelper::InitTexQuadProgram(BlitType target) bool success = false; - gl::GLProgram *programPtr; + GLuint *programPtr; GLuint *fragShaderPtr; const char* fragShaderSource; switch (target) { @@ -311,7 +311,7 @@ GLBlitHelper::InitTexQuadProgram(BlitType target) return false; } - gl::GLProgram& program = *programPtr; + GLuint& program = *programPtr; GLuint& fragShader = *fragShaderPtr; // Use do-while(false) to let us break on failure @@ -519,11 +519,11 @@ GLBlitHelper::DeleteTexBlitProgram() } if (mTex2DBlit_Program) { mGL->fDeleteProgram(mTex2DBlit_Program); - mTex2DBlit_Program = GLProgram(0); + mTex2DBlit_Program = 0; } if (mTex2DRectBlit_Program) { mGL->fDeleteProgram(mTex2DRectBlit_Program); - mTex2DRectBlit_Program = GLProgram(0); + mTex2DRectBlit_Program = 0; } if (mTexExternalBlit_FragShader) { mGL->fDeleteShader(mTexExternalBlit_FragShader); @@ -535,11 +535,11 @@ GLBlitHelper::DeleteTexBlitProgram() } if (mTexExternalBlit_Program) { mGL->fDeleteProgram(mTexExternalBlit_Program); - mTexExternalBlit_Program = GLProgram(0); + mTexExternalBlit_Program = 0; } if (mTexYUVPlanarBlit_Program) { mGL->fDeleteProgram(mTexYUVPlanarBlit_Program); - mTexYUVPlanarBlit_Program = GLProgram(0); + mTexYUVPlanarBlit_Program = 0; } } diff --git a/gfx/gl/GLBlitHelper.h b/gfx/gl/GLBlitHelper.h index d3b0eabbe1f..1f9c6be2586 100644 --- a/gfx/gl/GLBlitHelper.h +++ b/gfx/gl/GLBlitHelper.h @@ -105,16 +105,16 @@ class GLBlitHelper MOZ_FINAL GLuint mTexBlit_VertShader; GLuint mTex2DBlit_FragShader; GLuint mTex2DRectBlit_FragShader; - gl::GLProgram mTex2DBlit_Program; - gl::GLProgram mTex2DRectBlit_Program; + GLuint mTex2DBlit_Program; + GLuint mTex2DRectBlit_Program; GLint mYFlipLoc; // Data for image blit path GLuint mTexExternalBlit_FragShader; GLuint mTexYUVPlanarBlit_FragShader; - gl::GLProgram mTexExternalBlit_Program; - gl::GLProgram mTexYUVPlanarBlit_Program; + GLuint mTexExternalBlit_Program; + GLuint mTexYUVPlanarBlit_Program; GLuint mFBO; GLuint mSrcTexY; GLuint mSrcTexCb; diff --git a/gfx/gl/GLBlitTextureImageHelper.cpp b/gfx/gl/GLBlitTextureImageHelper.cpp index cb5696f5e9c..58494eb5c78 100644 --- a/gfx/gl/GLBlitTextureImageHelper.cpp +++ b/gfx/gl/GLBlitTextureImageHelper.cpp @@ -18,6 +18,7 @@ namespace gl { GLBlitTextureImageHelper::GLBlitTextureImageHelper(GLContext* gl) : mGL(gl) + , mBlitProgram(0) , mBlitFramebuffer(0) { diff --git a/gfx/gl/GLBlitTextureImageHelper.h b/gfx/gl/GLBlitTextureImageHelper.h index 48e532936ab..edc1b875a9a 100644 --- a/gfx/gl/GLBlitTextureImageHelper.h +++ b/gfx/gl/GLBlitTextureImageHelper.h @@ -25,8 +25,7 @@ class GLBlitTextureImageHelper MOZ_FINAL GLContext* mGL; // lazy-initialized things - GLProgram mBlitProgram; - GLuint mBlitFramebuffer; + GLuint mBlitProgram, mBlitFramebuffer; void UseBlitProgram(); void SetBlitFramebufferForDestTexture(GLuint aTexture); diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h index a088aef81dc..409c0de8472 100644 --- a/gfx/gl/GLContext.h +++ b/gfx/gl/GLContext.h @@ -746,9 +746,9 @@ public: AFTER_GL_CALL; } - void fAttachShader(GLProgram program, GLuint shader) { + void fAttachShader(GLuint program, GLuint shader) { BEFORE_GL_CALL; - mSymbols.fAttachShader(program.Name(), shader); + mSymbols.fAttachShader(program, shader); AFTER_GL_CALL; } @@ -759,9 +759,9 @@ public: AFTER_GL_CALL; } - void fBindAttribLocation(GLProgram program, GLuint index, const GLchar* name) { + void fBindAttribLocation(GLuint program, GLuint index, const GLchar* name) { BEFORE_GL_CALL; - mSymbols.fBindAttribLocation(program.Name(), index, name); + mSymbols.fBindAttribLocation(program, index, name); AFTER_GL_CALL; } @@ -966,9 +966,9 @@ public: AFTER_GL_CALL; } - void fDetachShader(GLProgram program, GLuint shader) { + void fDetachShader(GLuint program, GLuint shader) { BEFORE_GL_CALL; - mSymbols.fDetachShader(program.Name(), shader); + mSymbols.fDetachShader(program, shader); AFTER_GL_CALL; } @@ -1077,27 +1077,27 @@ public: AFTER_GL_CALL; } - void fGetActiveAttrib(GLProgram program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { + void fGetActiveAttrib(GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { BEFORE_GL_CALL; - mSymbols.fGetActiveAttrib(program.Name(), index, maxLength, length, size, type, name); + mSymbols.fGetActiveAttrib(program, index, maxLength, length, size, type, name); AFTER_GL_CALL; } - void fGetActiveUniform(GLProgram program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { + void fGetActiveUniform(GLuint program, GLuint index, GLsizei maxLength, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { BEFORE_GL_CALL; - mSymbols.fGetActiveUniform(program.Name(), index, maxLength, length, size, type, name); + mSymbols.fGetActiveUniform(program, index, maxLength, length, size, type, name); AFTER_GL_CALL; } - void fGetAttachedShaders(GLProgram program, GLsizei maxCount, GLsizei* count, GLuint* shaders) { + void fGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei* count, GLuint* shaders) { BEFORE_GL_CALL; - mSymbols.fGetAttachedShaders(program.Name(), maxCount, count, shaders); + mSymbols.fGetAttachedShaders(program, maxCount, count, shaders); AFTER_GL_CALL; } - GLint fGetAttribLocation(GLProgram program, const GLchar* name) { + GLint fGetAttribLocation(GLuint program, const GLchar* name) { BEFORE_GL_CALL; - GLint retval = mSymbols.fGetAttribLocation(program.Name(), name); + GLint retval = mSymbols.fGetAttribLocation(program, name); AFTER_GL_CALL; return retval; } @@ -1166,14 +1166,6 @@ public: } } - void fGetIntegerv(GLenum pname, GLProgram *params) { - MOZ_ASSERT(pname == LOCAL_GL_CURRENT_PROGRAM, "GetIntegerv(int, GLProgram*) must be called for LOCAL_GL_CURRENT_PROGRAM"); - - GLint name; - fGetIntegerv(pname, &name); - *params = GLProgram(name); - } - void GetUIntegerv(GLenum pname, GLuint *params) { fGetIntegerv(pname, reinterpret_cast(params)); } @@ -2019,10 +2011,10 @@ private: } public: - GLProgram fCreateProgram() { + GLuint fCreateProgram() { GLuint ret = raw_fCreateProgram(); TRACKING_CONTEXT(CreatedProgram(this, ret)); - return GLProgram(ret); + return ret; } GLuint fCreateShader(GLenum t) { diff --git a/gfx/gl/GLReadTexImageHelper.cpp b/gfx/gl/GLReadTexImageHelper.cpp index 91c3c094c78..3c8223ad468 100644 --- a/gfx/gl/GLReadTexImageHelper.cpp +++ b/gfx/gl/GLReadTexImageHelper.cpp @@ -23,6 +23,10 @@ using namespace mozilla::gfx; GLReadTexImageHelper::GLReadTexImageHelper(GLContext* gl) : mGL(gl) { + mPrograms[0] = 0; + mPrograms[1] = 0; + mPrograms[2] = 0; + mPrograms[3] = 0; } GLReadTexImageHelper::~GLReadTexImageHelper() @@ -79,7 +83,7 @@ readTextureImageFS_TEXTURE_RECTANGLE[] = "uniform sampler2DRect uTexture;\n" "void main() { gl_FragColor = texture2DRect(uTexture, vTexCoord).bgra; }"; -GLProgram +GLuint GLReadTexImageHelper::TextureImageProgramFor(GLenum aTextureTarget, int aConfig) { @@ -114,7 +118,7 @@ GLReadTexImageHelper::TextureImageProgramFor(GLenum aTextureTarget, mGL->fShaderSource(fs, 1, &readTextureImageFS, nullptr); mGL->fCompileShader(fs); - GLProgram program = mGL->fCreateProgram(); + GLuint program = mGL->fCreateProgram(); mGL->fAttachShader(program, vs); mGL->fAttachShader(program, fs); mGL->fBindAttribLocation(program, 0, "aVertex"); @@ -126,7 +130,7 @@ GLReadTexImageHelper::TextureImageProgramFor(GLenum aTextureTarget, if (!success) { mGL->fDeleteProgram(program); - program = GLProgram(0); + program = 0; } mGL->fDeleteShader(vs); @@ -617,8 +621,7 @@ GLReadTexImageHelper::ReadTexImage(GLuint aTextureId, SurfaceFormat::R8G8B8A8, stride); - GLint oldrb, oldfb, oldTexUnit, oldTex; - GLProgram oldprog; + GLint oldrb, oldfb, oldprog, oldTexUnit, oldTex; GLuint rb, fb; do { @@ -666,7 +669,7 @@ GLReadTexImageHelper::ReadTexImage(GLuint aTextureId, MOZ_ASSERT(mGL->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER) == LOCAL_GL_FRAMEBUFFER_COMPLETE); /* Setup vertex and fragment shader */ - GLProgram program = TextureImageProgramFor(aTextureTarget, aConfig); + GLuint program = TextureImageProgramFor(aTextureTarget, aConfig); MOZ_ASSERT(program); mGL->fUseProgram(program); diff --git a/gfx/gl/GLReadTexImageHelper.h b/gfx/gl/GLReadTexImageHelper.h index 621f2185f20..38f4ca3bfc7 100644 --- a/gfx/gl/GLReadTexImageHelper.h +++ b/gfx/gl/GLReadTexImageHelper.h @@ -33,9 +33,9 @@ class GLReadTexImageHelper MOZ_FINAL // The GLContext is the sole owner of the GLBlitHelper. GLContext* mGL; - GLProgram mPrograms[4]; + GLuint mPrograms[4]; - GLProgram TextureImageProgramFor(GLenum aTextureTarget, int aShader); + GLuint TextureImageProgramFor(GLenum aTextureTarget, int aShader); bool DidGLErrorOccur(const char* str); diff --git a/gfx/gl/GLTypes.h b/gfx/gl/GLTypes.h index 9ae58270179..b155d2e12ac 100644 --- a/gfx/gl/GLTypes.h +++ b/gfx/gl/GLTypes.h @@ -50,66 +50,6 @@ typedef intptr_t GLintptr; #endif /* #if !defined(__gltypes_h_) && !defined(__gl_h_) */ -namespace mozilla { -namespace gl { - -enum { - BufferObject, - ShaderObject, - ProgramObject, - ProgramPipelineObject, - TextureObject, - SamplerObject, - RenderbufferObject, - FramebufferObject, - VertexArrayObject, - TransformFeedbackObject, - QueryObject, - SyncObject, -}; - -// Generic GL object handles -/* - * Each GL object type has an associated strongly-typed handle type. - * By default the handles are initialized to the zero OpenGL name but if - * need be can be explicitely initialized to a specific name. - * Some exmaples: - * GLTexture tex; // tex is 0 - * tex = 42 // error - * tex = GLTexture(42); // tex is 42 - * tex = GLTexture(); // tex is 0 again - * - * void f(GLTexture tex); - * f(tex); // ok - * f(42); // error - * f(GLTexture()) // ok, it is the 0 handle - */ - -template -struct ObjectHandle -{ - ObjectHandle(): mName(0) {} - - // The explicit here is to prevent automatic conversions when calling functions - explicit ObjectHandle(GLuint name): mName(name) {} - - operator bool() const { - return mName != 0; - } - - GLuint Name() const { - return mName; - } - -private: - GLuint mName; -}; - -typedef ObjectHandle GLProgram; - -} -} - #include // ARB_sync diff --git a/gfx/gl/SkiaGLGlue.cpp b/gfx/gl/SkiaGLGlue.cpp index 50b3bec0df7..8ea66d55892 100755 --- a/gfx/gl/SkiaGLGlue.cpp +++ b/gfx/gl/SkiaGLGlue.cpp @@ -56,12 +56,12 @@ GrGLvoid glActiveTexture_mozilla(GrGLenum texture) GrGLvoid glAttachShader_mozilla(GrGLuint program, GrGLuint shader) { - return sGLContext.get()->fAttachShader(mozilla::gl::GLProgram(program), shader); + return sGLContext.get()->fAttachShader(program, shader); } GrGLvoid glBindAttribLocation_mozilla(GrGLuint program, GrGLuint index, const GLchar* name) { - return sGLContext.get()->fBindAttribLocation(mozilla::gl::GLProgram(program), index, name); + return sGLContext.get()->fBindAttribLocation(program, index, name); } GrGLvoid glBindBuffer_mozilla(GrGLenum target, GrGLuint buffer) @@ -142,7 +142,7 @@ GrGLvoid glCopyTexSubImage2D_mozilla(GrGLenum target, GrGLint level, GrGLint xof GrGLuint glCreateProgram_mozilla(void) { - return sGLContext.get()->fCreateProgram().Name(); + return sGLContext.get()->fCreateProgram(); } GrGLuint glCreateShader_mozilla(GrGLenum type) @@ -167,7 +167,7 @@ GrGLvoid glDeleteFramebuffers_mozilla(GrGLsizei n, const GrGLuint* framebuffers) GrGLvoid glDeleteProgram_mozilla(GrGLuint program) { - return sGLContext.get()->fDeleteProgram(mozilla::gl::GLProgram(program)); + return sGLContext.get()->fDeleteProgram(program); } GrGLvoid glDeleteRenderbuffers_mozilla(GrGLsizei n, const GrGLuint* renderbuffers) @@ -292,12 +292,12 @@ GrGLvoid glGetIntegerv_mozilla(GrGLenum pname, GrGLint* params) GrGLvoid glGetProgramInfoLog_mozilla(GrGLuint program, GrGLsizei bufsize, GrGLsizei* length, char* infolog) { - return sGLContext.get()->fGetProgramInfoLog(mozilla::gl::GLProgram(program), bufsize, length, infolog); + return sGLContext.get()->fGetProgramInfoLog(program, bufsize, length, infolog); } GrGLvoid glGetProgramiv_mozilla(GrGLuint program, GrGLenum pname, GrGLint* params) { - return sGLContext.get()->fGetProgramiv(mozilla::gl::GLProgram(program), pname, params); + return sGLContext.get()->fGetProgramiv(program, pname, params); } GrGLvoid glGetRenderbufferParameteriv_mozilla(GrGLenum target, GrGLenum pname, GrGLint* params) @@ -396,7 +396,7 @@ const GLubyte* glGetString_mozilla(GrGLenum name) GrGLint glGetUniformLocation_mozilla(GrGLuint program, const char* name) { - return sGLContext.get()->fGetUniformLocation(mozilla::gl::GLProgram(program), name); + return sGLContext.get()->fGetUniformLocation(program, name); } GrGLvoid glLineWidth_mozilla(GrGLfloat width) @@ -406,7 +406,7 @@ GrGLvoid glLineWidth_mozilla(GrGLfloat width) GrGLvoid glLinkProgram_mozilla(GrGLuint program) { - return sGLContext.get()->fLinkProgram(mozilla::gl::GLProgram(program)); + return sGLContext.get()->fLinkProgram(program); } GrGLvoid glPixelStorei_mozilla(GrGLenum pname, GrGLint param) @@ -578,7 +578,7 @@ GrGLvoid glUniformMatrix4fv_mozilla(GrGLint location, GrGLsizei count, GrGLboole GrGLvoid glUseProgram_mozilla(GrGLuint program) { - return sGLContext.get()->fUseProgram(mozilla::gl::GLProgram(program)); + return sGLContext.get()->fUseProgram(program); } GrGLvoid glVertexAttrib4fv_mozilla(GrGLuint index, const GrGLfloat* values) diff --git a/gfx/layers/opengl/OGLShaderProgram.cpp b/gfx/layers/opengl/OGLShaderProgram.cpp index df2b1779a91..d15d9c703bf 100644 --- a/gfx/layers/opengl/OGLShaderProgram.cpp +++ b/gfx/layers/opengl/OGLShaderProgram.cpp @@ -486,7 +486,7 @@ ShaderProgramOGL::CreateProgram(const char *aVertexShaderString, if (!vertexShader || !fragmentShader) return false; - gl::GLProgram result = mGL->fCreateProgram(); + GLint result = mGL->fCreateProgram(); mGL->fAttachShader(result, vertexShader); mGL->fAttachShader(result, fragmentShader); diff --git a/gfx/layers/opengl/OGLShaderProgram.h b/gfx/layers/opengl/OGLShaderProgram.h index aef66540590..097869c56b8 100644 --- a/gfx/layers/opengl/OGLShaderProgram.h +++ b/gfx/layers/opengl/OGLShaderProgram.h @@ -237,7 +237,7 @@ struct ProgramProfileOGL do { \ GLuint currentProgram; \ mGL->GetUIntegerv(LOCAL_GL_CURRENT_PROGRAM, ¤tProgram); \ - NS_ASSERTION(gl::GLProgram(currentProgram) == mProgram, \ + NS_ASSERTION(currentProgram == mProgram, \ "SetUniform with wrong program active!"); \ } while (0) #else @@ -387,7 +387,7 @@ public: protected: RefPtr mGL; // the OpenGL id of the program - gl::GLProgram mProgram; + GLuint mProgram; ProgramProfileOGL mProfile; enum { STATE_NEW, From c4e92b4d222dab4c90c2e276b26434f506c89c33 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Tue, 5 Aug 2014 13:33:17 +0100 Subject: [PATCH 09/60] Backed out changeset 2d35b006a2f6 (bug 1042729) --- js/src/jit/MIR.h | 6 +----- js/src/jit/MIRGraph.cpp | 2 -- js/src/jit/MIRGraph.h | 14 +------------- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 61a9c82bd42..f62a2bc8a8c 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -10206,11 +10206,7 @@ class MNewDenseArrayPar : public MBinaryInstruction // A resume point contains the information needed to reconstruct the Baseline // state from a position in the JIT. See the big comment near resumeAfter() in // IonBuilder.cpp. -class MResumePoint MOZ_FINAL : - public MNode -#ifdef DEBUG - , public InlineForwardListNode -#endif +class MResumePoint MOZ_FINAL : public MNode, public InlineForwardListNode { public: enum Mode { diff --git a/js/src/jit/MIRGraph.cpp b/js/src/jit/MIRGraph.cpp index a08861b8e44..815608f9633 100644 --- a/js/src/jit/MIRGraph.cpp +++ b/js/src/jit/MIRGraph.cpp @@ -728,7 +728,6 @@ MBasicBlock::discardResumePoint(MResumePoint *rp, ReferencesType refType /* = Re { if (refType & RefType_DiscardOperands) rp->discardUses(); -#ifdef DEBUG MResumePointIterator iter = resumePointsBegin(); while (*iter != rp) { // We should reach it before reaching the end. @@ -736,7 +735,6 @@ MBasicBlock::discardResumePoint(MResumePoint *rp, ReferencesType refType /* = Re iter++; } resumePoints_.removeAt(iter); -#endif } void diff --git a/js/src/jit/MIRGraph.h b/js/src/jit/MIRGraph.h index b91a48c53f5..b2de6ec85c7 100644 --- a/js/src/jit/MIRGraph.h +++ b/js/src/jit/MIRGraph.h @@ -27,10 +27,7 @@ class MDefinitionIterator; typedef InlineListIterator MInstructionIterator; typedef InlineListReverseIterator MInstructionReverseIterator; typedef InlineListIterator MPhiIterator; - -#ifdef DEBUG typedef InlineForwardListIterator MResumePointIterator; -#endif class LBlock; @@ -187,9 +184,7 @@ class MBasicBlock : public TempObject, public InlineListNode // Adds a resume point to this block. void addResumePoint(MResumePoint *resume) { -#ifdef DEBUG resumePoints_.pushFront(resume); -#endif } // Discard pre-allocated resume point. @@ -346,7 +341,6 @@ class MBasicBlock : public TempObject, public InlineListNode bool phisEmpty() const { return phis_.empty(); } -#ifdef DEBUG MResumePointIterator resumePointsBegin() const { return resumePoints_.begin(); } @@ -356,7 +350,6 @@ class MBasicBlock : public TempObject, public InlineListNode bool resumePointsEmpty() const { return resumePoints_.empty(); } -#endif MInstructionIterator begin() { return instructions_.begin(); } @@ -569,6 +562,7 @@ class MBasicBlock : public TempObject, public InlineListNode InlineList instructions_; Vector predecessors_; InlineList phis_; + InlineForwardList resumePoints_; FixedList slots_; uint32_t stackPosition_; uint32_t id_; @@ -585,12 +579,6 @@ class MBasicBlock : public TempObject, public InlineListNode // beginning of the call-site which is being inlined after this block. MResumePoint *outerResumePoint_; -#ifdef DEBUG - // Unordered list used to verify that all the resume points which are - // registered are correctly removed when a basic block is removed. - InlineForwardList resumePoints_; -#endif - MBasicBlock *successorWithPhis_; uint32_t positionInPhiSuccessor_; uint32_t loopDepth_; From 2f71a7e4a6eb041c0e6d9bce9d0cfac32235cdad Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Tue, 5 Aug 2014 13:33:20 +0100 Subject: [PATCH 10/60] Backed out changeset 2f56127783b9 (bug 1042729) --- js/src/jit/IonAnalysis.cpp | 9 +-------- js/src/jit/IonBuilder.cpp | 1 - js/src/jit/MIRGraph.cpp | 37 +++++++++++++++---------------------- js/src/jit/MIRGraph.h | 16 ---------------- 4 files changed, 16 insertions(+), 47 deletions(-) diff --git a/js/src/jit/IonAnalysis.cpp b/js/src/jit/IonAnalysis.cpp index ccdc9fd6b46..a59b81c1b51 100644 --- a/js/src/jit/IonAnalysis.cpp +++ b/js/src/jit/IonAnalysis.cpp @@ -1744,14 +1744,7 @@ jit::AssertBasicGraphCoherency(MIRGraph &graph) for (size_t i = 0; i < block->numPredecessors(); i++) JS_ASSERT(CheckPredecessorImpliesSuccessor(*block, block->getPredecessor(i))); - if (block->entryResumePoint()) { - MOZ_ASSERT(!block->entryResumePoint()->instruction()); - MOZ_ASSERT(block->entryResumePoint()->block() == *block); - } - if (block->outerResumePoint()) { - MOZ_ASSERT(!block->outerResumePoint()->instruction()); - MOZ_ASSERT(block->outerResumePoint()->block() == *block); - } + MOZ_ASSERT_IF(block->entryResumePoint(), !block->entryResumePoint()->instruction()); for (MResumePointIterator iter(block->resumePointsBegin()); iter != block->resumePointsEnd(); iter++) { // We cannot yet assert that is there is no instruction then this is // the entry resume point because we are still storing resume points diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index c2ae3c5c6cf..0414c847efc 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -3985,7 +3985,6 @@ IonBuilder::inlineScriptedCall(CallInfo &callInfo, JSFunction *target) MResumePoint::New(alloc(), current, pc, callerResumePoint_, MResumePoint::Outer); if (!outerResumePoint) return false; - current->setOuterResumePoint(outerResumePoint); // Pop formals again, except leave |fun| on stack for duration of call. callInfo.popFormals(current); diff --git a/js/src/jit/MIRGraph.cpp b/js/src/jit/MIRGraph.cpp index 815608f9633..8a05684218b 100644 --- a/js/src/jit/MIRGraph.cpp +++ b/js/src/jit/MIRGraph.cpp @@ -105,8 +105,8 @@ MIRGraph::removeBlock(MBasicBlock *block) } } - block->discardAllInstructions(); block->discardAllResumePoints(); + block->discardAllInstructions(); // Note: phis are disconnected from the rest of the graph, but are not // removed entirely. If the block being removed is a loop header then @@ -297,7 +297,6 @@ MBasicBlock::MBasicBlock(MIRGraph &graph, CompileInfo &info, const BytecodeSite pc_(site.pc()), lir_(nullptr), entryResumePoint_(nullptr), - outerResumePoint_(nullptr), successorWithPhis_(nullptr), positionInPhiSuccessor_(0), loopDepth_(0), @@ -817,10 +816,11 @@ void MBasicBlock::discardAllInstructionsStartingAt(MInstructionIterator &iter) { while (iter != end()) { - // Discard operands and resume point operands and flag the instruction - // as discarded. Also we do not assert that we have no uses as blocks - // might be removed in reverse post order. - prepareForDiscard(*iter, RefType_DefaultNoAssert); + // We only discard operands and flag the instruction as discarded as the + // resume points are exepected to be removed separately. Also we do not + // assert that we have no uses as block might be removed in reverse post + // order. + prepareForDiscard(*iter, RefType_DiscardOperands); iter = instructions_.removeAt(iter); } } @@ -845,24 +845,17 @@ MBasicBlock::discardAllPhis() void MBasicBlock::discardAllResumePoints(bool discardEntry) { - if (outerResumePoint_) { - discardResumePoint(outerResumePoint_); - outerResumePoint_ = nullptr; + for (MResumePointIterator iter = resumePointsBegin(); iter != resumePointsEnd(); ) { + MResumePoint *rp = *iter; + if (rp == entryResumePoint() && !discardEntry) { + iter++; + } else { + rp->discardUses(); + iter = resumePoints_.removeAt(iter); + } } - - if (discardEntry && entryResumePoint_) + if (discardEntry) clearEntryResumePoint(); - -#ifdef DEBUG - if (!entryResumePoint()) { - MOZ_ASSERT(resumePointsEmpty()); - } else { - MResumePointIterator iter(resumePointsBegin()); - MOZ_ASSERT(iter != resumePointsEnd()); - iter++; - MOZ_ASSERT(iter == resumePointsEnd()); - } -#endif } void diff --git a/js/src/jit/MIRGraph.h b/js/src/jit/MIRGraph.h index b2de6ec85c7..2520b5c051d 100644 --- a/js/src/jit/MIRGraph.h +++ b/js/src/jit/MIRGraph.h @@ -478,16 +478,8 @@ class MBasicBlock : public TempObject, public InlineListNode return entryResumePoint_; } void clearEntryResumePoint() { - discardResumePoint(entryResumePoint_); entryResumePoint_ = nullptr; } - MResumePoint *outerResumePoint() const { - return outerResumePoint_; - } - void setOuterResumePoint(MResumePoint *outer) { - MOZ_ASSERT(!outerResumePoint_); - outerResumePoint_ = outer; - } MResumePoint *callerResumePoint() { return entryResumePoint()->caller(); } @@ -570,15 +562,7 @@ class MBasicBlock : public TempObject, public InlineListNode uint32_t numDominated_; jsbytecode *pc_; LBlock *lir_; - - // Resume point holding baseline-like frame for the PC corresponding to the - // entry of this basic block. MResumePoint *entryResumePoint_; - - // Resume point holding baseline-like frame for the PC corresponding to the - // beginning of the call-site which is being inlined after this block. - MResumePoint *outerResumePoint_; - MBasicBlock *successorWithPhis_; uint32_t positionInPhiSuccessor_; uint32_t loopDepth_; From 220e04a9fd70ab9ffab6f71595f7f5988b5f487e Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Tue, 5 Aug 2014 13:33:24 +0100 Subject: [PATCH 11/60] Backed out changeset 749e28d0377e (bug 1042729) --- js/src/jit/IonBuilder.cpp | 27 ++------------------------- js/src/jit/MIR.h | 7 +++---- js/src/jit/MIRGraph.cpp | 12 ++++-------- js/src/jit/MIRGraph.h | 12 ++---------- 4 files changed, 11 insertions(+), 47 deletions(-) diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index 0414c847efc..755fa078bd4 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -4321,26 +4321,6 @@ IonBuilder::inlineSingleCall(CallInfo &callInfo, JSFunction *target) return InliningStatus_Inlined; } -class DiscardPropCacheResumePoint -{ - MGetPropertyCache *propCache_; - - public: - DiscardPropCacheResumePoint(MGetPropertyCache *propCache) - : propCache_(propCache) - { - } - - ~DiscardPropCacheResumePoint() { - if (!propCache_) - return; - - InlinePropertyTable *propTable = propCache_->propTable(); - if (MResumePoint *rp = propTable->takePriorResumePoint()) - propCache_->block()->discardPreAllocatedResumePoint(rp); - } -}; - IonBuilder::InliningStatus IonBuilder::inlineCallsite(ObjectVector &targets, ObjectVector &originals, bool lambda, CallInfo &callInfo) @@ -4384,8 +4364,6 @@ IonBuilder::inlineCallsite(ObjectVector &targets, ObjectVector &originals, return inlineSingleCall(callInfo, target); } - DiscardPropCacheResumePoint discardRp(propCache); - // Choose a subset of the targets for polymorphic inlining. BoolVector choiceSet(alloc()); uint32_t numInlined; @@ -4477,10 +4455,9 @@ IonBuilder::inlineTypeObjectFallback(CallInfo &callInfo, MBasicBlock *dispatchBl // Construct a block into which the MGetPropertyCache can be moved. // This is subtle: the pc and resume point are those of the MGetPropertyCache! InlinePropertyTable *propTable = cache->propTable(); - MResumePoint *priorResumePoint = propTable->takePriorResumePoint(); JS_ASSERT(propTable->pc() != nullptr); - JS_ASSERT(priorResumePoint != nullptr); - MBasicBlock *getPropBlock = newBlock(prepBlock, propTable->pc(), priorResumePoint); + JS_ASSERT(propTable->priorResumePoint() != nullptr); + MBasicBlock *getPropBlock = newBlock(prepBlock, propTable->pc(), propTable->priorResumePoint()); if (!getPropBlock) return false; diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index f62a2bc8a8c..65dcccfd422 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -7503,10 +7503,9 @@ class InlinePropertyTable : public TempObject JS_ASSERT(priorResumePoint_ == nullptr); priorResumePoint_ = resumePoint; } - MResumePoint *takePriorResumePoint() { - MResumePoint *rp = priorResumePoint_; - priorResumePoint_ = nullptr; - return rp; + + MResumePoint *priorResumePoint() const { + return priorResumePoint_; } jsbytecode *pc() const { diff --git a/js/src/jit/MIRGraph.cpp b/js/src/jit/MIRGraph.cpp index 8a05684218b..f305a7cd4c1 100644 --- a/js/src/jit/MIRGraph.cpp +++ b/js/src/jit/MIRGraph.cpp @@ -203,10 +203,7 @@ MBasicBlock::NewWithResumePoint(MIRGraph &graph, CompileInfo &info, { MBasicBlock *block = new(graph.alloc()) MBasicBlock(graph, info, site, NORMAL); - MOZ_ASSERT(!resumePoint->instruction()); - resumePoint->block()->discardResumePoint(resumePoint, RefType_None); resumePoint->block_ = block; - block->addResumePoint(resumePoint); block->entryResumePoint_ = resumePoint; if (!block->init()) @@ -723,10 +720,9 @@ AssertSafelyDiscardable(MDefinition *def) } void -MBasicBlock::discardResumePoint(MResumePoint *rp, ReferencesType refType /* = RefType_Default */) +MBasicBlock::discardResumePoint(MResumePoint *rp) { - if (refType & RefType_DiscardOperands) - rp->discardUses(); + rp->discardUses(); MResumePointIterator iter = resumePointsBegin(); while (*iter != rp) { // We should reach it before reaching the end. @@ -744,8 +740,8 @@ MBasicBlock::prepareForDiscard(MInstruction *ins, ReferencesType refType /* = Re MOZ_ASSERT(ins->block() == this); MResumePoint *rp = ins->resumePoint(); - if ((refType & RefType_DiscardResumePoint) && rp) - discardResumePoint(rp, refType); + if (refType & RefType_DiscardResumePoint && rp) + discardResumePoint(rp); // We need to assert that instructions have no uses after removing the their // resume points operands as they could be captured by their own resume diff --git a/js/src/jit/MIRGraph.h b/js/src/jit/MIRGraph.h index 2520b5c051d..d7fafed9428 100644 --- a/js/src/jit/MIRGraph.h +++ b/js/src/jit/MIRGraph.h @@ -61,17 +61,15 @@ class MBasicBlock : public TempObject, public InlineListNode // as needed. void setVariable(uint32_t slot); + void discardResumePoint(MResumePoint *rp); + enum ReferencesType { - RefType_None = 0, RefType_AssertNoUses = 1 << 0, RefType_DiscardOperands = 1 << 1, RefType_DiscardResumePoint = 1 << 2, - RefType_DefaultNoAssert = RefType_DiscardOperands | RefType_DiscardResumePoint, RefType_Default = RefType_AssertNoUses | RefType_DiscardOperands | RefType_DiscardResumePoint }; - void discardResumePoint(MResumePoint *rp, ReferencesType refType = RefType_Default); - // Remove all references to an instruction such that it can be removed from // the list of instruction, without keeping any dangling pointer to it. This // includes the operands of the instruction, and the resume point if @@ -187,12 +185,6 @@ class MBasicBlock : public TempObject, public InlineListNode resumePoints_.pushFront(resume); } - // Discard pre-allocated resume point. - void discardPreAllocatedResumePoint(MResumePoint *resume) { - MOZ_ASSERT(!resume->instruction()); - discardResumePoint(resume); - } - // Adds a predecessor. Every predecessor must have the same exit stack // depth as the entry state to this block. Adding a predecessor // automatically creates phi nodes and rewrites uses as needed. From 6de0e7fe6575db54b0458d196a8bb0df4874ed9d Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Tue, 5 Aug 2014 13:33:27 +0100 Subject: [PATCH 12/60] Backed out changeset 4ecf21c3c4a3 (bug 1042729) --- js/src/jit/IonAnalysis.cpp | 16 ++++++-------- js/src/jit/IonBuilder.cpp | 1 + js/src/jit/MIR.cpp | 17 --------------- js/src/jit/MIR.h | 16 +++++++------- js/src/jit/MIRGraph.cpp | 31 +++++++++++---------------- js/src/jit/MIRGraph.h | 2 -- js/src/jit/ParallelSafetyAnalysis.cpp | 5 ++++- 7 files changed, 33 insertions(+), 55 deletions(-) diff --git a/js/src/jit/IonAnalysis.cpp b/js/src/jit/IonAnalysis.cpp index a59b81c1b51..8da8f83e8dd 100644 --- a/js/src/jit/IonAnalysis.cpp +++ b/js/src/jit/IonAnalysis.cpp @@ -1744,15 +1744,10 @@ jit::AssertBasicGraphCoherency(MIRGraph &graph) for (size_t i = 0; i < block->numPredecessors(); i++) JS_ASSERT(CheckPredecessorImpliesSuccessor(*block, block->getPredecessor(i))); - MOZ_ASSERT_IF(block->entryResumePoint(), !block->entryResumePoint()->instruction()); for (MResumePointIterator iter(block->resumePointsBegin()); iter != block->resumePointsEnd(); iter++) { - // We cannot yet assert that is there is no instruction then this is - // the entry resume point because we are still storing resume points - // in the InlinePropertyTable. - MOZ_ASSERT_IF(iter->instruction(), iter->instruction()->block() == *block); for (uint32_t i = 0, e = iter->numOperands(); i < e; i++) { - MOZ_ASSERT(iter->getUseFor(i)->hasProducer()); - MOZ_ASSERT(CheckOperandImpliesUse(*iter, iter->getOperand(i))); + if (iter->getUseFor(i)->hasProducer()) + JS_ASSERT(CheckOperandImpliesUse(*iter, iter->getOperand(i))); } } for (MPhiIterator phi(block->phisBegin()); phi != block->phisEnd(); phi++) { @@ -1770,8 +1765,11 @@ jit::AssertBasicGraphCoherency(MIRGraph &graph) if (iter->isInstruction()) { if (MResumePoint *resume = iter->toInstruction()->resumePoint()) { - MOZ_ASSERT(resume->instruction() == *iter); - MOZ_ASSERT(resume->block() == *block); + if (MInstruction *ins = resume->instruction()) + JS_ASSERT(ins->block() == iter->block()); + + for (uint32_t i = 0, e = resume->numOperands(); i < e; i++) + MOZ_ASSERT(resume->getUseFor(i)->hasProducer()); } } diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index 755fa078bd4..6f5e921f053 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -6051,6 +6051,7 @@ IonBuilder::resume(MInstruction *ins, jsbytecode *pc, MResumePoint::Mode mode) if (!resumePoint) return false; ins->setResumePoint(resumePoint); + resumePoint->setInstruction(ins); return true; } diff --git a/js/src/jit/MIR.cpp b/js/src/jit/MIR.cpp index 7a191c22855..c1b76d957f5 100644 --- a/js/src/jit/MIR.cpp +++ b/js/src/jit/MIR.cpp @@ -231,23 +231,6 @@ MDefinition::analyzeEdgeCasesBackward() { } -void -MInstruction::setResumePoint(MResumePoint *resumePoint) -{ - JS_ASSERT(!resumePoint_); - resumePoint_ = resumePoint; - resumePoint_->setInstruction(this); -} - -void -MInstruction::stealResumePoint(MInstruction *ins) -{ - MOZ_ASSERT(ins->resumePoint_->instruction() == ins); - resumePoint_ = ins->resumePoint_; - ins->resumePoint_ = nullptr; - resumePoint_->replaceInstruction(this); -} - static bool MaybeEmulatesUndefined(MDefinition *op) { diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 65dcccfd422..0eb6cfcdde8 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -779,9 +779,15 @@ class MInstruction : resumePoint_(nullptr) { } - void setResumePoint(MResumePoint *resumePoint); + void setResumePoint(MResumePoint *resumePoint) { + JS_ASSERT(!resumePoint_); + resumePoint_ = resumePoint; + } // Used to transfer the resume point to the rewritten instruction. - void stealResumePoint(MInstruction *ins); + void stealResumePoint(MInstruction *ins) { + resumePoint_ = ins->resumePoint_; + ins->resumePoint_ = nullptr; + } MResumePoint *resumePoint() const { return resumePoint_; } @@ -10296,12 +10302,6 @@ class MResumePoint MOZ_FINAL : public MNode, public InlineForwardListNodediscardUses(); - MResumePointIterator iter = resumePointsBegin(); - while (*iter != rp) { - // We should reach it before reaching the end. - MOZ_ASSERT(iter != resumePointsEnd()); - iter++; - } - resumePoints_.removeAt(iter); -} - void MBasicBlock::prepareForDiscard(MInstruction *ins, ReferencesType refType /* = RefType_Default */) { @@ -740,8 +724,19 @@ MBasicBlock::prepareForDiscard(MInstruction *ins, ReferencesType refType /* = Re MOZ_ASSERT(ins->block() == this); MResumePoint *rp = ins->resumePoint(); - if (refType & RefType_DiscardResumePoint && rp) - discardResumePoint(rp); + if (refType & RefType_DiscardResumePoint && rp) { + rp->discardUses(); + // Resume point are using a forward list only, so we need to iterate + // to the location of the resume point in order to remove it. + MResumePointIterator iter = resumePointsBegin(); + while (*iter != rp) { + // If the instruction has a resume point, then it should be part + // of the basic block list of resume points. + MOZ_ASSERT(iter != resumePointsEnd()); + iter++; + } + resumePoints_.removeAt(iter); + } // We need to assert that instructions have no uses after removing the their // resume points operands as they could be captured by their own resume diff --git a/js/src/jit/MIRGraph.h b/js/src/jit/MIRGraph.h index d7fafed9428..b246786ea40 100644 --- a/js/src/jit/MIRGraph.h +++ b/js/src/jit/MIRGraph.h @@ -61,8 +61,6 @@ class MBasicBlock : public TempObject, public InlineListNode // as needed. void setVariable(uint32_t slot); - void discardResumePoint(MResumePoint *rp); - enum ReferencesType { RefType_AssertNoUses = 1 << 0, RefType_DiscardOperands = 1 << 1, diff --git a/js/src/jit/ParallelSafetyAnalysis.cpp b/js/src/jit/ParallelSafetyAnalysis.cpp index 8859f706890..9b5291450fe 100644 --- a/js/src/jit/ParallelSafetyAnalysis.cpp +++ b/js/src/jit/ParallelSafetyAnalysis.cpp @@ -337,8 +337,11 @@ static void TransplantResumePoint(MInstruction *oldInstruction, MInstruction *replacementInstruction) { MOZ_ASSERT(!oldInstruction->isDiscarded()); - if (oldInstruction->resumePoint()) + if (MResumePoint *rp = oldInstruction->resumePoint()) { replacementInstruction->stealResumePoint(oldInstruction); + if (rp->instruction() == oldInstruction) + rp->setInstruction(replacementInstruction); + } } bool From ef7f2312a80f6f8c7444864f5df2ca48438dfb85 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Tue, 5 Aug 2014 13:33:43 +0100 Subject: [PATCH 13/60] Backed out changeset 6196ec73ac9a (bug 1042729) for assertions --- js/src/jit/IonBuilder.cpp | 4 ++-- js/src/jit/MIR.cpp | 14 -------------- js/src/jit/MIR.h | 1 - js/src/jit/MIRGraph.cpp | 16 ++++++---------- 4 files changed, 8 insertions(+), 27 deletions(-) diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index 6f5e921f053..b2166adef7b 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -700,7 +700,7 @@ IonBuilder::build() // register/stack pressure. MCheckOverRecursed *check = MCheckOverRecursed::New(alloc()); current->add(check); - check->setResumePoint(MResumePoint::Copy(alloc(), current->entryResumePoint())); + check->setResumePoint(current->entryResumePoint()); // Parameters have been checked to correspond to the typeset, now we unbox // what we can in an infallible manner. @@ -735,7 +735,7 @@ IonBuilder::build() for (uint32_t i = 0; i < info().endArgSlot(); i++) { MInstruction *ins = current->getEntrySlot(i)->toInstruction(); if (ins->type() == MIRType_Value) - ins->setResumePoint(MResumePoint::Copy(alloc(), current->entryResumePoint())); + ins->setResumePoint(current->entryResumePoint()); } // lazyArguments should never be accessed in |argsObjAliasesFormals| scripts. diff --git a/js/src/jit/MIR.cpp b/js/src/jit/MIR.cpp index c1b76d957f5..9681f3b929c 100644 --- a/js/src/jit/MIR.cpp +++ b/js/src/jit/MIR.cpp @@ -2351,20 +2351,6 @@ MResumePoint::New(TempAllocator &alloc, MBasicBlock *block, jsbytecode *pc, MRes return resume; } -MResumePoint * -MResumePoint::Copy(TempAllocator &alloc, MResumePoint *src) -{ - MResumePoint *resume = new(alloc) MResumePoint(src->block(), src->pc(), - src->caller(), src->mode()); - // Copy the operands from the original resume point, and not from the - // current block stack. - if (!resume->operands_.init(alloc, src->stackDepth())) - return nullptr; - for (size_t i = 0; i < resume->stackDepth(); i++) - resume->initOperand(i, src->getOperand(i)); - return resume; -} - MResumePoint::MResumePoint(MBasicBlock *block, jsbytecode *pc, MResumePoint *caller, Mode mode) : MNode(block), diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 0eb6cfcdde8..17486ce4b35 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -10253,7 +10253,6 @@ class MResumePoint MOZ_FINAL : public MNode, public InlineForwardListNodeisOsrScopeChain()) - cloneRp = def->toOsrScopeChain(); + def->toOsrScopeChain()->setResumePoint(res); } else if (i == info().returnValueSlot()) { if (def->isOsrReturnValue()) - cloneRp = def->toOsrReturnValue(); + def->toOsrReturnValue()->setResumePoint(res); } else if (info().hasArguments() && i == info().argsObjSlot()) { JS_ASSERT(def->isConstant() || def->isOsrArgumentsObject()); JS_ASSERT_IF(def->isConstant(), def->toConstant()->value() == UndefinedValue()); if (def->isOsrArgumentsObject()) - cloneRp = def->toOsrArgumentsObject(); + def->toOsrArgumentsObject()->setResumePoint(res); } else { JS_ASSERT(def->isOsrValue() || def->isGetArgumentsObjectArg() || def->isConstant() || def->isParameter()); @@ -516,15 +515,12 @@ MBasicBlock::linkOsrValues(MStart *start) JS_ASSERT_IF(def->isConstant(), def->toConstant()->value() == UndefinedValue()); if (def->isOsrValue()) - cloneRp = def->toOsrValue(); + def->toOsrValue()->setResumePoint(res); else if (def->isGetArgumentsObjectArg()) - cloneRp = def->toGetArgumentsObjectArg(); + def->toGetArgumentsObjectArg()->setResumePoint(res); else if (def->isParameter()) - cloneRp = def->toParameter(); + def->toParameter()->setResumePoint(res); } - - if (cloneRp) - cloneRp->setResumePoint(MResumePoint::Copy(graph().alloc(), res)); } } From ce37eae9aa8d2c4a2a70973f3edf4bb93e51552b Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Tue, 5 Aug 2014 08:37:20 -0400 Subject: [PATCH 14/60] Bug 1048624 - Re-enable media crashtests on Android and B2G. --- testing/crashtest/crashtests.list | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/testing/crashtest/crashtests.list b/testing/crashtest/crashtests.list index 90c58028558..f127f59a5e0 100644 --- a/testing/crashtest/crashtests.list +++ b/testing/crashtest/crashtests.list @@ -8,14 +8,12 @@ include ../../accessible/tests/crashtests/crashtests.list include ../../content/base/crashtests/crashtests.list include ../../content/html/content/crashtests/crashtests.list include ../../content/html/document/crashtests/crashtests.list +include ../../content/media/test/crashtests/crashtests.list include ../../content/svg/content/src/crashtests/crashtests.list include ../../content/xul/content/crashtests/crashtests.list include ../../content/xul/document/crashtests/crashtests.list include ../../content/xul/templates/src/crashtests/crashtests.list -# Bug 868152 - webaudio crash on tegra platform -skip-if(Android) include ../../content/media/test/crashtests/crashtests.list - include ../../docshell/base/crashtests/crashtests.list include ../../dom/base/crashtests/crashtests.list @@ -33,7 +31,7 @@ include ../../dom/xml/crashtests/crashtests.list include ../../dom/xslt/crashtests/crashtests.list # Bug 811873 - mozRTCPeerConnection doesn't support remote browser yet -skip-if(B2G||browserIsRemote||!webrtc) include ../../dom/media/tests/crashtests/crashtests.list +skip-if(browserIsRemote||!webrtc) include ../../dom/media/tests/crashtests/crashtests.list include ../../editor/crashtests.list From 4d5908e8e7b9d674761559c0dbfe295bc212897a Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Tue, 5 Aug 2014 08:37:21 -0400 Subject: [PATCH 15/60] Bug 1048628 - Skip 0-timescale.html on Android due to being perma-fail. --- content/media/test/crashtests/crashtests.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/media/test/crashtests/crashtests.list b/content/media/test/crashtests/crashtests.list index ce0cc5ee952..b826f460c94 100644 --- a/content/media/test/crashtests/crashtests.list +++ b/content/media/test/crashtests/crashtests.list @@ -1,4 +1,4 @@ -skip-if(B2G) load 0-timescale.html +skip-if(Android||B2G) load 0-timescale.html # bug 1048628 for Android skip-if(B2G) load 459439-1.html # bug 888557 load 466607-1.html load 466945-1.html From 2dd4f9355e4f594359193716742ba1176bf33449 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Tue, 5 Aug 2014 08:37:21 -0400 Subject: [PATCH 16/60] Bug 888557 - Skip 459439-1.html on Android for intermittent timeouts. --- content/media/test/crashtests/crashtests.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/media/test/crashtests/crashtests.list b/content/media/test/crashtests/crashtests.list index b826f460c94..ad5bb7fc520 100644 --- a/content/media/test/crashtests/crashtests.list +++ b/content/media/test/crashtests/crashtests.list @@ -1,5 +1,5 @@ skip-if(Android||B2G) load 0-timescale.html # bug 1048628 for Android -skip-if(B2G) load 459439-1.html # bug 888557 +skip-if(Android||B2G) load 459439-1.html # bug 888557 load 466607-1.html load 466945-1.html load 468763-1.html From c1466fa428b51f896249f0ccc61e13de33245b8d Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Tue, 5 Aug 2014 08:37:22 -0400 Subject: [PATCH 17/60] Bug 909925 - Skip 791330.html, 855796.html, and 863929.html on Android and B2G. --- dom/media/tests/crashtests/crashtests.list | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dom/media/tests/crashtests/crashtests.list b/dom/media/tests/crashtests/crashtests.list index 2acec66506e..e967583d3c4 100644 --- a/dom/media/tests/crashtests/crashtests.list +++ b/dom/media/tests/crashtests/crashtests.list @@ -3,14 +3,14 @@ default-preferences pref(media.peerconnection.enabled,true) pref(media.navigato load 780790.html load 791270.html load 791278.html -load 791330.html +skip-if(Android||B2G) load 791330.html # bug 909925 load 799419.html load 802982.html load 812785.html load 834100.html load 836349.html load 837324.html -load 855796.html +skip-if(Android||B2G) load 855796.html # bug 909925 load 860143.html load 861958.html -load 863929.html +skip-if(Android||B2G) load 863929.html # bug 909925 From f8ab4ab265f63a785eca5eceee66c5f0bc0fb781 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Tue, 5 Aug 2014 08:37:22 -0400 Subject: [PATCH 18/60] Bug 1048863 - Disable 1028458.html on Android and B2G. --- content/media/test/crashtests/crashtests.list | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/content/media/test/crashtests/crashtests.list b/content/media/test/crashtests/crashtests.list index ad5bb7fc520..d0790012124 100644 --- a/content/media/test/crashtests/crashtests.list +++ b/content/media/test/crashtests/crashtests.list @@ -6,13 +6,13 @@ load 468763-1.html load 474744-1.html HTTP load 481136-1.html # needs to be HTTP to recognize the ogg as an audio file? load 493915-1.html -skip-if(Android) load 495794-1.html load 492286-1.xhtml +skip-if(Android) load 495794-1.html load 576612-1.html skip-if(Android||B2G) load 691096-1.html # Android sound API can't handle playing large number of sounds at once, bug 852821 for B2G load 752784-1.html -skip-if(Android||B2G) HTTP load 795892-1.html # load failed, bug 833371 for B2G skip-if(Android||B2G) load 789075-1.html # load failed, bug 833371 for B2G +skip-if(Android||B2G) HTTP load 795892-1.html # load failed, bug 833371 for B2G load 844563.html load 846612.html load 852838.html @@ -33,12 +33,12 @@ load 876215.html load 876249.html load 876252.html load 876834.html +load 877527.html load 877820.html load 878014.html load 878328.html load 878407.html load 878478.html -load 877527.html load 880129.html skip-if(B2G) load 880202.html # load failed, bug 908306 for B2G load 880342-1.html @@ -47,8 +47,8 @@ load 880384.html load 880404.html load 880724.html load 881775.html -load 882956.html test-pref(media.webvtt.enabled,true) load 882549.html +load 882956.html load 884459.html load 889042.html test-pref(media.webvtt.enabled,true) load 894104.html @@ -68,11 +68,11 @@ load 952756.html load 966636.html load 986901.html load 990794.html +load 1015662.html +skip-if(Android||B2G) test-pref(media.navigator.permission.disabled,true) load 1028458.html load buffer-source-ended-1.html -load offline-buffer-source-ended-1.html HTTP load media-element-source-seek-1.html skip-if(B2G) load oscillator-ended-1.html # intermittent B2G timeouts, bug 920338 skip-if(B2G) load oscillator-ended-2.html # intermittent B2G timeouts, bug 920338 -load 1015662.html +load offline-buffer-source-ended-1.html include ../../mediasource/test/crashtests/crashtests.list -test-pref(media.navigator.permission.disabled,true) load 1028458.html From a7d57f1d969901535430575365be5b273798f41c Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Tue, 5 Aug 2014 07:49:52 -0500 Subject: [PATCH 19/60] Bug 1048671 - interface is a reserved identifier in nsHandlerService.js, r=smaug --HG-- extra : rebase_source : e826ee9482bb9dfc1cf1b984141058220882b73a --- uriloader/exthandler/nsHandlerService.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/uriloader/exthandler/nsHandlerService.js b/uriloader/exthandler/nsHandlerService.js index 4e1672ed3a5..0b93243fe83 100644 --- a/uriloader/exthandler/nsHandlerService.js +++ b/uriloader/exthandler/nsHandlerService.js @@ -569,8 +569,8 @@ HandlerService.prototype = { if (!objpath) return null; - let interface = this._getValue(aHandlerAppID, NC_INTERFACE); - if (!interface) + let iface = this._getValue(aHandlerAppID, NC_INTERFACE); + if (!iface) return null; handlerApp = Cc["@mozilla.org/uriloader/dbus-handler-app;1"]. @@ -578,7 +578,7 @@ HandlerService.prototype = { handlerApp.service = service; handlerApp.method = method; handlerApp.objectPath = objpath; - handlerApp.dBusInterface = interface; + handlerApp.dBusInterface = iface; } else From bbbfbded9eb0637adf7f166c3371ce28ace8fe4e Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Tue, 5 Aug 2014 16:55:02 +0200 Subject: [PATCH 20/60] Bug 1046814 - Propertly set the MediaDecoderStateMachine parameters after its initialization when using a MediaSourceDecoder. r=kinetik --- content/media/MediaDecoder.cpp | 28 +++++++++++-------- content/media/MediaDecoder.h | 1 + .../media/mediasource/MediaSourceDecoder.cpp | 9 +++++- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/content/media/MediaDecoder.cpp b/content/media/MediaDecoder.cpp index 2e3f5f8245c..e7dcab3c887 100644 --- a/content/media/MediaDecoder.cpp +++ b/content/media/MediaDecoder.cpp @@ -560,23 +560,29 @@ nsresult MediaDecoder::InitializeStateMachine(MediaDecoder* aCloneDonor) DECODER_LOG(PR_LOG_WARNING, "Failed to init state machine!"); return NS_ERROR_FAILURE; } - { - ReentrantMonitorAutoEnter mon(GetReentrantMonitor()); - mDecoderStateMachine->SetDuration(mDuration); - mDecoderStateMachine->SetVolume(mInitialVolume); - mDecoderStateMachine->SetAudioCaptured(mInitialAudioCaptured); - SetPlaybackRate(mInitialPlaybackRate); - mDecoderStateMachine->SetPreservesPitch(mInitialPreservesPitch); - if (mMinimizePreroll) { - mDecoderStateMachine->SetMinimizePrerollUntilPlaybackStarts(); - } - } + + // If some parameters got set before the state machine got created, + // set them now + SetStateMachineParameters(); ChangeState(PLAY_STATE_LOADING); return ScheduleStateMachineThread(); } +void MediaDecoder::SetStateMachineParameters() +{ + ReentrantMonitorAutoEnter mon(GetReentrantMonitor()); + mDecoderStateMachine->SetDuration(mDuration); + mDecoderStateMachine->SetVolume(mInitialVolume); + mDecoderStateMachine->SetAudioCaptured(mInitialAudioCaptured); + SetPlaybackRate(mInitialPlaybackRate); + mDecoderStateMachine->SetPreservesPitch(mInitialPreservesPitch); + if (mMinimizePreroll) { + mDecoderStateMachine->SetMinimizePrerollUntilPlaybackStarts(); + } +} + void MediaDecoder::SetMinimizePrerollUntilPlaybackStarts() { MOZ_ASSERT(NS_IsMainThread()); diff --git a/content/media/MediaDecoder.h b/content/media/MediaDecoder.h index 7db49e92789..cb37d3f1671 100644 --- a/content/media/MediaDecoder.h +++ b/content/media/MediaDecoder.h @@ -1011,6 +1011,7 @@ public: protected: virtual ~MediaDecoder(); + void SetStateMachineParameters(); /****** * The following members should be accessed with the decoder lock held. diff --git a/content/media/mediasource/MediaSourceDecoder.cpp b/content/media/mediasource/MediaSourceDecoder.cpp index 280b304faa3..56370d27d55 100644 --- a/content/media/mediasource/MediaSourceDecoder.cpp +++ b/content/media/mediasource/MediaSourceDecoder.cpp @@ -310,7 +310,14 @@ MediaSourceDecoder::Load(nsIStreamListener**, MediaDecoder*) return NS_ERROR_FAILURE; } - return mDecoderStateMachine->Init(nullptr); + + nsresult rv = mDecoderStateMachine->Init(nullptr); + + NS_ENSURE_SUCCESS(rv, rv); + + SetStateMachineParameters(); + + return rv; } nsresult From 1bb66264e2828536b9563403ca2a8765544edf62 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Tue, 5 Aug 2014 14:03:22 +0100 Subject: [PATCH 21/60] Bug 1026987 - Remove spurious space after newline; DONTBUILD --- netwerk/base/src/nsSocketTransport2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netwerk/base/src/nsSocketTransport2.cpp b/netwerk/base/src/nsSocketTransport2.cpp index 4ee99e58aa1..4cd26354929 100644 --- a/netwerk/base/src/nsSocketTransport2.cpp +++ b/netwerk/base/src/nsSocketTransport2.cpp @@ -1194,7 +1194,7 @@ nsSocketTransport::InitiateSocket() netaddr->GetAddress(ipaddr); fprintf_stderr(stderr, "FATAL ERROR: Non-local network connections are disabled and a connection " - "attempt to %s (%s) was made.\n You should only access hostnames " + "attempt to %s (%s) was made.\nYou should only access hostnames " "available via the test networking proxy (if running mochitests) " "or from a test-specific httpd.js server (if running xpcshell tests). " "Browser services should be disabled or redirected to a local server.\n", From 5468b836e60a367f300052b48e4c658e0b3b1f63 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Tue, 5 Aug 2014 14:14:58 +0100 Subject: [PATCH 22/60] bug 1046491 - ensure the font-variant css features are enabled for reftests that require them. r=jdaggett --- layout/reftests/font-matching/reftest.list | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layout/reftests/font-matching/reftest.list b/layout/reftests/font-matching/reftest.list index e3271cfdfeb..5844cdf041d 100644 --- a/layout/reftests/font-matching/reftest.list +++ b/layout/reftests/font-matching/reftest.list @@ -91,5 +91,5 @@ random-if(!(cocoaWidget||winWidget)) == arial-arabic.html arial-arabic-ref.html != syntheticbold-rotated.html syntheticbold-rotated-ref.html -HTTP(..) == font-synthesis-1.html font-synthesis-1-ref.html -HTTP(..) == font-synthesis-2.html font-synthesis-2-ref.html +pref(layout.css.font-features.enabled,true) HTTP(..) == font-synthesis-1.html font-synthesis-1-ref.html +pref(layout.css.font-features.enabled,true) HTTP(..) == font-synthesis-2.html font-synthesis-2-ref.html From 8c8feaa815d05cf87e09c3dbdac1bb33acf8f0da Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 5 Aug 2014 09:19:03 -0400 Subject: [PATCH 23/60] Bug 1048242 - Fix more bad implicit constructors in docshell; r=smaug --- docshell/base/nsDSURIContentListener.h | 2 +- docshell/base/nsDocShell.h | 4 ++-- docshell/base/nsDocShellEditorData.h | 2 +- docshell/base/nsDocShellEnumerator.h | 2 +- docshell/shistory/src/nsSHistory.h | 2 +- uriloader/base/nsDocLoader.h | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docshell/base/nsDSURIContentListener.h b/docshell/base/nsDSURIContentListener.h index d84176bf691..038f153cfd7 100644 --- a/docshell/base/nsDSURIContentListener.h +++ b/docshell/base/nsDSURIContentListener.h @@ -29,7 +29,7 @@ public: nsresult Init(); protected: - nsDSURIContentListener(nsDocShell* aDocShell); + explicit nsDSURIContentListener(nsDocShell* aDocShell); virtual ~nsDSURIContentListener(); void DropDocShellreference() { diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index d2116282a22..b466aec68ae 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -659,7 +659,7 @@ protected: class RestorePresentationEvent : public nsRunnable { public: NS_DECL_NSIRUNNABLE - RestorePresentationEvent(nsDocShell *ds) : mDocShell(ds) {} + explicit RestorePresentationEvent(nsDocShell *ds) : mDocShell(ds) {} void Revoke() { mDocShell = nullptr; } private: nsRefPtr mDocShell; @@ -922,7 +922,7 @@ private: public: class InterfaceRequestorProxy : public nsIInterfaceRequestor { public: - InterfaceRequestorProxy(nsIInterfaceRequestor* p); + explicit InterfaceRequestorProxy(nsIInterfaceRequestor* p); NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINTERFACEREQUESTOR diff --git a/docshell/base/nsDocShellEditorData.h b/docshell/base/nsDocShellEditorData.h index b1614836b34..7dc2b4b38e0 100644 --- a/docshell/base/nsDocShellEditorData.h +++ b/docshell/base/nsDocShellEditorData.h @@ -20,7 +20,7 @@ class nsDocShellEditorData { public: - nsDocShellEditorData(nsIDocShell* inOwningDocShell); + explicit nsDocShellEditorData(nsIDocShell* inOwningDocShell); ~nsDocShellEditorData(); nsresult MakeEditable(bool inWaitForUriLoad); diff --git a/docshell/base/nsDocShellEnumerator.h b/docshell/base/nsDocShellEnumerator.h index 32256fff4d6..b885e47ac26 100644 --- a/docshell/base/nsDocShellEnumerator.h +++ b/docshell/base/nsDocShellEnumerator.h @@ -42,7 +42,7 @@ protected: public: - nsDocShellEnumerator(int32_t inEnumerationDirection); + explicit nsDocShellEnumerator(int32_t inEnumerationDirection); // nsISupports NS_DECL_ISUPPORTS diff --git a/docshell/shistory/src/nsSHistory.h b/docshell/shistory/src/nsSHistory.h index 546b2f7cf66..101dcac1df3 100644 --- a/docshell/shistory/src/nsSHistory.h +++ b/docshell/shistory/src/nsSHistory.h @@ -108,7 +108,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSISIMPLEENUMERATOR - nsSHEnumerator(nsSHistory * aHistory); + explicit nsSHEnumerator(nsSHistory * aHistory); protected: friend class nsSHistory; diff --git a/uriloader/base/nsDocLoader.h b/uriloader/base/nsDocLoader.h index b1431fffb5a..057ae6ddf4c 100644 --- a/uriloader/base/nsDocLoader.h +++ b/uriloader/base/nsDocLoader.h @@ -209,7 +209,7 @@ protected: // Weak mRequest is ok; we'll be told if it decides to go away. nsIRequest * const mRequest; - nsStatusInfo(nsIRequest* aRequest) : + explicit nsStatusInfo(nsIRequest* aRequest) : mRequest(aRequest) { MOZ_COUNT_CTOR(nsStatusInfo); @@ -222,7 +222,7 @@ protected: struct nsRequestInfo : public PLDHashEntryHdr { - nsRequestInfo(const void* key) + explicit nsRequestInfo(const void* key) : mKey(key), mCurrentProgress(0), mMaxProgress(0), mUploading(false) , mLastStatus(nullptr) { From 2a5cde4a073c28d6865b2ab3f8d01b97e444fe82 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 5 Aug 2014 09:19:51 -0400 Subject: [PATCH 24/60] Bug 1048247 - Fix more bad implicit constructors in DOM; r=smaug --- content/base/public/Element.h | 4 ++-- content/base/public/FragmentOrElement.h | 12 +++++----- content/base/public/nsDOMFile.h | 2 +- content/base/public/nsIContent.h | 2 +- content/base/public/nsIDocument.h | 4 ++-- content/base/public/nsINode.h | 2 +- content/base/public/nsNameSpaceManager.h | 2 +- content/base/src/DOMRect.h | 8 +++---- content/base/src/nsAttrValue.h | 2 +- content/base/src/nsDOMAttributeMap.h | 4 ++-- content/base/src/nsFrameLoader.cpp | 2 +- content/base/src/nsFrameMessageManager.cpp | 6 ++--- content/base/src/nsMappedAttributeElement.h | 2 +- content/base/src/nsPropertyTable.h | 4 ++-- content/base/src/nsRange.h | 4 ++-- content/base/src/nsStyledElement.h | 4 ++-- content/base/src/nsXMLHttpRequest.h | 22 +++++++++---------- .../html/content/public/HTMLCanvasElement.h | 2 +- content/html/content/src/ValidityState.h | 2 +- .../html/content/src/nsGenericHTMLElement.h | 6 ++--- dom/base/DOMError.h | 2 +- dom/base/MessageChannel.h | 2 +- dom/base/MessagePort.cpp | 2 +- dom/base/MessagePort.h | 4 ++-- dom/base/nsDOMWindowUtils.h | 2 +- dom/base/nsGlobalWindow.h | 6 ++--- dom/base/nsPIDOMWindow.h | 4 ++-- dom/bindings/TypedArray.h | 4 ++-- dom/events/DOMEventTargetHelper.h | 4 ++-- dom/events/Event.h | 2 +- dom/events/EventDispatcher.h | 2 +- dom/events/EventListenerManager.h | 2 +- dom/events/JSEventHandler.h | 6 ++--- dom/events/StorageEvent.h | 2 +- dom/indexedDB/FileInfo.h | 2 +- dom/indexedDB/IDBRequest.h | 6 ++--- dom/indexedDB/IDBWrapperCache.h | 4 ++-- dom/ipc/ContentBridgeParent.h | 2 +- dom/ipc/ContentParent.cpp | 2 +- dom/ipc/PermissionMessageUtils.h | 2 +- dom/ipc/TabChild.cpp | 6 ++--- dom/ipc/TabChild.h | 4 ++-- dom/ipc/TabContext.h | 2 +- dom/xbl/nsBindingManager.h | 2 +- dom/xbl/nsXBLBinding.h | 2 +- ipc/glue/GeckoChildProcessHost.h | 4 ++-- 46 files changed, 89 insertions(+), 89 deletions(-) diff --git a/content/base/public/Element.h b/content/base/public/Element.h index bd8c19ddab3..1718232193d 100644 --- a/content/base/public/Element.h +++ b/content/base/public/Element.h @@ -139,7 +139,7 @@ class Element : public FragmentOrElement { public: #ifdef MOZILLA_INTERNAL_API - Element(already_AddRefed& aNodeInfo) : + explicit Element(already_AddRefed& aNodeInfo) : FragmentOrElement(aNodeInfo), mState(NS_EVENT_STATE_MOZ_READONLY) { @@ -1213,7 +1213,7 @@ private: class DestinationInsertionPointList : public nsINodeList { public: - DestinationInsertionPointList(Element* aElement); + explicit DestinationInsertionPointList(Element* aElement); NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(DestinationInsertionPointList) diff --git a/content/base/public/FragmentOrElement.h b/content/base/public/FragmentOrElement.h index 5353ea1e521..4aafde53a28 100644 --- a/content/base/public/FragmentOrElement.h +++ b/content/base/public/FragmentOrElement.h @@ -48,7 +48,7 @@ class Element; class nsChildContentList MOZ_FINAL : public nsINodeList { public: - nsChildContentList(nsINode* aNode) + explicit nsChildContentList(nsINode* aNode) : mNode(aNode) { SetIsDOMBinding(); @@ -96,7 +96,7 @@ public: NS_DECL_NSIDOMXPATHNSRESOLVER - nsNode3Tearoff(nsINode *aNode) : mNode(aNode) + explicit nsNode3Tearoff(nsINode *aNode) : mNode(aNode) { } @@ -114,7 +114,7 @@ private: class nsNodeWeakReference MOZ_FINAL : public nsIWeakReference { public: - nsNodeWeakReference(nsINode* aNode) + explicit nsNodeWeakReference(nsINode* aNode) : mNode(aNode) { } @@ -143,7 +143,7 @@ private: class nsNodeSupportsWeakRefTearoff MOZ_FINAL : public nsISupportsWeakReference { public: - nsNodeSupportsWeakRefTearoff(nsINode* aNode) + explicit nsNodeSupportsWeakRefTearoff(nsINode* aNode) : mNode(aNode) { } @@ -175,8 +175,8 @@ class UndoManager; class FragmentOrElement : public nsIContent { public: - FragmentOrElement(already_AddRefed& aNodeInfo); - FragmentOrElement(already_AddRefed&& aNodeInfo); + explicit FragmentOrElement(already_AddRefed& aNodeInfo); + explicit FragmentOrElement(already_AddRefed&& aNodeInfo); NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/content/base/public/nsDOMFile.h b/content/base/public/nsDOMFile.h index f73bc1cee65..1cbcb78e347 100644 --- a/content/base/public/nsDOMFile.h +++ b/content/base/public/nsDOMFile.h @@ -754,7 +754,7 @@ class nsDOMFileList MOZ_FINAL : public nsIDOMFileList, ~nsDOMFileList() {} public: - nsDOMFileList(nsISupports *aParent) : mParent(aParent) + explicit nsDOMFileList(nsISupports *aParent) : mParent(aParent) { SetIsDOMBinding(); } diff --git a/content/base/public/nsIContent.h b/content/base/public/nsIContent.h index 7ba6a654dad..fa4b2003356 100644 --- a/content/base/public/nsIContent.h +++ b/content/base/public/nsIContent.h @@ -54,7 +54,7 @@ public: // If you're using the external API, the only thing you can know about // nsIContent is that it exists with an IID - nsIContent(already_AddRefed& aNodeInfo) + explicit nsIContent(already_AddRefed& aNodeInfo) : nsINode(aNodeInfo) { MOZ_ASSERT(mNodeInfo); diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 7875ffc5ef9..610b47f7910 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -688,7 +688,7 @@ private: class SelectorCacheKey { public: - SelectorCacheKey(const nsAString& aString) : mKey(aString) + explicit SelectorCacheKey(const nsAString& aString) : mKey(aString) { MOZ_COUNT_CTOR(SelectorCacheKey); } @@ -2728,7 +2728,7 @@ private: class MOZ_STACK_CLASS nsAutoSyncOperation { public: - nsAutoSyncOperation(nsIDocument* aDocument); + explicit nsAutoSyncOperation(nsIDocument* aDocument); ~nsAutoSyncOperation(); private: nsCOMArray mDocuments; diff --git a/content/base/public/nsINode.h b/content/base/public/nsINode.h index 86e29ed18cc..4ff06eac50c 100644 --- a/content/base/public/nsINode.h +++ b/content/base/public/nsINode.h @@ -337,7 +337,7 @@ public: friend class nsAttrAndChildArray; #ifdef MOZILLA_INTERNAL_API - nsINode(already_AddRefed& aNodeInfo) + explicit nsINode(already_AddRefed& aNodeInfo) : mNodeInfo(aNodeInfo), mParent(nullptr), mBoolFlags(0), diff --git a/content/base/public/nsNameSpaceManager.h b/content/base/public/nsNameSpaceManager.h index 8b9f63738bc..889943e97ec 100644 --- a/content/base/public/nsNameSpaceManager.h +++ b/content/base/public/nsNameSpaceManager.h @@ -20,7 +20,7 @@ public: typedef const nsAString* KeyType; typedef const nsAString* KeyTypePointer; - nsNameSpaceKey(KeyTypePointer aKey) : mKey(aKey) + explicit nsNameSpaceKey(KeyTypePointer aKey) : mKey(aKey) { } nsNameSpaceKey(const nsNameSpaceKey& toCopy) : mKey(toCopy.mKey) diff --git a/content/base/src/DOMRect.h b/content/base/src/DOMRect.h index f4c2d3d4470..ce36815395b 100644 --- a/content/base/src/DOMRect.h +++ b/content/base/src/DOMRect.h @@ -33,7 +33,7 @@ public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMRectReadOnly) - DOMRectReadOnly(nsISupports* aParent) + explicit DOMRectReadOnly(nsISupports* aParent) : mParent(aParent) { SetIsDOMBinding(); @@ -80,8 +80,8 @@ class DOMRect MOZ_FINAL : public DOMRectReadOnly , public nsIDOMClientRect { public: - DOMRect(nsISupports* aParent, double aX = 0, double aY = 0, - double aWidth = 0, double aHeight = 0) + explicit DOMRect(nsISupports* aParent, double aX = 0, double aY = 0, + double aWidth = 0, double aHeight = 0) : DOMRectReadOnly(aParent) , mX(aX) , mY(aY) @@ -150,7 +150,7 @@ class DOMRectList MOZ_FINAL : public nsIDOMClientRectList, ~DOMRectList() {} public: - DOMRectList(nsISupports *aParent) : mParent(aParent) + explicit DOMRectList(nsISupports *aParent) : mParent(aParent) { SetIsDOMBinding(); } diff --git a/content/base/src/nsAttrValue.h b/content/base/src/nsAttrValue.h index d4c19ab71a8..3bf1151bafd 100644 --- a/content/base/src/nsAttrValue.h +++ b/content/base/src/nsAttrValue.h @@ -67,7 +67,7 @@ struct ImageValue; */ class nsCheapString : public nsString { public: - nsCheapString(nsStringBuffer* aBuf) + explicit nsCheapString(nsStringBuffer* aBuf) { if (aBuf) aBuf->ToString(aBuf->StorageSize()/sizeof(char16_t) - 1, *this); diff --git a/content/base/src/nsDOMAttributeMap.h b/content/base/src/nsDOMAttributeMap.h index e9d853d2639..477dc858acc 100644 --- a/content/base/src/nsDOMAttributeMap.h +++ b/content/base/src/nsDOMAttributeMap.h @@ -55,7 +55,7 @@ public: typedef const nsAttrKey& KeyType; typedef const nsAttrKey* KeyTypePointer; - nsAttrHashKey(KeyTypePointer aKey) : mKey(*aKey) {} + explicit nsAttrHashKey(KeyTypePointer aKey) : mKey(*aKey) {} nsAttrHashKey(const nsAttrHashKey& aCopy) : mKey(aCopy.mKey) {} ~nsAttrHashKey() {} @@ -89,7 +89,7 @@ public: typedef mozilla::dom::Element Element; typedef mozilla::ErrorResult ErrorResult; - nsDOMAttributeMap(Element *aContent); + explicit nsDOMAttributeMap(Element *aContent); NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsDOMAttributeMap) diff --git a/content/base/src/nsFrameLoader.cpp b/content/base/src/nsFrameLoader.cpp index f93c00dfbd1..1f358025eec 100644 --- a/content/base/src/nsFrameLoader.cpp +++ b/content/base/src/nsFrameLoader.cpp @@ -2326,7 +2326,7 @@ nsFrameLoader::DoSendAsyncMessage(JSContext* aCx, return false; } return tabParent->SendAsyncMessage(nsString(aMessage), data, cpows, - aPrincipal); + IPC::Principal(aPrincipal)); } if (mChildMessageManager) { diff --git a/content/base/src/nsFrameMessageManager.cpp b/content/base/src/nsFrameMessageManager.cpp index f9990ffb6d1..31ec577f780 100644 --- a/content/base/src/nsFrameMessageManager.cpp +++ b/content/base/src/nsFrameMessageManager.cpp @@ -1729,10 +1729,10 @@ public: } if (aIsSync) { return cc->SendSyncMessage(PromiseFlatString(aMessage), data, cpows, - aPrincipal, aJSONRetVal); + IPC::Principal(aPrincipal), aJSONRetVal); } return cc->CallRpcMessage(PromiseFlatString(aMessage), data, cpows, - aPrincipal, aJSONRetVal); + IPC::Principal(aPrincipal), aJSONRetVal); } virtual bool DoSendAsyncMessage(JSContext* aCx, @@ -1755,7 +1755,7 @@ public: return false; } return cc->SendAsyncMessage(PromiseFlatString(aMessage), data, cpows, - aPrincipal); + IPC::Principal(aPrincipal)); } }; diff --git a/content/base/src/nsMappedAttributeElement.h b/content/base/src/nsMappedAttributeElement.h index 61460e15742..301b0682d13 100644 --- a/content/base/src/nsMappedAttributeElement.h +++ b/content/base/src/nsMappedAttributeElement.h @@ -28,7 +28,7 @@ class nsMappedAttributeElement : public nsMappedAttributeElementBase protected: - nsMappedAttributeElement(already_AddRefed& aNodeInfo) + explicit nsMappedAttributeElement(already_AddRefed& aNodeInfo) : nsMappedAttributeElementBase(aNodeInfo) {} diff --git a/content/base/src/nsPropertyTable.h b/content/base/src/nsPropertyTable.h index 510fd1bc796..ec5d26de2e8 100644 --- a/content/base/src/nsPropertyTable.h +++ b/content/base/src/nsPropertyTable.h @@ -52,8 +52,8 @@ public: // These are the types of objects that can own properties. No object should // inherit more then one of these classes. // To add support for more types just add to this list. - nsPropertyOwner(const nsINode* aObject) : mObject(aObject) {} - nsPropertyOwner(const nsIFrame* aObject) : mObject(aObject) {} + MOZ_IMPLICIT nsPropertyOwner(const nsINode* aObject) : mObject(aObject) {} + MOZ_IMPLICIT nsPropertyOwner(const nsIFrame* aObject) : mObject(aObject) {} operator const void*() { return mObject; } const void* get() { return mObject; } diff --git a/content/base/src/nsRange.h b/content/base/src/nsRange.h index a7bab97ef66..5e4c9f92f1e 100644 --- a/content/base/src/nsRange.h +++ b/content/base/src/nsRange.h @@ -41,7 +41,7 @@ class nsRange MOZ_FINAL : public nsIDOMRange, virtual ~nsRange(); public: - nsRange(nsINode* aNode) + explicit nsRange(nsINode* aNode) : mRoot(nullptr) , mStartOffset(0) , mEndOffset(0) @@ -290,7 +290,7 @@ protected: struct MOZ_STACK_CLASS AutoInvalidateSelection { - AutoInvalidateSelection(nsRange* aRange) : mRange(aRange) + explicit AutoInvalidateSelection(nsRange* aRange) : mRange(aRange) { #ifdef DEBUG mWasInSelection = mRange->IsInSelection(); diff --git a/content/base/src/nsStyledElement.h b/content/base/src/nsStyledElement.h index 469d3b1707c..8e746d2bba6 100644 --- a/content/base/src/nsStyledElement.h +++ b/content/base/src/nsStyledElement.h @@ -30,7 +30,7 @@ class nsStyledElementNotElementCSSInlineStyle : public nsStyledElementBase protected: - inline nsStyledElementNotElementCSSInlineStyle(already_AddRefed& aNodeInfo) + inline explicit nsStyledElementNotElementCSSInlineStyle(already_AddRefed& aNodeInfo) : nsStyledElementBase(aNodeInfo) {} @@ -72,7 +72,7 @@ protected: class nsStyledElement : public nsStyledElementNotElementCSSInlineStyle { protected: - inline nsStyledElement(already_AddRefed& aNodeInfo) + inline explicit nsStyledElement(already_AddRefed& aNodeInfo) : nsStyledElementNotElementCSSInlineStyle(aNodeInfo) {} }; diff --git a/content/base/src/nsXMLHttpRequest.h b/content/base/src/nsXMLHttpRequest.h index 595044c12e8..0d53a3a97c4 100644 --- a/content/base/src/nsXMLHttpRequest.h +++ b/content/base/src/nsXMLHttpRequest.h @@ -113,7 +113,7 @@ class nsXHREventTarget : public mozilla::DOMEventTargetHelper, public nsIXMLHttpRequestEventTarget { protected: - nsXHREventTarget(mozilla::DOMEventTargetHelper* aOwner) + explicit nsXHREventTarget(mozilla::DOMEventTargetHelper* aOwner) : mozilla::DOMEventTargetHelper(aOwner) { } @@ -151,7 +151,7 @@ class nsXMLHttpRequestUpload MOZ_FINAL : public nsXHREventTarget, public nsIXMLHttpRequestUpload { public: - nsXMLHttpRequestUpload(mozilla::DOMEventTargetHelper* aOwner) + explicit nsXMLHttpRequestUpload(mozilla::DOMEventTargetHelper* aOwner) : nsXHREventTarget(aOwner) { } @@ -343,31 +343,31 @@ private: RequestBody() : mType(Uninitialized) { } - RequestBody(const mozilla::dom::ArrayBuffer* aArrayBuffer) : mType(ArrayBuffer) + explicit RequestBody(const mozilla::dom::ArrayBuffer* aArrayBuffer) : mType(ArrayBuffer) { mValue.mArrayBuffer = aArrayBuffer; } - RequestBody(const mozilla::dom::ArrayBufferView* aArrayBufferView) : mType(ArrayBufferView) + explicit RequestBody(const mozilla::dom::ArrayBufferView* aArrayBufferView) : mType(ArrayBufferView) { mValue.mArrayBufferView = aArrayBufferView; } - RequestBody(nsIDOMBlob* aBlob) : mType(Blob) + explicit RequestBody(nsIDOMBlob* aBlob) : mType(Blob) { mValue.mBlob = aBlob; } - RequestBody(nsIDocument* aDocument) : mType(Document) + explicit RequestBody(nsIDocument* aDocument) : mType(Document) { mValue.mDocument = aDocument; } - RequestBody(const nsAString& aString) : mType(DOMString) + explicit RequestBody(const nsAString& aString) : mType(DOMString) { mValue.mString = &aString; } - RequestBody(nsFormData& aFormData) : mType(FormData) + explicit RequestBody(nsFormData& aFormData) : mType(FormData) { mValue.mFormData = &aFormData; } - RequestBody(nsIInputStream* aStream) : mType(InputStream) + explicit RequestBody(nsIInputStream* aStream) : mType(InputStream) { mValue.mStream = aStream; } @@ -809,7 +809,7 @@ class nsXMLHttpRequestXPCOMifier MOZ_FINAL : public nsIStreamListener, NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXMLHttpRequestXPCOMifier, nsIStreamListener) - nsXMLHttpRequestXPCOMifier(nsXMLHttpRequest* aXHR) : + explicit nsXMLHttpRequestXPCOMifier(nsXMLHttpRequest* aXHR) : mXHR(aXHR) { } @@ -847,7 +847,7 @@ public: mXHR = nullptr; return NS_OK; } - nsXHRParseEndListener(nsIXMLHttpRequest* aXHR) + explicit nsXHRParseEndListener(nsIXMLHttpRequest* aXHR) : mXHR(do_GetWeakReference(aXHR)) {} private: virtual ~nsXHRParseEndListener() {} diff --git a/content/html/content/public/HTMLCanvasElement.h b/content/html/content/public/HTMLCanvasElement.h index ac4c6c8bcd7..575a41ff60c 100644 --- a/content/html/content/public/HTMLCanvasElement.h +++ b/content/html/content/public/HTMLCanvasElement.h @@ -47,7 +47,7 @@ class HTMLCanvasElement MOZ_FINAL : public nsGenericHTMLElement, typedef layers::LayerManager LayerManager; public: - HTMLCanvasElement(already_AddRefed& aNodeInfo); + explicit HTMLCanvasElement(already_AddRefed& aNodeInfo); NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLCanvasElement, canvas) diff --git a/content/html/content/src/ValidityState.h b/content/html/content/src/ValidityState.h index a74e8fb04e4..33fb447a1c5 100644 --- a/content/html/content/src/ValidityState.h +++ b/content/html/content/src/ValidityState.h @@ -75,7 +75,7 @@ public: } protected: - ValidityState(nsIConstraintValidation* aConstraintValidation); + explicit ValidityState(nsIConstraintValidation* aConstraintValidation); /** * Helper function to get a validity state from constraint validation instance. diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h index 630dcaa6bee..038b167a47f 100644 --- a/content/html/content/src/nsGenericHTMLElement.h +++ b/content/html/content/src/nsGenericHTMLElement.h @@ -51,7 +51,7 @@ class nsGenericHTMLElement : public nsGenericHTMLElementBase, public nsIDOMHTMLElement { public: - nsGenericHTMLElement(already_AddRefed& aNodeInfo) + explicit nsGenericHTMLElement(already_AddRefed& aNodeInfo) : nsGenericHTMLElementBase(aNodeInfo), mScrollgrab(false) { @@ -1263,7 +1263,7 @@ class nsGenericHTMLFormElement : public nsGenericHTMLElement, public nsIFormControl { public: - nsGenericHTMLFormElement(already_AddRefed& aNodeInfo); + explicit nsGenericHTMLFormElement(already_AddRefed& aNodeInfo); NS_DECL_ISUPPORTS_INHERITED @@ -1421,7 +1421,7 @@ protected: class nsGenericHTMLFormElementWithState : public nsGenericHTMLFormElement { public: - nsGenericHTMLFormElementWithState(already_AddRefed& aNodeInfo); + explicit nsGenericHTMLFormElementWithState(already_AddRefed& aNodeInfo); /** * Get the presentation state for a piece of content, or create it if it does diff --git a/dom/base/DOMError.h b/dom/base/DOMError.h index 1bd0bfc09b0..ca02d06ba03 100644 --- a/dom/base/DOMError.h +++ b/dom/base/DOMError.h @@ -44,7 +44,7 @@ public: // aWindow can be null if this DOMError is not associated with a particular // window. - DOMError(nsPIDOMWindow* aWindow); + explicit DOMError(nsPIDOMWindow* aWindow); DOMError(nsPIDOMWindow* aWindow, nsresult aValue); diff --git a/dom/base/MessageChannel.h b/dom/base/MessageChannel.h index 7818d0183db..c7411eae9fe 100644 --- a/dom/base/MessageChannel.h +++ b/dom/base/MessageChannel.h @@ -31,7 +31,7 @@ public: static bool Enabled(JSContext* aCx, JSObject* aGlobal); public: - MessageChannel(nsPIDOMWindow* aWindow); + explicit MessageChannel(nsPIDOMWindow* aWindow); nsPIDOMWindow* GetParentObject() const diff --git a/dom/base/MessagePort.cpp b/dom/base/MessagePort.cpp index e2777b99a1c..87202409362 100644 --- a/dom/base/MessagePort.cpp +++ b/dom/base/MessagePort.cpp @@ -28,7 +28,7 @@ class DispatchEventRunnable : public nsRunnable friend class MessagePort; public: - DispatchEventRunnable(MessagePort* aPort) + explicit DispatchEventRunnable(MessagePort* aPort) : mPort(aPort) { } diff --git a/dom/base/MessagePort.h b/dom/base/MessagePort.h index 2d4f123c2ab..ca3e8dd74f4 100644 --- a/dom/base/MessagePort.h +++ b/dom/base/MessagePort.h @@ -20,7 +20,7 @@ class PostMessageRunnable; class MessagePortBase : public DOMEventTargetHelper { protected: - MessagePortBase(nsPIDOMWindow* aWindow); + explicit MessagePortBase(nsPIDOMWindow* aWindow); MessagePortBase(); public: @@ -61,7 +61,7 @@ public: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MessagePort, DOMEventTargetHelper) - MessagePort(nsPIDOMWindow* aWindow); + explicit MessagePort(nsPIDOMWindow* aWindow); virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; diff --git a/dom/base/nsDOMWindowUtils.h b/dom/base/nsDOMWindowUtils.h index e22dfe3a737..b78d658c1e0 100644 --- a/dom/base/nsDOMWindowUtils.h +++ b/dom/base/nsDOMWindowUtils.h @@ -58,7 +58,7 @@ class nsDOMWindowUtils MOZ_FINAL : public nsIDOMWindowUtils, public nsSupportsWeakReference { public: - nsDOMWindowUtils(nsGlobalWindow *aWindow); + explicit nsDOMWindowUtils(nsGlobalWindow *aWindow); NS_DECL_ISUPPORTS NS_DECL_NSIDOMWINDOWUTILS diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index 31a8811bdc1..d187f63d75b 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -523,7 +523,7 @@ public: mozilla::ErrorResult& aRv); // Object Management - nsGlobalWindow(nsGlobalWindow *aOuterWindow); + explicit nsGlobalWindow(nsGlobalWindow *aOuterWindow); static nsGlobalWindow *FromSupports(nsISupports *supports) { @@ -1666,7 +1666,7 @@ public: // nsIDOMChromeWindow interface NS_DECL_NSIDOMCHROMEWINDOW - nsGlobalChromeWindow(nsGlobalWindow *aOuterWindow) + explicit nsGlobalChromeWindow(nsGlobalWindow *aOuterWindow) : nsGlobalWindow(aOuterWindow), mGroupMessageManagers(1) { @@ -1733,7 +1733,7 @@ class nsGlobalModalWindow : public nsGlobalWindow, public nsIDOMModalContentWindow { public: - nsGlobalModalWindow(nsGlobalWindow *aOuterWindow) + explicit nsGlobalModalWindow(nsGlobalWindow *aOuterWindow) : nsGlobalWindow(aOuterWindow) { mIsModalContentWindow = true; diff --git a/dom/base/nsPIDOMWindow.h b/dom/base/nsPIDOMWindow.h index e062fa3b1f8..3e10e7380f2 100644 --- a/dom/base/nsPIDOMWindow.h +++ b/dom/base/nsPIDOMWindow.h @@ -729,7 +729,7 @@ protected: // be null if and only if the created window itself is an outer // window. In all other cases aOuterWindow should be the outer // window for the inner window that is being created. - nsPIDOMWindow(nsPIDOMWindow *aOuterWindow); + explicit nsPIDOMWindow(nsPIDOMWindow *aOuterWindow); ~nsPIDOMWindow(); @@ -842,7 +842,7 @@ class NS_AUTO_POPUP_STATE_PUSHER { public: #ifdef MOZILLA_INTERNAL_API - NS_AUTO_POPUP_STATE_PUSHER(PopupControlState aState, bool aForce = false) + explicit NS_AUTO_POPUP_STATE_PUSHER(PopupControlState aState, bool aForce = false) : mOldState(::PushPopupControlState(aState, aForce)) { } diff --git a/dom/bindings/TypedArray.h b/dom/bindings/TypedArray.h index de70cca4b9b..ca3e19567ca 100644 --- a/dom/bindings/TypedArray.h +++ b/dom/bindings/TypedArray.h @@ -233,7 +233,7 @@ class TypedArrayCreator typedef nsTArray ArrayType; public: - TypedArrayCreator(const ArrayType& aArray) + explicit TypedArrayCreator(const ArrayType& aArray) : mArray(aArray) {} @@ -298,7 +298,7 @@ class MOZ_STACK_CLASS RootedTypedArray : public ArrayType, private TypedArrayRooter { public: - RootedTypedArray(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : + explicit RootedTypedArray(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : ArrayType(), TypedArrayRooter(cx, MOZ_THIS_IN_INITIALIZER_LIST() diff --git a/dom/events/DOMEventTargetHelper.h b/dom/events/DOMEventTargetHelper.h index 42fbfa28685..5995dd306f1 100644 --- a/dom/events/DOMEventTargetHelper.h +++ b/dom/events/DOMEventTargetHelper.h @@ -36,7 +36,7 @@ public: , mHasOrHasHadOwnerWindow(false) { } - DOMEventTargetHelper(nsPIDOMWindow* aWindow) + explicit DOMEventTargetHelper(nsPIDOMWindow* aWindow) : mParentObject(nullptr) , mOwnerWindow(nullptr) , mHasOrHasHadOwnerWindow(false) @@ -45,7 +45,7 @@ public: // All objects coming through here are WebIDL objects SetIsDOMBinding(); } - DOMEventTargetHelper(DOMEventTargetHelper* aOther) + explicit DOMEventTargetHelper(DOMEventTargetHelper* aOther) : mParentObject(nullptr) , mOwnerWindow(nullptr) , mHasOrHasHadOwnerWindow(false) diff --git a/dom/events/Event.h b/dom/events/Event.h index 1736f96eedf..5eefc5c72b6 100644 --- a/dom/events/Event.h +++ b/dom/events/Event.h @@ -44,7 +44,7 @@ public: Event(EventTarget* aOwner, nsPresContext* aPresContext, WidgetEvent* aEvent); - Event(nsPIDOMWindow* aWindow); + explicit Event(nsPIDOMWindow* aWindow); protected: virtual ~Event(); diff --git a/dom/events/EventDispatcher.h b/dom/events/EventDispatcher.h index c886481a2d7..546961f6c0e 100644 --- a/dom/events/EventDispatcher.h +++ b/dom/events/EventDispatcher.h @@ -198,7 +198,7 @@ public: class EventChainPostVisitor : public mozilla::EventChainVisitor { public: - EventChainPostVisitor(EventChainVisitor& aOther) + explicit EventChainPostVisitor(EventChainVisitor& aOther) : EventChainVisitor(aOther.mPresContext, aOther.mEvent, aOther.mDOMEvent, aOther.mEventStatus) { diff --git a/dom/events/EventListenerManager.h b/dom/events/EventListenerManager.h index 4f7ec1571f1..369e544c8c0 100644 --- a/dom/events/EventListenerManager.h +++ b/dom/events/EventListenerManager.h @@ -211,7 +211,7 @@ public: } }; - EventListenerManager(dom::EventTarget* aTarget); + explicit EventListenerManager(dom::EventTarget* aTarget); NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(EventListenerManager) diff --git a/dom/events/JSEventHandler.h b/dom/events/JSEventHandler.h index 2b6a8b4b216..6a25e401aaa 100644 --- a/dom/events/JSEventHandler.h +++ b/dom/events/JSEventHandler.h @@ -35,17 +35,17 @@ public: { } - TypedEventHandler(dom::EventHandlerNonNull* aHandler) + explicit TypedEventHandler(dom::EventHandlerNonNull* aHandler) { Assign(aHandler, eNormal); } - TypedEventHandler(dom::OnErrorEventHandlerNonNull* aHandler) + explicit TypedEventHandler(dom::OnErrorEventHandlerNonNull* aHandler) { Assign(aHandler, eOnError); } - TypedEventHandler(dom::OnBeforeUnloadEventHandlerNonNull* aHandler) + explicit TypedEventHandler(dom::OnBeforeUnloadEventHandlerNonNull* aHandler) { Assign(aHandler, eOnBeforeUnload); } diff --git a/dom/events/StorageEvent.h b/dom/events/StorageEvent.h index 26518f95252..447c3c24506 100644 --- a/dom/events/StorageEvent.h +++ b/dom/events/StorageEvent.h @@ -28,7 +28,7 @@ public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(StorageEvent, Event) - StorageEvent(EventTarget* aOwner); + explicit StorageEvent(EventTarget* aOwner); protected: virtual ~StorageEvent(); diff --git a/dom/indexedDB/FileInfo.h b/dom/indexedDB/FileInfo.h index 51512e01ce2..9272bd16d7c 100644 --- a/dom/indexedDB/FileInfo.h +++ b/dom/indexedDB/FileInfo.h @@ -19,7 +19,7 @@ class FileInfo friend class FileManager; public: - FileInfo(FileManager* aFileManager) + explicit FileInfo(FileManager* aFileManager) : mFileManager(aFileManager) { } diff --git a/dom/indexedDB/IDBRequest.h b/dom/indexedDB/IDBRequest.h index 8aef8070000..d628b5a7998 100644 --- a/dom/indexedDB/IDBRequest.h +++ b/dom/indexedDB/IDBRequest.h @@ -153,8 +153,8 @@ public: IMPL_EVENT_HANDLER(error); protected: - IDBRequest(IDBDatabase* aDatabase); - IDBRequest(nsPIDOMWindow* aOwner); + explicit IDBRequest(IDBDatabase* aDatabase); + explicit IDBRequest(nsPIDOMWindow* aOwner); ~IDBRequest(); // At most one of these three fields can be non-null. @@ -221,7 +221,7 @@ public: IMPL_EVENT_HANDLER(upgradeneeded); protected: - IDBOpenDBRequest(nsPIDOMWindow* aOwner); + explicit IDBOpenDBRequest(nsPIDOMWindow* aOwner); ~IDBOpenDBRequest(); // Only touched on the main thread. diff --git a/dom/indexedDB/IDBWrapperCache.h b/dom/indexedDB/IDBWrapperCache.h index 61bb224d710..129cc0b3129 100644 --- a/dom/indexedDB/IDBWrapperCache.h +++ b/dom/indexedDB/IDBWrapperCache.h @@ -35,10 +35,10 @@ public: #endif protected: - IDBWrapperCache(DOMEventTargetHelper* aOwner) + explicit IDBWrapperCache(DOMEventTargetHelper* aOwner) : DOMEventTargetHelper(aOwner), mScriptOwner(nullptr) { } - IDBWrapperCache(nsPIDOMWindow* aOwner) + explicit IDBWrapperCache(nsPIDOMWindow* aOwner) : DOMEventTargetHelper(aOwner), mScriptOwner(nullptr) { } diff --git a/dom/ipc/ContentBridgeParent.h b/dom/ipc/ContentBridgeParent.h index 85fc9277049..13fd8d9b92e 100644 --- a/dom/ipc/ContentBridgeParent.h +++ b/dom/ipc/ContentBridgeParent.h @@ -17,7 +17,7 @@ class ContentBridgeParent : public PContentBridgeParent , public nsIContentParent { public: - ContentBridgeParent(Transport* aTransport); + explicit ContentBridgeParent(Transport* aTransport); NS_DECL_ISUPPORTS diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 5f2bfcd9fea..96c08893e19 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -3526,7 +3526,7 @@ ContentParent::DoSendAsyncMessage(JSContext* aCx, if (aCpows && !GetCPOWManager()->Wrap(aCx, aCpows, &cpows)) { return false; } - return SendAsyncMessage(nsString(aMessage), data, cpows, aPrincipal); + return SendAsyncMessage(nsString(aMessage), data, cpows, Principal(aPrincipal)); } bool diff --git a/dom/ipc/PermissionMessageUtils.h b/dom/ipc/PermissionMessageUtils.h index 16f7c7192ff..af81165f9ec 100644 --- a/dom/ipc/PermissionMessageUtils.h +++ b/dom/ipc/PermissionMessageUtils.h @@ -17,7 +17,7 @@ class Principal { public: Principal() : mPrincipal(nullptr) {} - Principal(nsIPrincipal* aPrincipal) : mPrincipal(aPrincipal) {} + explicit Principal(nsIPrincipal* aPrincipal) : mPrincipal(aPrincipal) {} operator nsIPrincipal*() const { return mPrincipal.get(); } private: diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 3628698e8d0..0837e97db51 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -2783,11 +2783,11 @@ TabChild::DoSendBlockingMessage(JSContext* aCx, } if (aIsSync) { return SendSyncMessage(PromiseFlatString(aMessage), data, cpows, - aPrincipal, aJSONRetVal); + Principal(aPrincipal), aJSONRetVal); } return CallRpcMessage(PromiseFlatString(aMessage), data, cpows, - aPrincipal, aJSONRetVal); + Principal(aPrincipal), aJSONRetVal); } bool @@ -2808,7 +2808,7 @@ TabChild::DoSendAsyncMessage(JSContext* aCx, } } return SendAsyncMessage(PromiseFlatString(aMessage), data, cpows, - aPrincipal); + Principal(aPrincipal)); } TabChild* diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 8559ee9fea0..b0c01785fd7 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -62,7 +62,7 @@ class TabChildGlobal : public DOMEventTargetHelper, public nsIGlobalObject { public: - TabChildGlobal(TabChildBase* aTabChild); + explicit TabChildGlobal(TabChildBase* aTabChild); void Init(); NS_DECL_ISUPPORTS_INHERITED NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, DOMEventTargetHelper) @@ -147,7 +147,7 @@ protected: class ContentListener MOZ_FINAL : public nsIDOMEventListener { public: - ContentListener(TabChild* aTabChild) : mTabChild(aTabChild) {} + explicit ContentListener(TabChild* aTabChild) : mTabChild(aTabChild) {} NS_DECL_ISUPPORTS NS_DECL_NSIDOMEVENTLISTENER protected: diff --git a/dom/ipc/TabContext.h b/dom/ipc/TabContext.h index 1da69c8fe1d..309e34c252d 100644 --- a/dom/ipc/TabContext.h +++ b/dom/ipc/TabContext.h @@ -254,7 +254,7 @@ public: * This constructor copies the information in aContext and sets IsValid() as * appropriate. */ - MaybeInvalidTabContext(const IPCTabContext& aContext); + explicit MaybeInvalidTabContext(const IPCTabContext& aContext); /** * Was the IPCTabContext we received in our constructor valid? diff --git a/dom/xbl/nsBindingManager.h b/dom/xbl/nsBindingManager.h index 1dd5855d234..5e23fc223f1 100644 --- a/dom/xbl/nsBindingManager.h +++ b/dom/xbl/nsBindingManager.h @@ -47,7 +47,7 @@ public: NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED - nsBindingManager(nsIDocument* aDocument); + explicit nsBindingManager(nsIDocument* aDocument); nsXBLBinding* GetBindingWithContent(nsIContent* aContent); diff --git a/dom/xbl/nsXBLBinding.h b/dom/xbl/nsXBLBinding.h index fe216102353..238575cb64a 100644 --- a/dom/xbl/nsXBLBinding.h +++ b/dom/xbl/nsXBLBinding.h @@ -40,7 +40,7 @@ class nsAnonymousContentList; class nsXBLBinding MOZ_FINAL { public: - nsXBLBinding(nsXBLPrototypeBinding* aProtoBinding); + explicit nsXBLBinding(nsXBLPrototypeBinding* aProtoBinding); nsXBLBinding(mozilla::dom::ShadowRoot* aShadowRoot, nsXBLPrototypeBinding* aProtoBinding); /** diff --git a/ipc/glue/GeckoChildProcessHost.h b/ipc/glue/GeckoChildProcessHost.h index 0ee598a5055..885ea411875 100644 --- a/ipc/glue/GeckoChildProcessHost.h +++ b/ipc/glue/GeckoChildProcessHost.h @@ -41,8 +41,8 @@ public: static ChildPrivileges DefaultChildPrivileges(); - GeckoChildProcessHost(GeckoProcessType aProcessType, - ChildPrivileges aPrivileges=base::PRIVILEGES_DEFAULT); + explicit GeckoChildProcessHost(GeckoProcessType aProcessType, + ChildPrivileges aPrivileges=base::PRIVILEGES_DEFAULT); ~GeckoChildProcessHost(); From 77dfc12d570853532f97f5ec5618d34febb6e3c9 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 5 Aug 2014 09:20:24 -0400 Subject: [PATCH 25/60] Bug 1048271 - Fix more bad implicit constructors in netwerk; r=mcmanus --- netwerk/base/public/nsStreamListenerWrapper.h | 2 +- netwerk/base/src/Predictor.cpp | 2 +- netwerk/base/src/nsAsyncStreamCopier.cpp | 2 +- netwerk/base/src/nsBaseChannel.cpp | 2 +- netwerk/base/src/nsBaseContentStream.h | 2 +- netwerk/base/src/nsIOService.cpp | 2 +- netwerk/base/src/nsLoadGroup.cpp | 2 +- netwerk/base/src/nsLoadGroup.h | 2 +- netwerk/base/src/nsMediaFragmentURIParser.h | 4 ++-- netwerk/base/src/nsPACMan.cpp | 6 +++--- netwerk/base/src/nsRequestObserverProxy.h | 2 +- netwerk/base/src/nsServerSocket.cpp | 2 +- netwerk/base/src/nsSimpleNestedURI.h | 2 +- netwerk/base/src/nsStandardURL.h | 4 ++-- netwerk/base/src/nsTemporaryFileInputStream.h | 2 +- netwerk/base/src/nsUDPSocket.cpp | 2 +- netwerk/cache/nsCacheEntry.h | 2 +- netwerk/cache/nsCacheService.cpp | 6 +++--- netwerk/cache/nsCacheService.h | 2 +- netwerk/cache/nsCacheUtils.cpp | 2 +- netwerk/cache/nsCacheUtils.h | 2 +- netwerk/cache/nsDiskCacheDevice.cpp | 4 ++-- netwerk/cache/nsDiskCacheDeviceSQL.cpp | 6 +++--- netwerk/cache/nsDiskCacheDeviceSQL.h | 2 +- netwerk/cache/nsDiskCacheStreams.h | 2 +- netwerk/cache/nsMemoryCacheDevice.h | 2 +- netwerk/cache2/CacheEntry.h | 4 ++-- netwerk/cache2/CacheFile.cpp | 4 ++-- netwerk/cache2/CacheFile.h | 2 +- netwerk/cache2/CacheFileIOManager.cpp | 2 +- netwerk/cache2/CacheFileIOManager.h | 2 +- netwerk/cache2/CacheFileInputStream.h | 2 +- netwerk/cache2/CacheHashUtils.h | 2 +- netwerk/cache2/CacheIndex.cpp | 4 ++-- netwerk/cache2/CacheIndex.h | 8 ++++---- netwerk/cache2/CacheStorage.h | 2 +- netwerk/cache2/CacheStorageService.cpp | 6 +++--- netwerk/cache2/CacheStorageService.h | 4 ++-- netwerk/cache2/OldWrappers.cpp | 6 +++--- netwerk/cache2/OldWrappers.h | 6 +++--- netwerk/cookie/nsCookieService.cpp | 14 +++++++------- netwerk/cookie/nsCookieService.h | 4 ++-- netwerk/dns/nsDNSService2.cpp | 4 ++-- netwerk/dns/nsEffectiveTLDService.h | 2 +- netwerk/dns/nsHostResolver.h | 6 +++--- netwerk/ipc/RemoteOpenFileParent.h | 2 +- netwerk/protocol/data/nsDataChannel.h | 2 +- netwerk/protocol/file/nsFileChannel.h | 2 +- netwerk/protocol/ftp/FTPChannelChild.cpp | 4 ++-- netwerk/protocol/ftp/nsFTPChannel.cpp | 2 +- netwerk/protocol/http/Http2Session.h | 2 +- netwerk/protocol/http/HttpChannelChild.cpp | 6 +++--- netwerk/protocol/http/HttpChannelParentListener.h | 2 +- netwerk/protocol/http/SpdySession3.h | 2 +- netwerk/protocol/http/SpdySession31.h | 2 +- netwerk/protocol/http/TunnelUtils.cpp | 6 +++--- netwerk/protocol/http/nsHttpChannel.cpp | 2 +- netwerk/protocol/http/nsHttpTransaction.cpp | 2 +- .../protocol/websocket/WebSocketChannelChild.cpp | 2 +- netwerk/protocol/websocket/WebSocketChannelChild.h | 2 +- netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp | 4 ++-- netwerk/sctp/datachannel/DataChannel.h | 2 +- netwerk/socket/nsSOCKSSocketProvider.h | 2 +- netwerk/wifi/nsWifiMonitor.h | 2 +- 64 files changed, 102 insertions(+), 102 deletions(-) diff --git a/netwerk/base/public/nsStreamListenerWrapper.h b/netwerk/base/public/nsStreamListenerWrapper.h index af9bd2bcedc..2db58e51c81 100644 --- a/netwerk/base/public/nsStreamListenerWrapper.h +++ b/netwerk/base/public/nsStreamListenerWrapper.h @@ -17,7 +17,7 @@ class nsStreamListenerWrapper MOZ_FINAL : public nsIStreamListener , public nsIThreadRetargetableStreamListener { public: - nsStreamListenerWrapper(nsIStreamListener *listener) + explicit nsStreamListenerWrapper(nsIStreamListener *listener) : mListener(listener) { NS_ASSERTION(mListener, "no stream listener specified"); diff --git a/netwerk/base/src/Predictor.cpp b/netwerk/base/src/Predictor.cpp index 007c0682d10..08904e7ad0a 100644 --- a/netwerk/base/src/Predictor.cpp +++ b/netwerk/base/src/Predictor.cpp @@ -803,7 +803,7 @@ Predictor::EnsureInitStorage() class PredictorThreadShutdownRunner : public nsRunnable { public: - PredictorThreadShutdownRunner(nsIThread *ioThread) + explicit PredictorThreadShutdownRunner(nsIThread *ioThread) :mIOThread(ioThread) { } diff --git a/netwerk/base/src/nsAsyncStreamCopier.cpp b/netwerk/base/src/nsAsyncStreamCopier.cpp index c415368cc44..c92fede2d24 100644 --- a/netwerk/base/src/nsAsyncStreamCopier.cpp +++ b/netwerk/base/src/nsAsyncStreamCopier.cpp @@ -31,7 +31,7 @@ public: * @param aCopier * The nsAsyncStreamCopier requesting the information. */ - AsyncApplyBufferingPolicyEvent(nsAsyncStreamCopier* aCopier) + explicit AsyncApplyBufferingPolicyEvent(nsAsyncStreamCopier* aCopier) : mCopier(aCopier) , mTarget(NS_GetCurrentThread()) { } diff --git a/netwerk/base/src/nsBaseChannel.cpp b/netwerk/base/src/nsBaseChannel.cpp index 119b59877da..c339c7c9a7a 100644 --- a/netwerk/base/src/nsBaseChannel.cpp +++ b/netwerk/base/src/nsBaseChannel.cpp @@ -27,7 +27,7 @@ CopyProperties(const nsAString &key, nsIVariant *data, void *closure) // This class is used to suspend a request across a function scope. class ScopedRequestSuspender { public: - ScopedRequestSuspender(nsIRequest *request) + explicit ScopedRequestSuspender(nsIRequest *request) : mRequest(request) { if (mRequest && NS_FAILED(mRequest->Suspend())) { NS_WARNING("Couldn't suspend pump"); diff --git a/netwerk/base/src/nsBaseContentStream.h b/netwerk/base/src/nsBaseContentStream.h index a8708cae637..992c8733ece 100644 --- a/netwerk/base/src/nsBaseContentStream.h +++ b/netwerk/base/src/nsBaseContentStream.h @@ -40,7 +40,7 @@ public: NS_DECL_NSIINPUTSTREAM NS_DECL_NSIASYNCINPUTSTREAM - nsBaseContentStream(bool nonBlocking) + explicit nsBaseContentStream(bool nonBlocking) : mStatus(NS_OK) , mNonBlocking(nonBlocking) { } diff --git a/netwerk/base/src/nsIOService.cpp b/netwerk/base/src/nsIOService.cpp index 02c0e9c2c34..de9a726b391 100644 --- a/netwerk/base/src/nsIOService.cpp +++ b/netwerk/base/src/nsIOService.cpp @@ -497,7 +497,7 @@ nsIOService::GetProtocolFlags(const char* scheme, uint32_t *flags) class AutoIncrement { public: - AutoIncrement(uint32_t *var) : mVar(var) + explicit AutoIncrement(uint32_t *var) : mVar(var) { ++*var; } diff --git a/netwerk/base/src/nsLoadGroup.cpp b/netwerk/base/src/nsLoadGroup.cpp index c238207925b..58d150d1f01 100644 --- a/netwerk/base/src/nsLoadGroup.cpp +++ b/netwerk/base/src/nsLoadGroup.cpp @@ -50,7 +50,7 @@ static PRLogModuleInfo* gLoadGroupLog = nullptr; class RequestMapEntry : public PLDHashEntryHdr { public: - RequestMapEntry(nsIRequest *aRequest) : + explicit RequestMapEntry(nsIRequest *aRequest) : mKey(aRequest) { } diff --git a/netwerk/base/src/nsLoadGroup.h b/netwerk/base/src/nsLoadGroup.h index 988f3dbd07a..28d4c29a9c5 100644 --- a/netwerk/base/src/nsLoadGroup.h +++ b/netwerk/base/src/nsLoadGroup.h @@ -49,7 +49,7 @@ public: //////////////////////////////////////////////////////////////////////////// // nsLoadGroup methods: - nsLoadGroup(nsISupports* outer); + explicit nsLoadGroup(nsISupports* outer); nsresult Init(); diff --git a/netwerk/base/src/nsMediaFragmentURIParser.h b/netwerk/base/src/nsMediaFragmentURIParser.h index 837a28db969..e80a2b4c73d 100644 --- a/netwerk/base/src/nsMediaFragmentURIParser.h +++ b/netwerk/base/src/nsMediaFragmentURIParser.h @@ -33,10 +33,10 @@ class nsMediaFragmentURIParser { public: // Create a parser with the provided URI. - nsMediaFragmentURIParser(nsIURI* aURI); + explicit nsMediaFragmentURIParser(nsIURI* aURI); // Create a parser with the provided URI reference portion. - nsMediaFragmentURIParser(nsCString& aRef); + explicit nsMediaFragmentURIParser(nsCString& aRef); // True if a valid temporal media fragment indicated a start time. bool HasStartTime() const { return !mStart.empty(); } diff --git a/netwerk/base/src/nsPACMan.cpp b/netwerk/base/src/nsPACMan.cpp index 6dff4fad555..0bc551c5081 100644 --- a/netwerk/base/src/nsPACMan.cpp +++ b/netwerk/base/src/nsPACMan.cpp @@ -97,7 +97,7 @@ private: class ShutdownThread MOZ_FINAL : public nsRunnable { public: - ShutdownThread(nsIThread *thread) + explicit ShutdownThread(nsIThread *thread) : mThread(thread) { } @@ -122,7 +122,7 @@ private: class PACLoadComplete MOZ_FINAL : public nsRunnable { public: - PACLoadComplete(nsPACMan *aPACMan) + explicit PACLoadComplete(nsPACMan *aPACMan) : mPACMan(aPACMan) { } @@ -149,7 +149,7 @@ class ExecutePACThreadAction MOZ_FINAL : public nsRunnable { public: // by default we just process the queue - ExecutePACThreadAction(nsPACMan *aPACMan) + explicit ExecutePACThreadAction(nsPACMan *aPACMan) : mPACMan(aPACMan) , mCancel(false) , mSetupPAC(false) diff --git a/netwerk/base/src/nsRequestObserverProxy.h b/netwerk/base/src/nsRequestObserverProxy.h index 448e98a47f7..9379268b207 100644 --- a/netwerk/base/src/nsRequestObserverProxy.h +++ b/netwerk/base/src/nsRequestObserverProxy.h @@ -41,7 +41,7 @@ protected: class nsARequestObserverEvent : public nsRunnable { public: - nsARequestObserverEvent(nsIRequest *); + explicit nsARequestObserverEvent(nsIRequest *); protected: virtual ~nsARequestObserverEvent() {} diff --git a/netwerk/base/src/nsServerSocket.cpp b/netwerk/base/src/nsServerSocket.cpp index 2dab5eb8066..eb7317d3abd 100644 --- a/netwerk/base/src/nsServerSocket.cpp +++ b/netwerk/base/src/nsServerSocket.cpp @@ -410,7 +410,7 @@ class ServerSocketListenerProxy MOZ_FINAL : public nsIServerSocketListener ~ServerSocketListenerProxy() {} public: - ServerSocketListenerProxy(nsIServerSocketListener* aListener) + explicit ServerSocketListenerProxy(nsIServerSocketListener* aListener) : mListener(new nsMainThreadPtrHolder(aListener)) , mTargetThread(do_GetCurrentThread()) { } diff --git a/netwerk/base/src/nsSimpleNestedURI.h b/netwerk/base/src/nsSimpleNestedURI.h index ab1322645a7..d7e5e1308be 100644 --- a/netwerk/base/src/nsSimpleNestedURI.h +++ b/netwerk/base/src/nsSimpleNestedURI.h @@ -35,7 +35,7 @@ public: // Constructor that should generally be used when constructing an object of // this class with |operator new|. - nsSimpleNestedURI(nsIURI* innerURI); + explicit nsSimpleNestedURI(nsIURI* innerURI); NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSINESTEDURI diff --git a/netwerk/base/src/nsStandardURL.h b/netwerk/base/src/nsStandardURL.h index e70578f87b2..635bfdf4d80 100644 --- a/netwerk/base/src/nsStandardURL.h +++ b/netwerk/base/src/nsStandardURL.h @@ -61,7 +61,7 @@ public: virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; - nsStandardURL(bool aSupportsFileURL = false); + explicit nsStandardURL(bool aSupportsFileURL = false); static void InitGlobalObjects(); static void ShutdownGlobalObjects(); @@ -111,7 +111,7 @@ public: /* internal -- HPUX compiler can't handle this being private */ class nsSegmentEncoder { public: - nsSegmentEncoder(const char *charset); + explicit nsSegmentEncoder(const char *charset); // Encode the given segment if necessary, and return the length of // the encoded segment. The encoded segment is appended to |buf| diff --git a/netwerk/base/src/nsTemporaryFileInputStream.h b/netwerk/base/src/nsTemporaryFileInputStream.h index 2b124cd21e2..d63f48b288f 100644 --- a/netwerk/base/src/nsTemporaryFileInputStream.h +++ b/netwerk/base/src/nsTemporaryFileInputStream.h @@ -20,7 +20,7 @@ public: friend class nsTemporaryFileInputStream; public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FileDescOwner) - FileDescOwner(PRFileDesc* aFD) + explicit FileDescOwner(PRFileDesc* aFD) : mFD(aFD), mMutex("FileDescOwner::mMutex") { diff --git a/netwerk/base/src/nsUDPSocket.cpp b/netwerk/base/src/nsUDPSocket.cpp index 481c0766cfb..7a9705674aa 100644 --- a/netwerk/base/src/nsUDPSocket.cpp +++ b/netwerk/base/src/nsUDPSocket.cpp @@ -685,7 +685,7 @@ class SocketListenerProxy MOZ_FINAL : public nsIUDPSocketListener ~SocketListenerProxy() {} public: - SocketListenerProxy(nsIUDPSocketListener* aListener) + explicit SocketListenerProxy(nsIUDPSocketListener* aListener) : mListener(new nsMainThreadPtrHolder(aListener)) , mTargetThread(do_GetCurrentThread()) { } diff --git a/netwerk/cache/nsCacheEntry.h b/netwerk/cache/nsCacheEntry.h index 408edf811a8..6772ab513b8 100644 --- a/netwerk/cache/nsCacheEntry.h +++ b/netwerk/cache/nsCacheEntry.h @@ -238,7 +238,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSICACHEENTRYINFO - nsCacheEntryInfo(nsCacheEntry* entry) + explicit nsCacheEntryInfo(nsCacheEntry* entry) : mCacheEntry(entry) { } diff --git a/netwerk/cache/nsCacheService.cpp b/netwerk/cache/nsCacheService.cpp index f941596e79b..2e5eebdc200 100644 --- a/netwerk/cache/nsCacheService.cpp +++ b/netwerk/cache/nsCacheService.cpp @@ -227,7 +227,7 @@ NS_IMPL_ISUPPORTS(nsSetDiskSmartSizeCallback, nsITimerCallback) class nsSetSmartSizeEvent: public nsRunnable { public: - nsSetSmartSizeEvent(int32_t smartSize) + explicit nsSetSmartSizeEvent(int32_t smartSize) : mSmartSize(smartSize) {} NS_IMETHOD Run() @@ -974,7 +974,7 @@ nsCacheProfilePrefObserver::CacheCompressionLevel() class nsProcessRequestEvent : public nsRunnable { public: - nsProcessRequestEvent(nsCacheRequest *aRequest) + explicit nsProcessRequestEvent(nsCacheRequest *aRequest) { MOZ_EVENT_TRACER_NAME_OBJECT(aRequest, aRequest->mKey.get()); MOZ_EVENT_TRACER_WAIT(aRequest, "net::cache::ProcessRequest"); @@ -1347,7 +1347,7 @@ namespace { class EvictionNotifierRunnable : public nsRunnable { public: - EvictionNotifierRunnable(nsISupports* aSubject) + explicit EvictionNotifierRunnable(nsISupports* aSubject) : mSubject(aSubject) { } diff --git a/netwerk/cache/nsCacheService.h b/netwerk/cache/nsCacheService.h index f6f44447d53..a54b584f85b 100644 --- a/netwerk/cache/nsCacheService.h +++ b/netwerk/cache/nsCacheService.h @@ -393,7 +393,7 @@ private: // execution scope. class nsCacheServiceAutoLock { public: - nsCacheServiceAutoLock(mozilla::Telemetry::ID mainThreadLockerID) { + explicit nsCacheServiceAutoLock(mozilla::Telemetry::ID mainThreadLockerID) { nsCacheService::Lock(mainThreadLockerID); } ~nsCacheServiceAutoLock() { diff --git a/netwerk/cache/nsCacheUtils.cpp b/netwerk/cache/nsCacheUtils.cpp index 89f04506866..536052ada67 100644 --- a/netwerk/cache/nsCacheUtils.cpp +++ b/netwerk/cache/nsCacheUtils.cpp @@ -12,7 +12,7 @@ using namespace mozilla; class nsDestroyThreadEvent : public nsRunnable { public: - nsDestroyThreadEvent(nsIThread *thread) + explicit nsDestroyThreadEvent(nsIThread *thread) : mThread(thread) {} NS_IMETHOD Run() diff --git a/netwerk/cache/nsCacheUtils.h b/netwerk/cache/nsCacheUtils.h index 611a41575e3..1ce27de8b4c 100644 --- a/netwerk/cache/nsCacheUtils.h +++ b/netwerk/cache/nsCacheUtils.h @@ -19,7 +19,7 @@ class nsIThread; */ class nsShutdownThread : public nsRunnable { public: - nsShutdownThread(nsIThread *aThread); + explicit nsShutdownThread(nsIThread *aThread); ~nsShutdownThread(); NS_IMETHOD Run(); diff --git a/netwerk/cache/nsDiskCacheDevice.cpp b/netwerk/cache/nsDiskCacheDevice.cpp index 3adc71e351f..771414107f9 100644 --- a/netwerk/cache/nsDiskCacheDevice.cpp +++ b/netwerk/cache/nsDiskCacheDevice.cpp @@ -84,7 +84,7 @@ private: class nsEvictDiskCacheEntriesEvent : public nsRunnable { public: - nsEvictDiskCacheEntriesEvent(nsDiskCacheDevice *device) + explicit nsEvictDiskCacheEntriesEvent(nsDiskCacheDevice *device) : mDevice(device) {} NS_IMETHOD Run() @@ -182,7 +182,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSICACHEDEVICEINFO - nsDiskCacheDeviceInfo(nsDiskCacheDevice* device) + explicit nsDiskCacheDeviceInfo(nsDiskCacheDevice* device) : mDevice(device) { } diff --git a/netwerk/cache/nsDiskCacheDeviceSQL.cpp b/netwerk/cache/nsDiskCacheDeviceSQL.cpp index 50706cbd0e8..57f6728e867 100644 --- a/netwerk/cache/nsDiskCacheDeviceSQL.cpp +++ b/netwerk/cache/nsDiskCacheDeviceSQL.cpp @@ -91,7 +91,7 @@ DecomposeCacheEntryKey(const nsCString *fullKey, class AutoResetStatement { public: - AutoResetStatement(mozIStorageStatement *s) + explicit AutoResetStatement(mozIStorageStatement *s) : mStatement(s) {} ~AutoResetStatement() { mStatement->Reset(); } mozIStorageStatement *operator->() { return mStatement; } @@ -275,7 +275,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSICACHEDEVICEINFO - nsOfflineCacheDeviceInfo(nsOfflineCacheDevice* device) + explicit nsOfflineCacheDeviceInfo(nsOfflineCacheDevice* device) : mDevice(device) {} @@ -861,7 +861,7 @@ nsApplicationCache::GetUsage(uint32_t *usage) class nsCloseDBEvent : public nsRunnable { public: - nsCloseDBEvent(mozIStorageConnection *aDB) + explicit nsCloseDBEvent(mozIStorageConnection *aDB) { mDB = aDB; } diff --git a/netwerk/cache/nsDiskCacheDeviceSQL.h b/netwerk/cache/nsDiskCacheDeviceSQL.h index 2f16a3f6271..895068b5ef5 100644 --- a/netwerk/cache/nsDiskCacheDeviceSQL.h +++ b/netwerk/cache/nsDiskCacheDeviceSQL.h @@ -47,7 +47,7 @@ public: NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGEFUNCTION - nsOfflineCacheEvictionFunction(nsOfflineCacheDevice *device) + explicit nsOfflineCacheEvictionFunction(nsOfflineCacheDevice *device) : mDevice(device) {} diff --git a/netwerk/cache/nsDiskCacheStreams.h b/netwerk/cache/nsDiskCacheStreams.h index 8cde75db091..5017eed8072 100644 --- a/netwerk/cache/nsDiskCacheStreams.h +++ b/netwerk/cache/nsDiskCacheStreams.h @@ -23,7 +23,7 @@ class nsDiskCacheDevice; class nsDiskCacheStreamIO : public nsIOutputStream { public: - nsDiskCacheStreamIO(nsDiskCacheBinding * binding); + explicit nsDiskCacheStreamIO(nsDiskCacheBinding * binding); NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOUTPUTSTREAM diff --git a/netwerk/cache/nsMemoryCacheDevice.h b/netwerk/cache/nsMemoryCacheDevice.h index 472fb9483d4..165a2b76438 100644 --- a/netwerk/cache/nsMemoryCacheDevice.h +++ b/netwerk/cache/nsMemoryCacheDevice.h @@ -110,7 +110,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSICACHEDEVICEINFO - nsMemoryCacheDeviceInfo(nsMemoryCacheDevice* device) + explicit nsMemoryCacheDeviceInfo(nsMemoryCacheDevice* device) : mDevice(device) { } diff --git a/netwerk/cache2/CacheEntry.h b/netwerk/cache2/CacheEntry.h index bd4db8a577a..0235b157d89 100644 --- a/netwerk/cache2/CacheEntry.h +++ b/netwerk/cache2/CacheEntry.h @@ -354,7 +354,7 @@ private: class CacheEntryHandle : public nsICacheEntry { public: - CacheEntryHandle(CacheEntry* aEntry); + explicit CacheEntryHandle(CacheEntry* aEntry); CacheEntry* Entry() const { return mEntry; } NS_DECL_THREADSAFE_ISUPPORTS @@ -376,7 +376,7 @@ private: virtual ~CacheOutputCloseListener(); NS_DECL_NSIRUNNABLE - CacheOutputCloseListener(CacheEntry* aEntry); + explicit CacheOutputCloseListener(CacheEntry* aEntry); private: nsRefPtr mEntry; diff --git a/netwerk/cache2/CacheFile.cpp b/netwerk/cache2/CacheFile.cpp index a398bb3941b..a5766fb6045 100644 --- a/netwerk/cache2/CacheFile.cpp +++ b/netwerk/cache2/CacheFile.cpp @@ -110,7 +110,7 @@ class DoomFileHelper : public CacheFileIOListener public: NS_DECL_THREADSAFE_ISUPPORTS - DoomFileHelper(CacheFileListener *aListener) + explicit DoomFileHelper(CacheFileListener *aListener) : mListener(aListener) { MOZ_COUNT_CTOR(DoomFileHelper); @@ -409,7 +409,7 @@ CacheFile::OnFileOpened(CacheFileHandle *aHandle, nsresult aResult) class AutoFailDoomListener { public: - AutoFailDoomListener(CacheFileHandle *aHandle) + explicit AutoFailDoomListener(CacheFileHandle *aHandle) : mHandle(aHandle) , mAlreadyDoomed(false) {} diff --git a/netwerk/cache2/CacheFile.h b/netwerk/cache2/CacheFile.h index d9f9f71a7dc..5c4e0f4de11 100644 --- a/netwerk/cache2/CacheFile.h +++ b/netwerk/cache2/CacheFile.h @@ -219,7 +219,7 @@ private: class CacheFileAutoLock { public: - CacheFileAutoLock(CacheFile *aFile) + explicit CacheFileAutoLock(CacheFile *aFile) : mFile(aFile) , mLocked(true) { diff --git a/netwerk/cache2/CacheFileIOManager.cpp b/netwerk/cache2/CacheFileIOManager.cpp index db49a238718..08aa54be8bf 100644 --- a/netwerk/cache2/CacheFileIOManager.cpp +++ b/netwerk/cache2/CacheFileIOManager.cpp @@ -906,7 +906,7 @@ protected: class ReleaseNSPRHandleEvent : public nsRunnable { public: - ReleaseNSPRHandleEvent(CacheFileHandle *aHandle) + explicit ReleaseNSPRHandleEvent(CacheFileHandle *aHandle) : mHandle(aHandle) { MOZ_COUNT_CTOR(ReleaseNSPRHandleEvent); diff --git a/netwerk/cache2/CacheFileIOManager.h b/netwerk/cache2/CacheFileIOManager.h index 00c0d454c7b..2ca76ec9497 100644 --- a/netwerk/cache2/CacheFileIOManager.h +++ b/netwerk/cache2/CacheFileIOManager.h @@ -112,7 +112,7 @@ public: typedef const SHA1Sum::Hash& KeyType; typedef const SHA1Sum::Hash* KeyTypePointer; - HandleHashKey(KeyTypePointer aKey) + explicit HandleHashKey(KeyTypePointer aKey) { MOZ_COUNT_CTOR(HandleHashKey); mHash = (SHA1Sum::Hash*)new uint8_t[SHA1Sum::kHashSize]; diff --git a/netwerk/cache2/CacheFileInputStream.h b/netwerk/cache2/CacheFileInputStream.h index a62efdd564b..d920493b859 100644 --- a/netwerk/cache2/CacheFileInputStream.h +++ b/netwerk/cache2/CacheFileInputStream.h @@ -27,7 +27,7 @@ class CacheFileInputStream : public nsIAsyncInputStream NS_DECL_NSISEEKABLESTREAM public: - CacheFileInputStream(CacheFile *aFile); + explicit CacheFileInputStream(CacheFile *aFile); NS_IMETHOD OnChunkRead(nsresult aResult, CacheFileChunk *aChunk); NS_IMETHOD OnChunkWritten(nsresult aResult, CacheFileChunk *aChunk); diff --git a/netwerk/cache2/CacheHashUtils.h b/netwerk/cache2/CacheHashUtils.h index ed3013355d3..4e25e25511b 100644 --- a/netwerk/cache2/CacheHashUtils.h +++ b/netwerk/cache2/CacheHashUtils.h @@ -35,7 +35,7 @@ public: static Hash16_t Hash16(const char* aData, uint32_t aSize, uint32_t aInitval=0); - CacheHash(uint32_t aInitval=0); + explicit CacheHash(uint32_t aInitval=0); void Update(const char *aData, uint32_t aLen); Hash32_t GetHash(); diff --git a/netwerk/cache2/CacheIndex.cpp b/netwerk/cache2/CacheIndex.cpp index 5a0aa9dcab3..aa493e5d635 100644 --- a/netwerk/cache2/CacheIndex.cpp +++ b/netwerk/cache2/CacheIndex.cpp @@ -166,7 +166,7 @@ class FileOpenHelper : public CacheFileIOListener public: NS_DECL_THREADSAFE_ISUPPORTS - FileOpenHelper(CacheIndex* aIndex) + explicit FileOpenHelper(CacheIndex* aIndex) : mIndex(aIndex) , mCanceled(false) {} @@ -1822,7 +1822,7 @@ CacheIndex::RemoveIndexFromDisk() class WriteLogHelper { public: - WriteLogHelper(PRFileDesc *aFD) + explicit WriteLogHelper(PRFileDesc *aFD) : mStatus(NS_OK) , mFD(aFD) , mBufSize(kMaxBufSize) diff --git a/netwerk/cache2/CacheIndex.h b/netwerk/cache2/CacheIndex.h index 928cac3830b..3bf8f286094 100644 --- a/netwerk/cache2/CacheIndex.h +++ b/netwerk/cache2/CacheIndex.h @@ -87,7 +87,7 @@ public: typedef const SHA1Sum::Hash& KeyType; typedef const SHA1Sum::Hash* KeyTypePointer; - CacheIndexEntry(KeyTypePointer aKey) + explicit CacheIndexEntry(KeyTypePointer aKey) { MOZ_COUNT_CTOR(CacheIndexEntry); mRec = new CacheIndexRecord(); @@ -970,7 +970,7 @@ private: } private: - DiskConsumptionObserver(nsWeakPtr const &aWeakObserver) + explicit DiskConsumptionObserver(nsWeakPtr const &aWeakObserver) : mObserver(aWeakObserver) { } virtual ~DiskConsumptionObserver() { } @@ -998,7 +998,7 @@ private: class CacheIndexAutoLock { public: - CacheIndexAutoLock(CacheIndex *aIndex) + explicit CacheIndexAutoLock(CacheIndex *aIndex) : mIndex(aIndex) , mLocked(true) { @@ -1030,7 +1030,7 @@ private: class CacheIndexAutoUnlock { public: - CacheIndexAutoUnlock(CacheIndex *aIndex) + explicit CacheIndexAutoUnlock(CacheIndex *aIndex) : mIndex(aIndex) , mLocked(false) { diff --git a/netwerk/cache2/CacheStorage.h b/netwerk/cache2/CacheStorage.h index d86a9feec59..617af805d46 100644 --- a/netwerk/cache2/CacheStorage.h +++ b/netwerk/cache2/CacheStorage.h @@ -34,7 +34,7 @@ public: ALL_ENTRIES }; - CacheEntryTable(EType aType) : mType(aType) { } + explicit CacheEntryTable(EType aType) : mType(aType) { } EType Type() const { return mType; diff --git a/netwerk/cache2/CacheStorageService.cpp b/netwerk/cache2/CacheStorageService.cpp index 146354570e7..ddd45b1004a 100644 --- a/netwerk/cache2/CacheStorageService.cpp +++ b/netwerk/cache2/CacheStorageService.cpp @@ -357,7 +357,7 @@ private: class OnCacheEntryInfoRunnable : public nsRunnable { public: - OnCacheEntryInfoRunnable(WalkDiskCacheRunnable* aWalker) + explicit OnCacheEntryInfoRunnable(WalkDiskCacheRunnable* aWalker) : mWalker(aWalker) { } @@ -1498,7 +1498,7 @@ class CacheEntryDoomByKeyCallback : public CacheFileIOListener public: NS_DECL_THREADSAFE_ISUPPORTS - CacheEntryDoomByKeyCallback(nsICacheEntryDoomCallback* aCallback) + explicit CacheEntryDoomByKeyCallback(nsICacheEntryDoomCallback* aCallback) : mCallback(aCallback) { } private: @@ -1688,7 +1688,7 @@ CacheStorageService::DoomStorageEntries(nsCSubstring const& aContextKey, class Callback : public nsRunnable { public: - Callback(nsICacheEntryDoomCallback* aCallback) : mCallback(aCallback) { } + explicit Callback(nsICacheEntryDoomCallback* aCallback) : mCallback(aCallback) { } NS_IMETHODIMP Run() { mCallback->OnCacheEntryDoomed(NS_OK); diff --git a/netwerk/cache2/CacheStorageService.h b/netwerk/cache2/CacheStorageService.h index 379deb4e753..f604a5bcf4a 100644 --- a/netwerk/cache2/CacheStorageService.h +++ b/netwerk/cache2/CacheStorageService.h @@ -59,7 +59,7 @@ protected: DONT_REPORT = 1 << 1 }; - CacheMemoryConsumer(uint32_t aFlags); + explicit CacheMemoryConsumer(uint32_t aFlags); ~CacheMemoryConsumer() { DoMemoryReport(0); } void DoMemoryReport(uint32_t aCurrentSize); }; @@ -306,7 +306,7 @@ private: MEMORY, } mType; - MemoryPool(EType aType); + explicit MemoryPool(EType aType); ~MemoryPool(); nsTArray > mFrecencyArray; diff --git a/netwerk/cache2/OldWrappers.cpp b/netwerk/cache2/OldWrappers.cpp index 5b485072e27..1022ed1f920 100644 --- a/netwerk/cache2/OldWrappers.cpp +++ b/netwerk/cache2/OldWrappers.cpp @@ -39,7 +39,7 @@ namespace { // anon class DoomCallbackSynchronizer : public nsRunnable { public: - DoomCallbackSynchronizer(nsICacheEntryDoomCallback* cb) : mCB(cb) + explicit DoomCallbackSynchronizer(nsICacheEntryDoomCallback* cb) : mCB(cb) { MOZ_COUNT_CTOR(DoomCallbackSynchronizer); } @@ -92,7 +92,7 @@ class DoomCallbackWrapper : public nsICacheListener NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICACHELISTENER - DoomCallbackWrapper(nsICacheEntryDoomCallback* cb) : mCB(cb) + explicit DoomCallbackWrapper(nsICacheEntryDoomCallback* cb) : mCB(cb) { MOZ_COUNT_CTOR(DoomCallbackWrapper); } @@ -498,7 +498,7 @@ class MetaDataVisitorWrapper : public nsICacheMetaDataVisitor NS_DECL_ISUPPORTS NS_DECL_NSICACHEMETADATAVISITOR - MetaDataVisitorWrapper(nsICacheEntryMetaDataVisitor* cb) : mCB(cb) {} + explicit MetaDataVisitorWrapper(nsICacheEntryMetaDataVisitor* cb) : mCB(cb) {} nsCOMPtr mCB; }; diff --git a/netwerk/cache2/OldWrappers.h b/netwerk/cache2/OldWrappers.h index 79b05cb1913..98be07e7636 100644 --- a/netwerk/cache2/OldWrappers.h +++ b/netwerk/cache2/OldWrappers.h @@ -45,8 +45,8 @@ public: NS_IMETHOD HasWriteAccess(bool aWriteOnly, bool *aWriteAccess); NS_IMETHOD VisitMetaData(nsICacheEntryMetaDataVisitor*); - _OldCacheEntryWrapper(nsICacheEntryDescriptor* desc); - _OldCacheEntryWrapper(nsICacheEntryInfo* info); + explicit _OldCacheEntryWrapper(nsICacheEntryDescriptor* desc); + explicit _OldCacheEntryWrapper(nsICacheEntryInfo* info); private: virtual ~_OldCacheEntryWrapper(); @@ -162,7 +162,7 @@ public: static nsresult Get(nsICacheStorageConsumptionObserver* aCallback); private: - _OldGetDiskConsumption(nsICacheStorageConsumptionObserver* aCallback); + explicit _OldGetDiskConsumption(nsICacheStorageConsumptionObserver* aCallback); virtual ~_OldGetDiskConsumption() {} NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSICACHEVISITOR diff --git a/netwerk/cookie/nsCookieService.cpp b/netwerk/cookie/nsCookieService.cpp index db32fa5b391..043898dac8e 100644 --- a/netwerk/cookie/nsCookieService.cpp +++ b/netwerk/cookie/nsCookieService.cpp @@ -357,7 +357,7 @@ LogSuccess(bool aSetCookie, nsIURI *aHostURI, const nsAFlatCString &aCookieStrin class DBListenerErrorHandler : public mozIStorageStatementCallback { protected: - DBListenerErrorHandler(DBState* dbState) : mDBState(dbState) { } + explicit DBListenerErrorHandler(DBState* dbState) : mDBState(dbState) { } nsRefPtr mDBState; virtual const char *GetOpType() = 0; @@ -397,7 +397,7 @@ private: public: NS_DECL_ISUPPORTS - InsertCookieDBListener(DBState* dbState) : DBListenerErrorHandler(dbState) { } + explicit InsertCookieDBListener(DBState* dbState) : DBListenerErrorHandler(dbState) { } NS_IMETHOD HandleResult(mozIStorageResultSet*) { NS_NOTREACHED("Unexpected call to InsertCookieDBListener::HandleResult"); @@ -433,7 +433,7 @@ private: public: NS_DECL_ISUPPORTS - UpdateCookieDBListener(DBState* dbState) : DBListenerErrorHandler(dbState) { } + explicit UpdateCookieDBListener(DBState* dbState) : DBListenerErrorHandler(dbState) { } NS_IMETHOD HandleResult(mozIStorageResultSet*) { NS_NOTREACHED("Unexpected call to UpdateCookieDBListener::HandleResult"); @@ -461,7 +461,7 @@ private: public: NS_DECL_ISUPPORTS - RemoveCookieDBListener(DBState* dbState) : DBListenerErrorHandler(dbState) { } + explicit RemoveCookieDBListener(DBState* dbState) : DBListenerErrorHandler(dbState) { } NS_IMETHOD HandleResult(mozIStorageResultSet*) { NS_NOTREACHED("Unexpected call to RemoveCookieDBListener::HandleResult"); @@ -490,7 +490,7 @@ private: public: NS_DECL_ISUPPORTS - ReadCookieDBListener(DBState* dbState) + explicit ReadCookieDBListener(DBState* dbState) : DBListenerErrorHandler(dbState) , mCanceled(false) { @@ -566,7 +566,7 @@ class CloseCookieDBListener MOZ_FINAL : public mozIStorageCompletionCallback ~CloseCookieDBListener() {} public: - CloseCookieDBListener(DBState* dbState) : mDBState(dbState) { } + explicit CloseCookieDBListener(DBState* dbState) : mDBState(dbState) { } nsRefPtr mDBState; NS_DECL_ISUPPORTS @@ -1484,7 +1484,7 @@ RebuildDBCallback(nsCookieEntry *aEntry, nsCookie* cookie = cookies[i]; if (!cookie->IsSession()) { - bindCookieParameters(paramsArray, aEntry, cookie); + bindCookieParameters(paramsArray, nsCookieKey(aEntry), cookie); } } diff --git a/netwerk/cookie/nsCookieService.h b/netwerk/cookie/nsCookieService.h index 50033dd3f0a..4809be87333 100644 --- a/netwerk/cookie/nsCookieService.h +++ b/netwerk/cookie/nsCookieService.h @@ -66,7 +66,7 @@ public: , mInBrowserElement(inBrowser) {} - nsCookieKey(KeyTypePointer other) + explicit nsCookieKey(KeyTypePointer other) : mBaseDomain(other->mBaseDomain) , mAppId(other->mAppId) , mInBrowserElement(other->mInBrowserElement) @@ -122,7 +122,7 @@ class nsCookieEntry : public nsCookieKey typedef nsTArray< nsRefPtr > ArrayType; typedef ArrayType::index_type IndexType; - nsCookieEntry(KeyTypePointer aKey) + explicit nsCookieEntry(KeyTypePointer aKey) : nsCookieKey(aKey) {} diff --git a/netwerk/dns/nsDNSService2.cpp b/netwerk/dns/nsDNSService2.cpp index 573a70e2da9..aafbdb9d89f 100644 --- a/netwerk/dns/nsDNSService2.cpp +++ b/netwerk/dns/nsDNSService2.cpp @@ -57,7 +57,7 @@ public: NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIDNSRECORD - nsDNSRecord(nsHostRecord *hostRecord) + explicit nsDNSRecord(nsHostRecord *hostRecord) : mHostRecord(hostRecord) , mIter(nullptr) , mIterGenCnt(-1) @@ -342,7 +342,7 @@ nsDNSAsyncRequest::Cancel(nsresult reason) class nsDNSSyncRequest : public nsResolveHostCallback { public: - nsDNSSyncRequest(PRMonitor *mon) + explicit nsDNSSyncRequest(PRMonitor *mon) : mDone(false) , mStatus(NS_OK) , mMonitor(mon) {} diff --git a/netwerk/dns/nsEffectiveTLDService.h b/netwerk/dns/nsEffectiveTLDService.h index e900efdf14d..e807e46015b 100644 --- a/netwerk/dns/nsEffectiveTLDService.h +++ b/netwerk/dns/nsEffectiveTLDService.h @@ -36,7 +36,7 @@ public: typedef const char* KeyType; typedef const char* KeyTypePointer; - nsDomainEntry(KeyTypePointer aEntry) + explicit nsDomainEntry(KeyTypePointer aEntry) { } diff --git a/netwerk/dns/nsHostResolver.h b/netwerk/dns/nsHostResolver.h index b894da6f5fa..3c60152eab5 100644 --- a/netwerk/dns/nsHostResolver.h +++ b/netwerk/dns/nsHostResolver.h @@ -106,7 +106,7 @@ private: // of gencnt. nsTArray mBlacklistedItems; - nsHostRecord(const nsHostKey *key); /* use Create() instead */ + explicit nsHostRecord(const nsHostKey *key); /* use Create() instead */ ~nsHostRecord(); }; @@ -239,8 +239,8 @@ public: size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const; private: - nsHostResolver(uint32_t maxCacheEntries = 50, uint32_t maxCacheLifetime = 60, - uint32_t lifetimeGracePeriod = 0); + explicit nsHostResolver(uint32_t maxCacheEntries = 50, uint32_t maxCacheLifetime = 60, + uint32_t lifetimeGracePeriod = 0); ~nsHostResolver(); nsresult Init(); diff --git a/netwerk/ipc/RemoteOpenFileParent.h b/netwerk/ipc/RemoteOpenFileParent.h index 644afa357b9..4564ca1f381 100644 --- a/netwerk/ipc/RemoteOpenFileParent.h +++ b/netwerk/ipc/RemoteOpenFileParent.h @@ -18,7 +18,7 @@ namespace net { class RemoteOpenFileParent : public PRemoteOpenFileParent { public: - RemoteOpenFileParent(nsIFileURL* aURI) + explicit RemoteOpenFileParent(nsIFileURL* aURI) : mURI(aURI) {} diff --git a/netwerk/protocol/data/nsDataChannel.h b/netwerk/protocol/data/nsDataChannel.h index d39b9920462..7fdab0e2e8e 100644 --- a/netwerk/protocol/data/nsDataChannel.h +++ b/netwerk/protocol/data/nsDataChannel.h @@ -14,7 +14,7 @@ class nsIInputStream; class nsDataChannel : public nsBaseChannel { public: - nsDataChannel(nsIURI *uri) { + explicit nsDataChannel(nsIURI *uri) { SetURI(uri); } diff --git a/netwerk/protocol/file/nsFileChannel.h b/netwerk/protocol/file/nsFileChannel.h index f38665746d8..8a5e7e91f56 100644 --- a/netwerk/protocol/file/nsFileChannel.h +++ b/netwerk/protocol/file/nsFileChannel.h @@ -20,7 +20,7 @@ public: NS_DECL_NSIFILECHANNEL NS_DECL_NSIUPLOADCHANNEL - nsFileChannel(nsIURI *uri); + explicit nsFileChannel(nsIURI *uri); protected: ~nsFileChannel(); diff --git a/netwerk/protocol/ftp/FTPChannelChild.cpp b/netwerk/protocol/ftp/FTPChannelChild.cpp index 1e29c111b92..06927f0a281 100644 --- a/netwerk/protocol/ftp/FTPChannelChild.cpp +++ b/netwerk/protocol/ftp/FTPChannelChild.cpp @@ -544,7 +544,7 @@ FTPChannelChild::DoFailedAsyncOpen(const nsresult& statusCode) class FTPFlushedForDiversionEvent : public ChannelEvent { public: - FTPFlushedForDiversionEvent(FTPChannelChild* aChild) + explicit FTPFlushedForDiversionEvent(FTPChannelChild* aChild) : mChild(aChild) { MOZ_RELEASE_ASSERT(aChild); @@ -601,7 +601,7 @@ FTPChannelChild::RecvDivertMessages() class FTPDeleteSelfEvent : public ChannelEvent { public: - FTPDeleteSelfEvent(FTPChannelChild* aChild) + explicit FTPDeleteSelfEvent(FTPChannelChild* aChild) : mChild(aChild) {} void Run() { mChild->DoDeleteSelf(); } private: diff --git a/netwerk/protocol/ftp/nsFTPChannel.cpp b/netwerk/protocol/ftp/nsFTPChannel.cpp index d4cafa2860c..4932abd926b 100644 --- a/netwerk/protocol/ftp/nsFTPChannel.cpp +++ b/netwerk/protocol/ftp/nsFTPChannel.cpp @@ -136,7 +136,7 @@ class FTPEventSinkProxy MOZ_FINAL : public nsIFTPEventSink ~FTPEventSinkProxy() {} public: - FTPEventSinkProxy(nsIFTPEventSink* aTarget) + explicit FTPEventSinkProxy(nsIFTPEventSink* aTarget) : mTarget(aTarget) , mTargetThread(do_GetCurrentThread()) { } diff --git a/netwerk/protocol/http/Http2Session.h b/netwerk/protocol/http/Http2Session.h index 90ab1c7020a..fd98b11e121 100644 --- a/netwerk/protocol/http/Http2Session.h +++ b/netwerk/protocol/http/Http2Session.h @@ -41,7 +41,7 @@ public: NS_DECL_NSAHTTPSEGMENTREADER NS_DECL_NSAHTTPSEGMENTWRITER - Http2Session(nsISocketTransport *); + explicit Http2Session(nsISocketTransport *); bool AddStream(nsAHttpTransaction *, int32_t, bool, nsIInterfaceRequestor *); diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index 91f494bfed9..f3efdbaddf8 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -728,7 +728,7 @@ HttpChannelChild::DoNotifyListenerCleanup() class DeleteSelfEvent : public ChannelEvent { public: - DeleteSelfEvent(HttpChannelChild* child) : mChild(child) {} + explicit DeleteSelfEvent(HttpChannelChild* child) : mChild(child) {} void Run() { mChild->DeleteSelf(); } private: HttpChannelChild* mChild; @@ -852,7 +852,7 @@ HttpChannelChild::Redirect1Begin(const uint32_t& newChannelId, class Redirect3Event : public ChannelEvent { public: - Redirect3Event(HttpChannelChild* child) : mChild(child) {} + explicit Redirect3Event(HttpChannelChild* child) : mChild(child) {} void Run() { mChild->Redirect3Complete(); } private: HttpChannelChild* mChild; @@ -872,7 +872,7 @@ HttpChannelChild::RecvRedirect3Complete() class HttpFlushedForDiversionEvent : public ChannelEvent { public: - HttpFlushedForDiversionEvent(HttpChannelChild* aChild) + explicit HttpFlushedForDiversionEvent(HttpChannelChild* aChild) : mChild(aChild) { MOZ_RELEASE_ASSERT(aChild); diff --git a/netwerk/protocol/http/HttpChannelParentListener.h b/netwerk/protocol/http/HttpChannelParentListener.h index f3a120bd86d..9a5ccb7e4f7 100644 --- a/netwerk/protocol/http/HttpChannelParentListener.h +++ b/netwerk/protocol/http/HttpChannelParentListener.h @@ -32,7 +32,7 @@ public: NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER - HttpChannelParentListener(HttpChannelParent* aInitialChannel); + explicit HttpChannelParentListener(HttpChannelParent* aInitialChannel); // For channel diversion from child to parent. nsresult DivertTo(nsIStreamListener *aListener); diff --git a/netwerk/protocol/http/SpdySession3.h b/netwerk/protocol/http/SpdySession3.h index 2f0bf6a6f2a..8abe056757d 100644 --- a/netwerk/protocol/http/SpdySession3.h +++ b/netwerk/protocol/http/SpdySession3.h @@ -40,7 +40,7 @@ public: NS_DECL_NSAHTTPSEGMENTREADER NS_DECL_NSAHTTPSEGMENTWRITER - SpdySession3(nsISocketTransport *); + explicit SpdySession3(nsISocketTransport *); bool AddStream(nsAHttpTransaction *, int32_t, bool, nsIInterfaceRequestor *); diff --git a/netwerk/protocol/http/SpdySession31.h b/netwerk/protocol/http/SpdySession31.h index 44f7cc715c7..cd9a15133d6 100644 --- a/netwerk/protocol/http/SpdySession31.h +++ b/netwerk/protocol/http/SpdySession31.h @@ -39,7 +39,7 @@ public: NS_DECL_NSAHTTPSEGMENTREADER NS_DECL_NSAHTTPSEGMENTWRITER - SpdySession31(nsISocketTransport *); + explicit SpdySession31(nsISocketTransport *); bool AddStream(nsAHttpTransaction *, int32_t, bool, nsIInterfaceRequestor *); diff --git a/netwerk/protocol/http/TunnelUtils.cpp b/netwerk/protocol/http/TunnelUtils.cpp index 5fa2778ab7d..5e369543f4a 100644 --- a/netwerk/protocol/http/TunnelUtils.cpp +++ b/netwerk/protocol/http/TunnelUtils.cpp @@ -917,7 +917,7 @@ public: NS_DECL_NSITRANSPORT NS_DECL_NSISOCKETTRANSPORT - SocketTransportShim(nsISocketTransport *aWrapped) + explicit SocketTransportShim(nsISocketTransport *aWrapped) : mWrapped(aWrapped) {}; @@ -936,7 +936,7 @@ public: friend class SpdyConnectTransaction; - OutputStreamShim(SpdyConnectTransaction *aTrans) + explicit OutputStreamShim(SpdyConnectTransaction *aTrans) : mCallback(nullptr) , mStatus(NS_OK) { @@ -960,7 +960,7 @@ public: friend class SpdyConnectTransaction; - InputStreamShim(SpdyConnectTransaction *aTrans) + explicit InputStreamShim(SpdyConnectTransaction *aTrans) : mCallback(nullptr) , mStatus(NS_OK) { diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index a03c5da41bf..1e7df2ac91a 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -154,7 +154,7 @@ WillRedirect(const nsHttpResponseHead * response) class AutoRedirectVetoNotifier { public: - AutoRedirectVetoNotifier(nsHttpChannel* channel) : mChannel(channel) + explicit AutoRedirectVetoNotifier(nsHttpChannel* channel) : mChannel(channel) { if (mChannel->mHasAutoRedirectVetoNotifier) { MOZ_CRASH("Nested AutoRedirectVetoNotifier on the stack"); diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp index 61a1b95c320..5e52ba3e430 100644 --- a/netwerk/protocol/http/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/nsHttpTransaction.cpp @@ -1743,7 +1743,7 @@ nsHttpTransaction::ReleaseBlockingTransaction() class DeleteHttpTransaction : public nsRunnable { public: - DeleteHttpTransaction(nsHttpTransaction *trans) + explicit DeleteHttpTransaction(nsHttpTransaction *trans) : mTrans(trans) {} diff --git a/netwerk/protocol/websocket/WebSocketChannelChild.cpp b/netwerk/protocol/websocket/WebSocketChannelChild.cpp index fd4d172a518..d1bdc602deb 100644 --- a/netwerk/protocol/websocket/WebSocketChannelChild.cpp +++ b/netwerk/protocol/websocket/WebSocketChannelChild.cpp @@ -83,7 +83,7 @@ WebSocketChannelChild::ReleaseIPDLReference() class WrappedChannelEvent : public nsRunnable { public: - WrappedChannelEvent(ChannelEvent *aChannelEvent) + explicit WrappedChannelEvent(ChannelEvent *aChannelEvent) : mChannelEvent(aChannelEvent) { MOZ_RELEASE_ASSERT(aChannelEvent); diff --git a/netwerk/protocol/websocket/WebSocketChannelChild.h b/netwerk/protocol/websocket/WebSocketChannelChild.h index 91248d510a4..d3a94a72cde 100644 --- a/netwerk/protocol/websocket/WebSocketChannelChild.h +++ b/netwerk/protocol/websocket/WebSocketChannelChild.h @@ -21,7 +21,7 @@ class WebSocketChannelChild : public BaseWebSocketChannel, public PWebSocketChild { public: - WebSocketChannelChild(bool aSecure); + explicit WebSocketChannelChild(bool aSecure); NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITHREADRETARGETABLEREQUEST diff --git a/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp b/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp index e14f521617c..42c6d00f412 100644 --- a/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp +++ b/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp @@ -31,7 +31,7 @@ typedef mozilla::net::LoadContextInfo LoadContextInfo; // Must release mChannel on the main thread class nsWyciwygAsyncEvent : public nsRunnable { public: - nsWyciwygAsyncEvent(nsWyciwygChannel *aChannel) : mChannel(aChannel) {} + explicit nsWyciwygAsyncEvent(nsWyciwygChannel *aChannel) : mChannel(aChannel) {} ~nsWyciwygAsyncEvent() { @@ -49,7 +49,7 @@ protected: class nsWyciwygSetCharsetandSourceEvent : public nsWyciwygAsyncEvent { public: - nsWyciwygSetCharsetandSourceEvent(nsWyciwygChannel *aChannel) + explicit nsWyciwygSetCharsetandSourceEvent(nsWyciwygChannel *aChannel) : nsWyciwygAsyncEvent(aChannel) {} NS_IMETHOD Run() diff --git a/netwerk/sctp/datachannel/DataChannel.h b/netwerk/sctp/datachannel/DataChannel.h index 6b6e3c96722..7c5f4457ddc 100644 --- a/netwerk/sctp/datachannel/DataChannel.h +++ b/netwerk/sctp/datachannel/DataChannel.h @@ -114,7 +114,7 @@ public: virtual void NotifyDataChannel(already_AddRefed channel) = 0; }; - DataChannelConnection(DataConnectionListener *listener); + explicit DataChannelConnection(DataConnectionListener *listener); bool Init(unsigned short aPort, uint16_t aNumStreams, bool aUsingDtls); void Destroy(); // So we can spawn refs tied to runnables in shutdown diff --git a/netwerk/socket/nsSOCKSSocketProvider.h b/netwerk/socket/nsSOCKSSocketProvider.h index aa98a2804d1..d468ec36ed3 100644 --- a/netwerk/socket/nsSOCKSSocketProvider.h +++ b/netwerk/socket/nsSOCKSSocketProvider.h @@ -21,7 +21,7 @@ public: NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISOCKETPROVIDER - nsSOCKSSocketProvider(uint32_t version) : mVersion(version) {} + explicit nsSOCKSSocketProvider(uint32_t version) : mVersion(version) {} static nsresult CreateV4(nsISupports *, REFNSIID aIID, void **aResult); static nsresult CreateV5(nsISupports *, REFNSIID aIID, void **aResult); diff --git a/netwerk/wifi/nsWifiMonitor.h b/netwerk/wifi/nsWifiMonitor.h index 4d0d6b07b84..7d517891dad 100644 --- a/netwerk/wifi/nsWifiMonitor.h +++ b/netwerk/wifi/nsWifiMonitor.h @@ -38,7 +38,7 @@ class nsWifiListener { public: - nsWifiListener(nsMainThreadPtrHolder* aListener) + explicit nsWifiListener(nsMainThreadPtrHolder* aListener) { mListener = aListener; mHasSentData = false; From 7207465c1bfe7ebaea671317743a8716e6f9272d Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 5 Aug 2014 09:20:50 -0400 Subject: [PATCH 26/60] Bug 1047782 - Fix some bad impliciit constructors in netwerk/; r=mcmanus --- ipc/glue/MessageChannel.h | 10 +++++----- netwerk/base/public/nsAsyncRedirectVerifyHelper.h | 2 +- netwerk/base/public/nsURIHashKey.h | 2 +- netwerk/base/src/Dashboard.cpp | 2 +- netwerk/base/src/EventTokenBucket.cpp | 2 +- netwerk/base/src/NetworkActivityMonitor.cpp | 2 +- netwerk/base/src/nsNetAddr.h | 2 +- netwerk/base/src/nsProxyInfo.h | 2 +- netwerk/base/src/nsSocketTransport2.cpp | 2 +- netwerk/base/src/nsSocketTransport2.h | 10 +++++----- netwerk/dns/DNS.h | 2 +- netwerk/ipc/ChannelEventQueue.h | 4 ++-- netwerk/protocol/ftp/FTPChannelChild.h | 2 +- netwerk/protocol/http/HttpBaseChannel.h | 2 +- netwerk/protocol/http/nsHttpAuthCache.h | 2 +- netwerk/protocol/http/nsHttpChannel.h | 2 +- netwerk/protocol/http/nsHttpConnectionMgr.h | 4 ++-- security/manager/ssl/src/ScopedNSSTypes.h | 2 +- 18 files changed, 28 insertions(+), 28 deletions(-) diff --git a/ipc/glue/MessageChannel.h b/ipc/glue/MessageChannel.h index e93ead05ac9..dd771406d0e 100644 --- a/ipc/glue/MessageChannel.h +++ b/ipc/glue/MessageChannel.h @@ -57,7 +57,7 @@ class MessageChannel : HasResultCodes typedef IPC::Message Message; typedef mozilla::ipc::Transport Transport; - MessageChannel(MessageListener *aListener); + explicit MessageChannel(MessageListener *aListener); ~MessageChannel(); // "Open" from the perspective of the transport layer; the underlying @@ -381,7 +381,7 @@ class MessageChannel : HasResultCodes class RefCountedTask { public: - RefCountedTask(CancelableTask* aTask) + explicit RefCountedTask(CancelableTask* aTask) : mTask(aTask) { } private: @@ -401,7 +401,7 @@ class MessageChannel : HasResultCodes class DequeueTask : public Task { public: - DequeueTask(RefCountedTask* aTask) + explicit DequeueTask(RefCountedTask* aTask) : mTask(aTask) { } void Run() { mTask->Run(); } @@ -441,7 +441,7 @@ class MessageChannel : HasResultCodes class AutoEnterPendingReply { public: - AutoEnterPendingReply(size_t &replyVar) + explicit AutoEnterPendingReply(size_t &replyVar) : mReplyVar(replyVar) { mReplyVar++; @@ -487,7 +487,7 @@ class MessageChannel : HasResultCodes class AutoEnterRPCTransaction { public: - AutoEnterRPCTransaction(MessageChannel *aChan) + explicit AutoEnterRPCTransaction(MessageChannel *aChan) : mChan(aChan), mOldTransaction(mChan->mCurrentRPCTransaction) { diff --git a/netwerk/base/public/nsAsyncRedirectVerifyHelper.h b/netwerk/base/public/nsAsyncRedirectVerifyHelper.h index 56e839cf1bc..a8260f8b90c 100644 --- a/netwerk/base/public/nsAsyncRedirectVerifyHelper.h +++ b/netwerk/base/public/nsAsyncRedirectVerifyHelper.h @@ -92,7 +92,7 @@ private: class nsAsyncRedirectAutoCallback { public: - nsAsyncRedirectAutoCallback(nsIAsyncVerifyRedirectCallback* aCallback) + explicit nsAsyncRedirectAutoCallback(nsIAsyncVerifyRedirectCallback* aCallback) : mCallback(aCallback) { mResult = NS_OK; diff --git a/netwerk/base/public/nsURIHashKey.h b/netwerk/base/public/nsURIHashKey.h index 7f391c34b8c..a3b54754a9b 100644 --- a/netwerk/base/public/nsURIHashKey.h +++ b/netwerk/base/public/nsURIHashKey.h @@ -19,7 +19,7 @@ public: typedef nsIURI* KeyType; typedef const nsIURI* KeyTypePointer; - nsURIHashKey(const nsIURI* aKey) : + explicit nsURIHashKey(const nsIURI* aKey) : mKey(const_cast(aKey)) { MOZ_COUNT_CTOR(nsURIHashKey); } nsURIHashKey(const nsURIHashKey& toCopy) : mKey(toCopy.mKey) { MOZ_COUNT_CTOR(nsURIHashKey); } diff --git a/netwerk/base/src/Dashboard.cpp b/netwerk/base/src/Dashboard.cpp index c06284a077c..fee88a5e6ce 100644 --- a/netwerk/base/src/Dashboard.cpp +++ b/netwerk/base/src/Dashboard.cpp @@ -141,7 +141,7 @@ public: void StartTimer(uint32_t aTimeout); void StopTimer(); - ConnectionData(Dashboard *target) + explicit ConnectionData(Dashboard *target) { mThread = nullptr; mDashboard = target; diff --git a/netwerk/base/src/EventTokenBucket.cpp b/netwerk/base/src/EventTokenBucket.cpp index 5ffd5fffcfe..78714705440 100644 --- a/netwerk/base/src/EventTokenBucket.cpp +++ b/netwerk/base/src/EventTokenBucket.cpp @@ -34,7 +34,7 @@ public: NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICANCELABLE - TokenBucketCancelable(class ATokenBucketEvent *event); + explicit TokenBucketCancelable(class ATokenBucketEvent *event); void Fire(); private: diff --git a/netwerk/base/src/NetworkActivityMonitor.cpp b/netwerk/base/src/NetworkActivityMonitor.cpp index 71086022be0..a758703697b 100644 --- a/netwerk/base/src/NetworkActivityMonitor.cpp +++ b/netwerk/base/src/NetworkActivityMonitor.cpp @@ -151,7 +151,7 @@ nsNetMon_AcceptRead(PRFileDesc *listenSock, class NotifyNetworkActivity : public nsRunnable { public: - NotifyNetworkActivity(NetworkActivityMonitor::Direction aDirection) + explicit NotifyNetworkActivity(NetworkActivityMonitor::Direction aDirection) : mDirection(aDirection) {} NS_IMETHOD Run() diff --git a/netwerk/base/src/nsNetAddr.h b/netwerk/base/src/nsNetAddr.h index d1cacffd5bf..3d37686dae1 100644 --- a/netwerk/base/src/nsNetAddr.h +++ b/netwerk/base/src/nsNetAddr.h @@ -19,7 +19,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSINETADDR - nsNetAddr(mozilla::net::NetAddr* addr); + explicit nsNetAddr(mozilla::net::NetAddr* addr); private: mozilla::net::NetAddr mAddr; diff --git a/netwerk/base/src/nsProxyInfo.h b/netwerk/base/src/nsProxyInfo.h index e0a46eac29a..bc55180134e 100644 --- a/netwerk/base/src/nsProxyInfo.h +++ b/netwerk/base/src/nsProxyInfo.h @@ -44,7 +44,7 @@ public: private: friend class nsProtocolProxyService; - nsProxyInfo(const char *type = nullptr) + explicit nsProxyInfo(const char *type = nullptr) : mType(type) , mPort(-1) , mFlags(0) diff --git a/netwerk/base/src/nsSocketTransport2.cpp b/netwerk/base/src/nsSocketTransport2.cpp index 4cd26354929..d3261d02014 100644 --- a/netwerk/base/src/nsSocketTransport2.cpp +++ b/netwerk/base/src/nsSocketTransport2.cpp @@ -1608,7 +1608,7 @@ nsSocketTransport::GetFD_Locked() class ThunkPRClose : public nsRunnable { public: - ThunkPRClose(PRFileDesc *fd) : mFD(fd) {} + explicit ThunkPRClose(PRFileDesc *fd) : mFD(fd) {} NS_IMETHOD Run() { diff --git a/netwerk/base/src/nsSocketTransport2.h b/netwerk/base/src/nsSocketTransport2.h index ca2db7e4c1b..d043a1ee8f0 100644 --- a/netwerk/base/src/nsSocketTransport2.h +++ b/netwerk/base/src/nsSocketTransport2.h @@ -47,7 +47,7 @@ public: NS_DECL_NSIINPUTSTREAM NS_DECL_NSIASYNCINPUTSTREAM - nsSocketInputStream(nsSocketTransport *); + explicit nsSocketInputStream(nsSocketTransport *); virtual ~nsSocketInputStream(); bool IsReferenced() { return mReaderRefCnt > 0; } @@ -77,7 +77,7 @@ public: NS_DECL_NSIOUTPUTSTREAM NS_DECL_NSIASYNCOUTPUTSTREAM - nsSocketOutputStream(nsSocketTransport *); + explicit nsSocketOutputStream(nsSocketTransport *); virtual ~nsSocketOutputStream(); bool IsReferenced() { return mWriterRefCnt > 0; } @@ -181,8 +181,8 @@ private: public: typedef mozilla::MutexAutoLock MutexAutoLock; - PRFileDescAutoLock(nsSocketTransport *aSocketTransport, - nsresult *aConditionWhileLocked = nullptr) + explicit PRFileDescAutoLock(nsSocketTransport *aSocketTransport, + nsresult *aConditionWhileLocked = nullptr) : mSocketTransport(aSocketTransport) , mFd(nullptr) { @@ -223,7 +223,7 @@ private: class LockedPRFileDesc { public: - LockedPRFileDesc(nsSocketTransport *aSocketTransport) + explicit LockedPRFileDesc(nsSocketTransport *aSocketTransport) : mSocketTransport(aSocketTransport) , mFd(nullptr) { diff --git a/netwerk/dns/DNS.h b/netwerk/dns/DNS.h index 35df4ef0878..e3beaf5646b 100644 --- a/netwerk/dns/DNS.h +++ b/netwerk/dns/DNS.h @@ -118,7 +118,7 @@ union NetAddr { // which is converted to a mozilla::dns::NetAddr. class NetAddrElement : public LinkedListElement { public: - NetAddrElement(const PRNetAddr *prNetAddr); + explicit NetAddrElement(const PRNetAddr *prNetAddr); NetAddrElement(const NetAddrElement& netAddr); ~NetAddrElement(); diff --git a/netwerk/ipc/ChannelEventQueue.h b/netwerk/ipc/ChannelEventQueue.h index ac2a0935d03..3b654a4b566 100644 --- a/netwerk/ipc/ChannelEventQueue.h +++ b/netwerk/ipc/ChannelEventQueue.h @@ -40,7 +40,7 @@ class ChannelEventQueue MOZ_FINAL NS_INLINE_DECL_REFCOUNTING(ChannelEventQueue) public: - ChannelEventQueue(nsISupports *owner) + explicit ChannelEventQueue(nsISupports *owner) : mSuspendCount(0) , mSuspended(false) , mForced(false) @@ -165,7 +165,7 @@ ChannelEventQueue::MaybeFlushQueue() class AutoEventEnqueuer { public: - AutoEventEnqueuer(ChannelEventQueue *queue) : mEventQueue(queue) { + explicit AutoEventEnqueuer(ChannelEventQueue *queue) : mEventQueue(queue) { mEventQueue->StartForcedQueueing(); } ~AutoEventEnqueuer() { diff --git a/netwerk/protocol/ftp/FTPChannelChild.h b/netwerk/protocol/ftp/FTPChannelChild.h index 2cdf02676ed..c578b67548b 100644 --- a/netwerk/protocol/ftp/FTPChannelChild.h +++ b/netwerk/protocol/ftp/FTPChannelChild.h @@ -53,7 +53,7 @@ public: NS_IMETHOD Suspend(); NS_IMETHOD Resume(); - FTPChannelChild(nsIURI* uri); + explicit FTPChannelChild(nsIURI* uri); void AddIPDLReference(); void ReleaseIPDLReference(); diff --git a/netwerk/protocol/http/HttpBaseChannel.h b/netwerk/protocol/http/HttpBaseChannel.h index 0e1d6b68385..e2da7b14ce7 100644 --- a/netwerk/protocol/http/HttpBaseChannel.h +++ b/netwerk/protocol/http/HttpBaseChannel.h @@ -393,7 +393,7 @@ template class HttpAsyncAborter { public: - HttpAsyncAborter(T *derived) : mThis(derived), mCallOnResume(0) {} + explicit HttpAsyncAborter(T *derived) : mThis(derived), mCallOnResume(0) {} // Aborts channel: calls OnStart/Stop with provided status, removes channel // from loadGroup. diff --git a/netwerk/protocol/http/nsHttpAuthCache.h b/netwerk/protocol/http/nsHttpAuthCache.h index 01049953e5a..0e79b51f36d 100644 --- a/netwerk/protocol/http/nsHttpAuthCache.h +++ b/netwerk/protocol/http/nsHttpAuthCache.h @@ -244,7 +244,7 @@ private: public: NS_DECL_ISUPPORTS NS_DECL_NSIOBSERVER - AppDataClearObserver(nsHttpAuthCache* aOwner) : mOwner(aOwner) {} + explicit AppDataClearObserver(nsHttpAuthCache* aOwner) : mOwner(aOwner) {} nsHttpAuthCache* mOwner; }; diff --git a/netwerk/protocol/http/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h index cf567a88868..758e75494a8 100644 --- a/netwerk/protocol/http/nsHttpChannel.h +++ b/netwerk/protocol/http/nsHttpChannel.h @@ -160,7 +160,7 @@ public: /* internal necko use only */ class AutoCacheWaitFlags { public: - AutoCacheWaitFlags(nsHttpChannel* channel) + explicit AutoCacheWaitFlags(nsHttpChannel* channel) : mChannel(channel) , mKeep(0) { diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.h b/netwerk/protocol/http/nsHttpConnectionMgr.h index 73a67e9776f..bf766288175 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.h +++ b/netwerk/protocol/http/nsHttpConnectionMgr.h @@ -274,7 +274,7 @@ private: class nsConnectionEntry { public: - nsConnectionEntry(nsHttpConnectionInfo *ci); + explicit nsConnectionEntry(nsHttpConnectionInfo *ci); ~nsConnectionEntry(); nsRefPtr mConnInfo; @@ -401,7 +401,7 @@ private: NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSAHTTPCONNECTION(mConn) - nsConnectionHandle(nsHttpConnection *conn) { NS_ADDREF(mConn = conn); } + explicit nsConnectionHandle(nsHttpConnection *conn) { NS_ADDREF(mConn = conn); } nsHttpConnection *mConn; }; diff --git a/security/manager/ssl/src/ScopedNSSTypes.h b/security/manager/ssl/src/ScopedNSSTypes.h index a1ea3c45d76..306e796ffe2 100644 --- a/security/manager/ssl/src/ScopedNSSTypes.h +++ b/security/manager/ssl/src/ScopedNSSTypes.h @@ -267,7 +267,7 @@ SECITEM_AllocItem(SECItem & item, uint32_t len) class ScopedAutoSECItem MOZ_FINAL : public SECItem { public: - ScopedAutoSECItem(uint32_t initialAllocatedLen = 0) + explicit ScopedAutoSECItem(uint32_t initialAllocatedLen = 0) { data = nullptr; len = 0; From 3508dd19c872f4f409e6fcf395725fa57e594cc7 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 5 Aug 2014 09:21:12 -0400 Subject: [PATCH 27/60] Bug 1048013 - Fix some bad implicit constructors in MFBT; r=froydnj --- mfbt/WeakPtr.h | 2 +- mfbt/tests/TestPair.cpp | 10 +++++----- mfbt/tests/TestSplayTree.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mfbt/WeakPtr.h b/mfbt/WeakPtr.h index ebcb9250674..58960ad6177 100644 --- a/mfbt/WeakPtr.h +++ b/mfbt/WeakPtr.h @@ -183,7 +183,7 @@ public: return *this = aOther->SelfReferencingWeakPtr(); } - WeakPtr(T* aOther) + MOZ_IMPLICIT WeakPtr(T* aOther) { *this = aOther; } diff --git a/mfbt/tests/TestPair.cpp b/mfbt/tests/TestPair.cpp index 37aa2c69410..940174df0f3 100644 --- a/mfbt/tests/TestPair.cpp +++ b/mfbt/tests/TestPair.cpp @@ -29,21 +29,21 @@ using mozilla::Pair; INSTANTIATE(int, int, prim1, 2 * sizeof(int)); INSTANTIATE(int, long, prim2, 2 * sizeof(long)); -struct EmptyClass { EmptyClass(int) {} }; -struct NonEmpty { char mC; NonEmpty(int) {} }; +struct EmptyClass { explicit EmptyClass(int) {} }; +struct NonEmpty { char mC; explicit NonEmpty(int) {} }; INSTANTIATE(int, EmptyClass, both1, sizeof(int)); INSTANTIATE(int, NonEmpty, both2, 2 * sizeof(int)); INSTANTIATE(EmptyClass, NonEmpty, both3, 1); -struct A { char dummy; A(int) {} }; -struct B : A { B(int aI) : A(aI) {} }; +struct A { char dummy; explicit A(int) {} }; +struct B : A { explicit B(int aI) : A(aI) {} }; INSTANTIATE(A, A, class1, 2); INSTANTIATE(A, B, class2, 2); INSTANTIATE(A, EmptyClass, class3, 1); -struct OtherEmpty : EmptyClass { OtherEmpty(int aI) : EmptyClass(aI) {} }; +struct OtherEmpty : EmptyClass { explicit OtherEmpty(int aI) : EmptyClass(aI) {} }; // C++11 requires distinct objects of the same type, within the same "most // derived object", to have different addresses. Pair allocates its elements as diff --git a/mfbt/tests/TestSplayTree.cpp b/mfbt/tests/TestSplayTree.cpp index b49371f3237..e1511e1abe0 100644 --- a/mfbt/tests/TestSplayTree.cpp +++ b/mfbt/tests/TestSplayTree.cpp @@ -89,7 +89,7 @@ static int gValues[] = { struct SplayInt : SplayTreeNode { - SplayInt(int aValue) : mValue(aValue) {} + explicit SplayInt(int aValue) : mValue(aValue) {} static int compare(const SplayInt& aOne, const SplayInt& aTwo) { From 1030a03b0afc515bef244478831f73f85aed5a2b Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 5 Aug 2014 09:21:27 -0400 Subject: [PATCH 28/60] Bug 1047781 - Fix more bad implicit constructors in XPCOM; r=froydnj --- xpcom/build/FileLocation.h | 2 +- xpcom/components/ManifestParser.cpp | 2 +- xpcom/components/nsCategoryManager.h | 2 +- xpcom/components/nsComponentManager.cpp | 2 +- xpcom/components/nsComponentManager.h | 6 +++--- xpcom/reflect/xptinfo/xptiprivate.h | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/xpcom/build/FileLocation.h b/xpcom/build/FileLocation.h index d27175031eb..1fc5e353a20 100644 --- a/xpcom/build/FileLocation.h +++ b/xpcom/build/FileLocation.h @@ -36,7 +36,7 @@ public: /** * Constructor for plain files */ - FileLocation(nsIFile *file); + explicit FileLocation(nsIFile *file); /** * Constructors for path within an archive. The archive can be given either diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp index 3fc18a7daa6..53bcf1e730e 100644 --- a/xpcom/components/ManifestParser.cpp +++ b/xpcom/components/ManifestParser.cpp @@ -153,7 +153,7 @@ IsNewline(char aChar) namespace { struct AutoPR_smprintf_free { - AutoPR_smprintf_free(char* aBuf) : mBuf(aBuf) {} + explicit AutoPR_smprintf_free(char* aBuf) : mBuf(aBuf) {} ~AutoPR_smprintf_free() { diff --git a/xpcom/components/nsCategoryManager.h b/xpcom/components/nsCategoryManager.h index 5c4c6cb853f..f2bf0e55a1c 100644 --- a/xpcom/components/nsCategoryManager.h +++ b/xpcom/components/nsCategoryManager.h @@ -34,7 +34,7 @@ class nsIMemoryReporter; class CategoryLeaf : public nsDepCharHashKey { public: - CategoryLeaf(const char* aKey) : nsDepCharHashKey(aKey), value(nullptr) {} + explicit CategoryLeaf(const char* aKey) : nsDepCharHashKey(aKey), value(nullptr) {} const char* value; }; diff --git a/xpcom/components/nsComponentManager.cpp b/xpcom/components/nsComponentManager.cpp index 4ccfd7153fc..e51c267b6a6 100644 --- a/xpcom/components/nsComponentManager.cpp +++ b/xpcom/components/nsComponentManager.cpp @@ -215,7 +215,7 @@ namespace { class MOZ_STACK_CLASS MutexLock { public: - MutexLock(SafeMutex& aMutex) + explicit MutexLock(SafeMutex& aMutex) : mMutex(aMutex) , mLocked(false) { diff --git a/xpcom/components/nsComponentManager.h b/xpcom/components/nsComponentManager.h index d15a4dbd19e..ff51441fb4c 100644 --- a/xpcom/components/nsComponentManager.h +++ b/xpcom/components/nsComponentManager.h @@ -78,7 +78,7 @@ extern const mozilla::Module kXPCOMModule; class SafeMutex { public: - SafeMutex(const char* aName) + explicit SafeMutex(const char* aName) : mMutex(aName) , mOwnerThread(nullptr) { @@ -212,14 +212,14 @@ public: { } - KnownModule(const mozilla::Module* aModule) + explicit KnownModule(const mozilla::Module* aModule) : mModule(aModule) , mLoaded(false) , mFailed(false) { } - KnownModule(mozilla::FileLocation& aFile) + explicit KnownModule(mozilla::FileLocation& aFile) : mModule(nullptr) , mFile(aFile) , mLoader(nullptr) diff --git a/xpcom/reflect/xptinfo/xptiprivate.h b/xpcom/reflect/xptinfo/xptiprivate.h index 123f2f8e0e7..4b46e090e5d 100644 --- a/xpcom/reflect/xptinfo/xptiprivate.h +++ b/xpcom/reflect/xptinfo/xptiprivate.h @@ -107,7 +107,7 @@ public: const char* GetEntryNameAt(uint16_t i); private: - xptiTypelibGuts(XPTHeader* aHeader) + explicit xptiTypelibGuts(XPTHeader* aHeader) : mHeader(aHeader) { } ~xptiTypelibGuts(); @@ -128,7 +128,7 @@ class xptiInfoFlags { enum {STATE_MASK = 3}; public: - xptiInfoFlags(uint8_t n) : mData(n) {} + explicit xptiInfoFlags(uint8_t n) : mData(n) {} xptiInfoFlags(const xptiInfoFlags& r) : mData(r.mData) {} static uint8_t GetStateMask() @@ -334,7 +334,7 @@ public: NS_IMETHOD GetIIDForParamNoAlloc(uint16_t methodIndex, const nsXPTParamInfo * param, nsIID *iid) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIIDForParamNoAlloc(methodIndex, param, iid); } public: - xptiInterfaceInfo(xptiInterfaceEntry* entry); + explicit xptiInterfaceInfo(xptiInterfaceEntry* entry); void Invalidate() {NS_IF_RELEASE(mParent); mEntry = nullptr;} From 8686c5e382055d50ad795632d7a3c470b560e2c0 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 5 Aug 2014 09:36:32 -0400 Subject: [PATCH 29/60] Bug 1048239 - Fix more bad implicit constructors in XPCOM; r=froydnj --- intl/unicharutil/nsSaveAsCharset.cpp | 2 +- xpcom/base/nsMemoryInfoDumper.cpp | 4 ++-- xpcom/base/nsMemoryReporterManager.cpp | 2 +- xpcom/base/nsMessageLoop.cpp | 2 +- xpcom/ds/nsExpirationTracker.h | 4 ++-- xpcom/ds/nsWhitespaceTokenizer.h | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/intl/unicharutil/nsSaveAsCharset.cpp b/intl/unicharutil/nsSaveAsCharset.cpp index d3dc9ab3ddd..b8916a89106 100644 --- a/intl/unicharutil/nsSaveAsCharset.cpp +++ b/intl/unicharutil/nsSaveAsCharset.cpp @@ -356,7 +356,7 @@ nsresult nsSaveAsCharset::SetupCharsetList(const char *charsetList) mCharsetListIndex = -1; } - nsCWhitespaceTokenizer tokenizer = nsDependentCString(charsetList); + nsCWhitespaceTokenizer tokenizer((nsDependentCString(charsetList))); while (tokenizer.hasMoreTokens()) { ParseString(tokenizer.nextToken(), ',', mCharsetList); } diff --git a/xpcom/base/nsMemoryInfoDumper.cpp b/xpcom/base/nsMemoryInfoDumper.cpp index 3585abbf3b6..8b87396408f 100644 --- a/xpcom/base/nsMemoryInfoDumper.cpp +++ b/xpcom/base/nsMemoryInfoDumper.cpp @@ -319,7 +319,7 @@ class nsDumpGCAndCCLogsCallbackHolder MOZ_FINAL : public nsIDumpGCAndCCLogsCallb public: NS_DECL_ISUPPORTS - nsDumpGCAndCCLogsCallbackHolder(nsIDumpGCAndCCLogsCallback* aCallback) + explicit nsDumpGCAndCCLogsCallbackHolder(nsIDumpGCAndCCLogsCallback* aCallback) : mCallback(aCallback) { } @@ -430,7 +430,7 @@ class DumpReportCallback MOZ_FINAL : public nsIHandleReportCallback public: NS_DECL_ISUPPORTS - DumpReportCallback(nsGZFileWriter* aWriter) + explicit DumpReportCallback(nsGZFileWriter* aWriter) : mIsFirst(true) , mWriter(aWriter) { diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index 00ebea78f15..5547b567240 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -1861,7 +1861,7 @@ namespace { class MinimizeMemoryUsageRunnable : public nsRunnable { public: - MinimizeMemoryUsageRunnable(nsIRunnable* aCallback) + explicit MinimizeMemoryUsageRunnable(nsIRunnable* aCallback) : mCallback(aCallback) , mRemainingIters(sNumIters) { diff --git a/xpcom/base/nsMessageLoop.cpp b/xpcom/base/nsMessageLoop.cpp index a04ad8cfa81..90a717b90b2 100644 --- a/xpcom/base/nsMessageLoop.cpp +++ b/xpcom/base/nsMessageLoop.cpp @@ -59,7 +59,7 @@ class MessageLoopTimerCallback : public nsITimerCallback { public: - MessageLoopTimerCallback(MessageLoopIdleTask* aTask); + explicit MessageLoopTimerCallback(MessageLoopIdleTask* aTask); NS_DECL_ISUPPORTS NS_DECL_NSITIMERCALLBACK diff --git a/xpcom/ds/nsExpirationTracker.h b/xpcom/ds/nsExpirationTracker.h index 24da7c64bd2..7b7d26f32f3 100644 --- a/xpcom/ds/nsExpirationTracker.h +++ b/xpcom/ds/nsExpirationTracker.h @@ -83,7 +83,7 @@ public: * period is zero, then we don't use a timer and rely on someone calling * AgeOneGeneration explicitly. */ - nsExpirationTracker(uint32_t aTimerPeriod) + explicit nsExpirationTracker(uint32_t aTimerPeriod) : mTimerPeriod(aTimerPeriod) , mNewestGeneration(0) , mInAgeOneGeneration(false) @@ -238,7 +238,7 @@ public: uint32_t mGeneration; uint32_t mIndex; public: - Iterator(nsExpirationTracker* aTracker) + explicit Iterator(nsExpirationTracker* aTracker) : mTracker(aTracker) , mGeneration(0) , mIndex(0) diff --git a/xpcom/ds/nsWhitespaceTokenizer.h b/xpcom/ds/nsWhitespaceTokenizer.h index 7b196e0de6b..b6b1d9096bc 100644 --- a/xpcom/ds/nsWhitespaceTokenizer.h +++ b/xpcom/ds/nsWhitespaceTokenizer.h @@ -17,7 +17,7 @@ class nsTWhitespaceTokenizer typedef typename DependentSubstringType::substring_type SubstringType; public: - nsTWhitespaceTokenizer(const SubstringType& aSource) + explicit nsTWhitespaceTokenizer(const SubstringType& aSource) : mIter(aSource.Data(), aSource.Length()), mEnd(aSource.Data() + aSource.Length(), aSource.Data(), aSource.Length()), @@ -85,7 +85,7 @@ class nsWhitespaceTokenizerTemplate : public nsTWhitespaceTokenizer { public: - nsWhitespaceTokenizerTemplate(const nsSubstring& aSource) + explicit nsWhitespaceTokenizerTemplate(const nsSubstring& aSource) : nsTWhitespaceTokenizer(aSource) { } @@ -98,7 +98,7 @@ class nsCWhitespaceTokenizerTemplate : public nsTWhitespaceTokenizer { public: - nsCWhitespaceTokenizerTemplate(const nsCSubstring& aSource) + explicit nsCWhitespaceTokenizerTemplate(const nsCSubstring& aSource) : nsTWhitespaceTokenizer(aSource) { } From 38ace662d33f99ec884c6fb595a956ab5e94f9ee Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 5 Aug 2014 09:36:59 -0400 Subject: [PATCH 30/60] Bug 1048280 - Fix more bad implicit constructors in XPCOM; r=froydnj --- xpcom/build/IOInterposer.cpp | 2 +- xpcom/build/IOInterposerPrivate.h | 6 +++--- xpcom/build/LateWriteChecks.cpp | 2 +- xpcom/build/NSPRInterposer.cpp | 2 +- xpcom/io/nsPipe3.cpp | 4 ++-- xpcom/io/nsUnicharInputStream.cpp | 2 +- xpcom/tests/TestCOMArray.cpp | 2 +- xpcom/tests/TestHarness.h | 4 ++-- xpcom/tests/TestHashtables.cpp | 4 ++-- xpcom/tests/TestObserverService.cpp | 2 +- xpcom/tests/TestRacingServiceManager.cpp | 2 +- xpcom/tests/TestThreadPoolListener.cpp | 2 +- xpcom/threads/TimerThread.cpp | 2 +- xpcom/threads/nsThread.cpp | 2 +- 14 files changed, 19 insertions(+), 19 deletions(-) diff --git a/xpcom/build/IOInterposer.cpp b/xpcom/build/IOInterposer.cpp index 03f8944cafe..d33ee03b96e 100644 --- a/xpcom/build/IOInterposer.cpp +++ b/xpcom/build/IOInterposer.cpp @@ -79,7 +79,7 @@ public: class PerThreadData { public: - PerThreadData(bool aIsMainThread = false) + explicit PerThreadData(bool aIsMainThread = false) : mIsMainThread(aIsMainThread) , mIsHandlingObservation(false) , mCurrentGeneration(0) diff --git a/xpcom/build/IOInterposerPrivate.h b/xpcom/build/IOInterposerPrivate.h index 0ba84abc7d0..84a80512267 100644 --- a/xpcom/build/IOInterposerPrivate.h +++ b/xpcom/build/IOInterposerPrivate.h @@ -71,7 +71,7 @@ private: class MonitorAutoLock { public: - MonitorAutoLock(Monitor &aMonitor) + explicit MonitorAutoLock(Monitor &aMonitor) : mMonitor(aMonitor) { mMonitor.Lock(); @@ -99,7 +99,7 @@ private: class MonitorAutoUnlock { public: - MonitorAutoUnlock(Monitor &aMonitor) + explicit MonitorAutoUnlock(Monitor &aMonitor) : mMonitor(aMonitor) { mMonitor.Unlock(); @@ -145,7 +145,7 @@ private: class AutoLock { public: - AutoLock(Mutex& aLock) + explicit AutoLock(Mutex& aLock) : mLock(aLock) { mLock.Lock(); diff --git a/xpcom/build/LateWriteChecks.cpp b/xpcom/build/LateWriteChecks.cpp index 891998314c3..dfdc8661f38 100644 --- a/xpcom/build/LateWriteChecks.cpp +++ b/xpcom/build/LateWriteChecks.cpp @@ -94,7 +94,7 @@ static void RecordStackWalker(void *aPC, void *aSP, void *aClosure) class LateWriteObserver MOZ_FINAL : public IOInterposeObserver { public: - LateWriteObserver(const char* aProfileDirectory) + explicit LateWriteObserver(const char* aProfileDirectory) : mProfileDirectory(PL_strdup(aProfileDirectory)) { } diff --git a/xpcom/build/NSPRInterposer.cpp b/xpcom/build/NSPRInterposer.cpp index dfa57b20fa1..3b55da149f1 100644 --- a/xpcom/build/NSPRInterposer.cpp +++ b/xpcom/build/NSPRInterposer.cpp @@ -27,7 +27,7 @@ PRFileInfo64FN sFileInfo64Fn = nullptr; class NSPRIOAutoObservation : public IOInterposeObserver::Observation { public: - NSPRIOAutoObservation(IOInterposeObserver::Operation aOp) + explicit NSPRIOAutoObservation(IOInterposeObserver::Operation aOp) : IOInterposeObserver::Observation(aOp, "NSPRIOInterposer") { } diff --git a/xpcom/io/nsPipe3.cpp b/xpcom/io/nsPipe3.cpp index 009bbda1f29..327f51daec5 100644 --- a/xpcom/io/nsPipe3.cpp +++ b/xpcom/io/nsPipe3.cpp @@ -109,7 +109,7 @@ public: NS_DECL_NSISEARCHABLEINPUTSTREAM NS_DECL_NSICLASSINFO - nsPipeInputStream(nsPipe* aPipe) + explicit nsPipeInputStream(nsPipe* aPipe) : mPipe(aPipe) , mReaderRefCnt(0) , mLogicalOffset(0) @@ -176,7 +176,7 @@ public: NS_DECL_NSIASYNCOUTPUTSTREAM NS_DECL_NSICLASSINFO - nsPipeOutputStream(nsPipe* aPipe) + explicit nsPipeOutputStream(nsPipe* aPipe) : mPipe(aPipe) , mWriterRefCnt(0) , mLogicalOffset(0) diff --git a/xpcom/io/nsUnicharInputStream.cpp b/xpcom/io/nsUnicharInputStream.cpp index cfe6fe6184c..ee302948945 100644 --- a/xpcom/io/nsUnicharInputStream.cpp +++ b/xpcom/io/nsUnicharInputStream.cpp @@ -26,7 +26,7 @@ class StringUnicharInputStream MOZ_FINAL : public nsIUnicharInputStream { public: - StringUnicharInputStream(const nsAString& aString) : + explicit StringUnicharInputStream(const nsAString& aString) : mString(aString), mPos(0), mLen(aString.Length()) { } NS_DECL_ISUPPORTS diff --git a/xpcom/tests/TestCOMArray.cpp b/xpcom/tests/TestCOMArray.cpp index 545990650f7..c3be1f63f4e 100644 --- a/xpcom/tests/TestCOMArray.cpp +++ b/xpcom/tests/TestCOMArray.cpp @@ -29,7 +29,7 @@ class Foo MOZ_FINAL : public IFoo { public: - Foo(int32_t aID); + explicit Foo(int32_t aID); // nsISupports implementation NS_DECL_ISUPPORTS diff --git a/xpcom/tests/TestHarness.h b/xpcom/tests/TestHarness.h index b20b3d1e2e5..564504c078a 100644 --- a/xpcom/tests/TestHarness.h +++ b/xpcom/tests/TestHarness.h @@ -100,8 +100,8 @@ class ScopedXPCOM : public nsIDirectoryServiceProvider2 public: NS_DECL_ISUPPORTS - ScopedXPCOM(const char* testName, - nsIDirectoryServiceProvider *dirSvcProvider = nullptr) + explicit ScopedXPCOM(const char* testName, + nsIDirectoryServiceProvider *dirSvcProvider = nullptr) : mDirSvcProvider(dirSvcProvider) { mTestName = testName; diff --git a/xpcom/tests/TestHashtables.cpp b/xpcom/tests/TestHashtables.cpp index 5d3ac01b912..ef5eefd138c 100644 --- a/xpcom/tests/TestHashtables.cpp +++ b/xpcom/tests/TestHashtables.cpp @@ -21,7 +21,7 @@ namespace TestHashtables { class TestUniChar // for nsClassHashtable { public: - TestUniChar(uint32_t aWord) + explicit TestUniChar(uint32_t aWord) { printf(" TestUniChar::TestUniChar() %u\n", aWord); mWord = aWord; @@ -70,7 +70,7 @@ public: typedef const char* KeyType; typedef const char* KeyTypePointer; - EntityToUnicodeEntry(const char* aKey) { mNode = nullptr; } + explicit EntityToUnicodeEntry(const char* aKey) { mNode = nullptr; } EntityToUnicodeEntry(const EntityToUnicodeEntry& aEntry) { mNode = aEntry.mNode; } ~EntityToUnicodeEntry() { } diff --git a/xpcom/tests/TestObserverService.cpp b/xpcom/tests/TestObserverService.cpp index ebe2b3f3499..4c1058e95b7 100644 --- a/xpcom/tests/TestObserverService.cpp +++ b/xpcom/tests/TestObserverService.cpp @@ -34,7 +34,7 @@ class TestObserver MOZ_FINAL : public nsIObserver, public nsSupportsWeakReference { public: - TestObserver( const nsAString &name ) + explicit TestObserver( const nsAString &name ) : mName( name ) { } NS_DECL_ISUPPORTS diff --git a/xpcom/tests/TestRacingServiceManager.cpp b/xpcom/tests/TestRacingServiceManager.cpp index 1852cf34d83..23ba19981fb 100644 --- a/xpcom/tests/TestRacingServiceManager.cpp +++ b/xpcom/tests/TestRacingServiceManager.cpp @@ -67,7 +67,7 @@ bool gMainThreadWaiting = false; class AutoCreateAndDestroyReentrantMonitor { public: - AutoCreateAndDestroyReentrantMonitor(ReentrantMonitor** aReentrantMonitorPtr) + explicit AutoCreateAndDestroyReentrantMonitor(ReentrantMonitor** aReentrantMonitorPtr) : mReentrantMonitorPtr(aReentrantMonitorPtr) { *aReentrantMonitorPtr = new ReentrantMonitor("TestRacingServiceManager::AutoMon"); diff --git a/xpcom/tests/TestThreadPoolListener.cpp b/xpcom/tests/TestThreadPoolListener.cpp index 05a91293c0a..9b0b10a4125 100644 --- a/xpcom/tests/TestThreadPoolListener.cpp +++ b/xpcom/tests/TestThreadPoolListener.cpp @@ -115,7 +115,7 @@ Listener::OnThreadShuttingDown() class AutoCreateAndDestroyReentrantMonitor { public: - AutoCreateAndDestroyReentrantMonitor(ReentrantMonitor** aReentrantMonitorPtr) + explicit AutoCreateAndDestroyReentrantMonitor(ReentrantMonitor** aReentrantMonitorPtr) : mReentrantMonitorPtr(aReentrantMonitorPtr) { *aReentrantMonitorPtr = new ReentrantMonitor("TestThreadPoolListener::AutoMon"); TEST_ASSERTION(*aReentrantMonitorPtr, "Out of memory!"); diff --git a/xpcom/threads/TimerThread.cpp b/xpcom/threads/TimerThread.cpp index 767f0e5c2bb..3ac8f24473e 100644 --- a/xpcom/threads/TimerThread.cpp +++ b/xpcom/threads/TimerThread.cpp @@ -51,7 +51,7 @@ namespace { class TimerObserverRunnable : public nsRunnable { public: - TimerObserverRunnable(nsIObserver* aObserver) + explicit TimerObserverRunnable(nsIObserver* aObserver) : mObserver(aObserver) { } diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp index d62e923160e..f3f7fe2d1ad 100644 --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -243,7 +243,7 @@ struct nsThreadShutdownContext class nsThreadShutdownAckEvent : public nsRunnable { public: - nsThreadShutdownAckEvent(nsThreadShutdownContext* aCtx) + explicit nsThreadShutdownAckEvent(nsThreadShutdownContext* aCtx) : mShutdownContext(aCtx) { } From ed7cc548988c05b72859e01e26409386d6aae0de Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 5 Aug 2014 09:37:28 -0400 Subject: [PATCH 31/60] Bug 1048252 - Fix some bad implicit constructors in chromium IPC code; r=bent --- ipc/chromium/src/base/message_loop.h | 2 +- ipc/chromium/src/base/observer_list.h | 4 ++-- ipc/chromium/src/base/ref_counted.h | 4 ++-- ipc/chromium/src/base/revocable_store.h | 4 ++-- ipc/chromium/src/base/string_piece.h | 4 ++-- ipc/chromium/src/base/thread_collision_warner.h | 2 +- ipc/chromium/src/base/time.cc | 6 +++--- ipc/chromium/src/base/time.h | 6 +++--- ipc/chromium/src/base/timer.h | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ipc/chromium/src/base/message_loop.h b/ipc/chromium/src/base/message_loop.h index d04590684b7..a43e1117328 100644 --- a/ipc/chromium/src/base/message_loop.h +++ b/ipc/chromium/src/base/message_loop.h @@ -458,7 +458,7 @@ public: // class MessageLoopForUI : public MessageLoop { public: - MessageLoopForUI(Type type=TYPE_UI) : MessageLoop(type) { + explicit MessageLoopForUI(Type type=TYPE_UI) : MessageLoop(type) { } // Returns the MessageLoopForUI of the current thread. diff --git a/ipc/chromium/src/base/observer_list.h b/ipc/chromium/src/base/observer_list.h index 66c60da47a6..c387bd9483b 100644 --- a/ipc/chromium/src/base/observer_list.h +++ b/ipc/chromium/src/base/observer_list.h @@ -77,7 +77,7 @@ class ObserverList { }; ObserverList() : notify_depth_(0), type_(NOTIFY_ALL) {} - ObserverList(NotificationType type) : notify_depth_(0), type_(type) {} + explicit ObserverList(NotificationType type) : notify_depth_(0), type_(type) {} ~ObserverList() { // When check_empty is true, assert that the list is empty on destruction. if (check_empty) { @@ -118,7 +118,7 @@ class ObserverList { // also the FOREACH_OBSERVER macro defined below. class Iterator { public: - Iterator(const ObserverList& list) + explicit Iterator(const ObserverList& list) : list_(list), index_(0), max_index_(list.type_ == NOTIFY_ALL ? diff --git a/ipc/chromium/src/base/ref_counted.h b/ipc/chromium/src/base/ref_counted.h index 18e2794bd88..10e9dbbd2d0 100644 --- a/ipc/chromium/src/base/ref_counted.h +++ b/ipc/chromium/src/base/ref_counted.h @@ -120,7 +120,7 @@ template class RefCountedData : public base::RefCounted< base::RefCountedData > { public: RefCountedData() : data() {} - RefCountedData(const T& in_value) : data(in_value) {} + explicit RefCountedData(const T& in_value) : data(in_value) {} T data; }; @@ -181,7 +181,7 @@ class scoped_refptr { scoped_refptr() : ptr_(NULL) { } - scoped_refptr(T* p) : ptr_(p) { + MOZ_IMPLICIT scoped_refptr(T* p) : ptr_(p) { if (ptr_) ptr_->AddRef(); } diff --git a/ipc/chromium/src/base/revocable_store.h b/ipc/chromium/src/base/revocable_store.h index b0f1f3170c1..11acbe9e7b5 100644 --- a/ipc/chromium/src/base/revocable_store.h +++ b/ipc/chromium/src/base/revocable_store.h @@ -17,7 +17,7 @@ class RevocableStore { // require the store. class StoreRef : public base::RefCounted { public: - StoreRef(RevocableStore* store) : store_(store) { } + explicit StoreRef(RevocableStore* store) : store_(store) { } void set_store(RevocableStore* store) { store_ = store; } RevocableStore* store() const { return store_; } @@ -32,7 +32,7 @@ class RevocableStore { // store. class Revocable { public: - Revocable(RevocableStore* store); + explicit Revocable(RevocableStore* store); ~Revocable(); // This item has been revoked if it no longer has a pointer to the store. diff --git a/ipc/chromium/src/base/string_piece.h b/ipc/chromium/src/base/string_piece.h index 0d867ae2deb..90edb2efe30 100644 --- a/ipc/chromium/src/base/string_piece.h +++ b/ipc/chromium/src/base/string_piece.h @@ -37,9 +37,9 @@ class StringPiece { // in a "const char*" or a "string" wherever a "StringPiece" is // expected. StringPiece() : ptr_(NULL), length_(0) { } - StringPiece(const char* str) + MOZ_IMPLICIT StringPiece(const char* str) : ptr_(str), length_((str == NULL) ? 0 : strlen(str)) { } - StringPiece(const std::string& str) + MOZ_IMPLICIT StringPiece(const std::string& str) : ptr_(str.data()), length_(str.size()) { } StringPiece(const char* offset, size_type len) : ptr_(offset), length_(len) { } diff --git a/ipc/chromium/src/base/thread_collision_warner.h b/ipc/chromium/src/base/thread_collision_warner.h index 3b4230a6d24..b63bc742efb 100644 --- a/ipc/chromium/src/base/thread_collision_warner.h +++ b/ipc/chromium/src/base/thread_collision_warner.h @@ -142,7 +142,7 @@ struct DCheckAsserter : public AsserterBase { class ThreadCollisionWarner { public: // The parameter asserter is there only for test purpose - ThreadCollisionWarner(AsserterBase* asserter = new DCheckAsserter()) + explicit ThreadCollisionWarner(AsserterBase* asserter = new DCheckAsserter()) : valid_thread_id_(0), counter_(0), asserter_(asserter) {} diff --git a/ipc/chromium/src/base/time.cc b/ipc/chromium/src/base/time.cc index 09e10e86774..00116aab78a 100644 --- a/ipc/chromium/src/base/time.cc +++ b/ipc/chromium/src/base/time.cc @@ -51,7 +51,7 @@ int64_t TimeDelta::InMicroseconds() const { Time Time::FromTimeT(time_t tt) { if (tt == 0) return Time(); // Preserve 0 so we can tell it doesn't exist. - return (tt * kMicrosecondsPerSecond) + kTimeTToMicrosecondsOffset; + return Time((tt * kMicrosecondsPerSecond) + kTimeTToMicrosecondsOffset); } time_t Time::ToTimeT() const { @@ -62,8 +62,8 @@ time_t Time::ToTimeT() const { // static Time Time::FromDoubleT(double dt) { - return (dt * static_cast(kMicrosecondsPerSecond)) + - kTimeTToMicrosecondsOffset; + return Time((dt * static_cast(kMicrosecondsPerSecond)) + + kTimeTToMicrosecondsOffset); } double Time::ToDoubleT() const { diff --git a/ipc/chromium/src/base/time.h b/ipc/chromium/src/base/time.h index 5b8b0c30020..98d03654af5 100644 --- a/ipc/chromium/src/base/time.h +++ b/ipc/chromium/src/base/time.h @@ -297,10 +297,10 @@ class Time { // Return a new time modified by some delta. Time operator+(TimeDelta delta) const { - return us_ + delta.delta_; + return Time(us_ + delta.delta_); } Time operator-(TimeDelta delta) const { - return us_ - delta.delta_; + return Time(us_ - delta.delta_); } // Comparison operators @@ -334,7 +334,7 @@ class Time { // |is_local = true| or UTC |is_local = false|. static Time FromExploded(bool is_local, const Exploded& exploded); - Time(int64_t us) : us_(us) { + explicit Time(int64_t us) : us_(us) { } // The representation of Jan 1, 1970 UTC in microseconds since the diff --git a/ipc/chromium/src/base/timer.h b/ipc/chromium/src/base/timer.h index 887c2c3f859..59822c7566a 100644 --- a/ipc/chromium/src/base/timer.h +++ b/ipc/chromium/src/base/timer.h @@ -85,7 +85,7 @@ class BaseTimer_Helper { // We have access to the timer_ member so we can orphan this task. class TimerTask : public Task { public: - TimerTask(TimeDelta delay) : delay_(delay) { + explicit TimerTask(TimeDelta delay) : delay_(delay) { // timer_ is set in InitiateDelayedTask. } virtual ~TimerTask() {} From 08cd7e500ee6502bbb63a73f54a56bed99144506 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 5 Aug 2014 09:38:21 -0400 Subject: [PATCH 32/60] Bug 1048241 - Fix more bad implicit constructors in widget; r=roc --- widget/nsIWidget.h | 10 +++++----- widget/xpwidgets/GfxInfoCollector.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index fceaff168e4..dac93db2d84 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -244,7 +244,7 @@ struct nsIMEUpdatePreference { { } - nsIMEUpdatePreference(Notifications aWantUpdates) + explicit nsIMEUpdatePreference(Notifications aWantUpdates) : mWantUpdates(aWantUpdates | DEFAULT_CONDITIONS_OF_NOTIFYING_CHANGES) { } @@ -369,7 +369,7 @@ struct IMEState { IMEState() : mEnabled(ENABLED), mOpen(DONT_CHANGE_OPEN_STATE) { } - IMEState(Enabled aEnabled, Open aOpen = DONT_CHANGE_OPEN_STATE) : + explicit IMEState(Enabled aEnabled, Open aOpen = DONT_CHANGE_OPEN_STATE) : mEnabled(aEnabled), mOpen(aOpen) { } @@ -452,8 +452,8 @@ struct InputContextAction { { } - InputContextAction(Cause aCause, - FocusChange aFocusChange = FOCUS_NOT_CHANGED) : + explicit InputContextAction(Cause aCause, + FocusChange aFocusChange = FOCUS_NOT_CHANGED) : mCause(aCause), mFocusChange(aFocusChange) { } @@ -510,7 +510,7 @@ enum IMEMessage MOZ_ENUM_TYPE(int8_t) struct IMENotification { - IMENotification(IMEMessage aMessage) + MOZ_IMPLICIT IMENotification(IMEMessage aMessage) : mMessage(aMessage) { switch (aMessage) { diff --git a/widget/xpwidgets/GfxInfoCollector.h b/widget/xpwidgets/GfxInfoCollector.h index c4c1a618ee1..66c35fe9672 100644 --- a/widget/xpwidgets/GfxInfoCollector.h +++ b/widget/xpwidgets/GfxInfoCollector.h @@ -29,7 +29,7 @@ class MOZ_STACK_CLASS InfoObject private: // We need to ensure that this object lives on the stack so that GC sees it properly - InfoObject(JSContext *aCx); + explicit InfoObject(JSContext *aCx); InfoObject(InfoObject&); JSContext *mCx; From 992f1f4ec9020e18b2dc4eaffded2fd44e04cf06 Mon Sep 17 00:00:00 2001 From: Peter Van der Beken Date: Wed, 9 Jul 2014 16:58:04 +0200 Subject: [PATCH 33/60] Bug 1040391 - Fix test_bug440572.html to not rely on silent failure to pass. r=bz. --HG-- extra : rebase_source : e789431a476d5b96109772084b9ce6efe4da31a6 --- dom/tests/mochitest/bugs/iframe_bug440572.html | 4 ++-- dom/tests/mochitest/bugs/test_bug440572.html | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dom/tests/mochitest/bugs/iframe_bug440572.html b/dom/tests/mochitest/bugs/iframe_bug440572.html index 8a2fdce05bd..c8d9f8fe296 100644 --- a/dom/tests/mochitest/bugs/iframe_bug440572.html +++ b/dom/tests/mochitest/bugs/iframe_bug440572.html @@ -6,11 +6,11 @@ var success = 0; try { parent[name].success = 1; + parent.postMessage(success ? "success" : "failure", "http://mochi.test:8888"); } catch (e) { - parent.postMessage(e, "http://mochi.test:8888"); + parent.postMessage(e.toString(), "http://mochi.test:8888"); } -parent.postMessage(success ? "success" : "failure", "http://mochi.test:8888");

Move on, nothing to see here...

diff --git a/dom/tests/mochitest/bugs/test_bug440572.html b/dom/tests/mochitest/bugs/test_bug440572.html index db6e4a8f373..a86f141374a 100644 --- a/dom/tests/mochitest/bugs/test_bug440572.html +++ b/dom/tests/mochitest/bugs/test_bug440572.html @@ -27,9 +27,10 @@ window.addEventListener("message", receiveMessage, false); function runtests() { - for (i in messages) { - is(messages[i], "success", "test in frame failed."); - } + is(messages.length, 3, "received the right number of messages."); + is(messages[0], "success", "test in frame failed."); + isnot(messages[1], "success", "parent[\"content\"] should be the WebIDL property of Window."); + isnot(messages[2], "success", "parent[\"dump\"] should be the WebIDL property of Window."); SimpleTest.finish(); } From b4e226068afdadbc87ee00e1381af620a6c61311 Mon Sep 17 00:00:00 2001 From: Peter Van der Beken Date: Fri, 18 Jul 2014 00:17:17 +0200 Subject: [PATCH 34/60] Bug 1039187 - [Bluetooth] Bluetooth2 build fail. r=bz. --HG-- extra : rebase_source : d3ce4805bcdfe5e12b230efee479ea8002d95e5f --- dom/bindings/Codegen.py | 166 +++++++++++++++++++++++++++------------- 1 file changed, 114 insertions(+), 52 deletions(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 4a7f25cc327..3f616e43f43 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -10448,6 +10448,59 @@ def stripTrailingWhitespace(text): lines = text.splitlines() return '\n'.join(line.rstrip() for line in lines) + tail +class MemberProperties: + def __init__(self): + self.isGenericMethod = False + self.isCrossOriginMethod = False + self.isPromiseReturningMethod = False + self.isGenericGetter = False + self.isLenientGetter = False + self.isCrossOriginGetter = False + self.isGenericSetter = False + self.isLenientSetter = False + self.isCrossOriginSetter = False + self.isJsonifier = False + +def memberProperties(m, descriptor): + props = MemberProperties() + if m.isMethod(): + if m == descriptor.operations['Jsonifier']: + props.isGenericMethod = descriptor.needsSpecialGenericOps() + props.isJsonifier = True + elif (not m.isIdentifierLess() or m == descriptor.operations['Stringifier']): + if not m.isStatic() and descriptor.interface.hasInterfacePrototypeObject(): + if m.returnsPromise() and descriptor.needsSpecialGenericOps(): + props.isPromiseReturningMethod = True + if m.getExtendedAttribute("CrossOriginCallable"): + props.isCrossOriginMethod = True + elif descriptor.needsSpecialGenericOps(): + props.isGenericMethod = True + elif m.isAttr(): + if not m.isStatic() and descriptor.interface.hasInterfacePrototypeObject(): + if m.hasLenientThis(): + props.isLenientGetter = True + elif m.getExtendedAttribute("CrossOriginReadable"): + props.isCrossOriginGetter = True + elif descriptor.needsSpecialGenericOps(): + props.isGenericGetter = True + if not m.readonly: + if not m.isStatic() and descriptor.interface.hasInterfacePrototypeObject(): + if m.hasLenientThis(): + props.isLenientSetter = True + elif IsCrossOriginWritable(m, descriptor): + props.isCrossOriginSetter = True + elif descriptor.needsSpecialGenericOps(): + props.isGenericSetter = True + elif m.getExtendedAttribute("PutForwards"): + if IsCrossOriginWritable(m, descriptor): + props.isCrossOriginSetter = True + elif descriptor.needsSpecialGenericOps(): + props.isGenericSetter = True + elif m.getExtendedAttribute("Replaceable"): + if descriptor.needsSpecialGenericOps(): + props.isGenericSetter = True + + return props class CGDescriptor(CGThing): def __init__(self, descriptor): @@ -10467,9 +10520,9 @@ class CGDescriptor(CGThing): descriptor.nativeType)) # These are set to true if at least one non-static # method/getter/setter or jsonifier exist on the interface. - (hasMethod, hasGetter, hasLenientGetter, hasSetter, hasJsonifier, - hasLenientSetter, - hasPromiseReturningMethod) = False, False, False, False, False, False, False + (hasMethod, hasGetter, hasLenientGetter, hasSetter, hasLenientSetter, + hasPromiseReturningMethod) = False, False, False, False, False, False + jsonifierMethod = None crossOriginMethods, crossOriginGetters, crossOriginSetters = set(), set(), set() for n in descriptor.interface.namedConstructors: cgThings.append(CGClassConstructor(descriptor, n, @@ -10479,29 +10532,26 @@ class CGDescriptor(CGThing): continue if not isMaybeExposedIn(m, descriptor): continue - if m.isMethod() and m == descriptor.operations['Jsonifier']: - hasJsonifier = True - hasMethod = descriptor.needsSpecialGenericOps() - jsonifierMethod = m - elif (m.isMethod() and - (not m.isIdentifierLess() or m == descriptor.operations['Stringifier'])): - if m.isStatic(): - assert descriptor.interface.hasInterfaceObject() - cgThings.append(CGStaticMethod(descriptor, m)) - if m.returnsPromise(): - cgThings.append(CGStaticMethodJitinfo(m)) - elif descriptor.interface.hasInterfacePrototypeObject(): - specializedMethod = CGSpecializedMethod(descriptor, m) - cgThings.append(specializedMethod) - if m.returnsPromise(): - if descriptor.needsSpecialGenericOps(): - hasPromiseReturningMethod = True - cgThings.append(CGMethodPromiseWrapper(descriptor, specializedMethod)) - cgThings.append(CGMemberJITInfo(descriptor, m)) - if m.getExtendedAttribute("CrossOriginCallable"): - crossOriginMethods.add(m.identifier.name) - elif descriptor.needsSpecialGenericOps(): - hasMethod = True + + props = memberProperties(m, descriptor) + + if m.isMethod(): + if props.isJsonifier: + jsonifierMethod = m + elif not m.isIdentifierLess() or m == descriptor.operations['Stringifier']: + if m.isStatic(): + assert descriptor.interface.hasInterfaceObject() + cgThings.append(CGStaticMethod(descriptor, m)) + if m.returnsPromise(): + cgThings.append(CGStaticMethodJitinfo(m)) + elif descriptor.interface.hasInterfacePrototypeObject(): + specializedMethod = CGSpecializedMethod(descriptor, m) + cgThings.append(specializedMethod) + if m.returnsPromise(): + cgThings.append(CGMethodPromiseWrapper(descriptor, specializedMethod)) + cgThings.append(CGMemberJITInfo(descriptor, m)) + if props.isCrossOriginMethod: + crossOriginMethods.add(m.identifier.name) elif m.isAttr(): if m.stringifier: raise TypeError("Stringifier attributes not supported yet. " @@ -10512,12 +10562,8 @@ class CGDescriptor(CGThing): cgThings.append(CGStaticGetter(descriptor, m)) elif descriptor.interface.hasInterfacePrototypeObject(): cgThings.append(CGSpecializedGetter(descriptor, m)) - if m.hasLenientThis(): - hasLenientGetter = True - elif m.getExtendedAttribute("CrossOriginReadable"): + if props.isCrossOriginGetter: crossOriginGetters.add(m.identifier.name) - elif descriptor.needsSpecialGenericOps(): - hasGetter = True if not m.readonly: for extAttr in ["PutForwards", "Replaceable"]: if m.getExtendedAttribute(extAttr): @@ -10530,26 +10576,27 @@ class CGDescriptor(CGThing): cgThings.append(CGStaticSetter(descriptor, m)) elif descriptor.interface.hasInterfacePrototypeObject(): cgThings.append(CGSpecializedSetter(descriptor, m)) - if m.hasLenientThis(): - hasLenientSetter = True - elif IsCrossOriginWritable(m, descriptor): + if props.isCrossOriginSetter: crossOriginSetters.add(m.identifier.name) - elif descriptor.needsSpecialGenericOps(): - hasSetter = True elif m.getExtendedAttribute("PutForwards"): cgThings.append(CGSpecializedForwardingSetter(descriptor, m)) - if IsCrossOriginWritable(m, descriptor): + if props.isCrossOriginSetter: crossOriginSetters.add(m.identifier.name) - elif descriptor.needsSpecialGenericOps(): - hasSetter = True elif m.getExtendedAttribute("Replaceable"): cgThings.append(CGSpecializedReplaceableSetter(descriptor, m)) - if descriptor.needsSpecialGenericOps(): - hasSetter = True if (not m.isStatic() and descriptor.interface.hasInterfacePrototypeObject()): cgThings.append(CGMemberJITInfo(descriptor, m)) - if hasJsonifier: + + hasMethod = hasMethod or props.isGenericMethod + hasPromiseReturningMethod = (hasPromiseReturningMethod or + props.isPromiseReturningMethod) + hasGetter = hasGetter or props.isGenericGetter + hasLenientGetter = hasLenientGetter or props.isLenientGetter + hasSetter = hasSetter or props.isGenericSetter + hasLenientSetter = hasLenientSetter or props.isLenientSetter + + if jsonifierMethod: cgThings.append(CGJsonifierMethod(descriptor, jsonifierMethod)) cgThings.append(CGMemberJITInfo(descriptor, jsonifierMethod)) if hasMethod: @@ -11603,10 +11650,30 @@ class CGBindingRoot(CGThing): """ def __init__(self, config, prefix, webIDLFile): bindingHeaders = {} + bindingDeclareHeaders = dict.fromkeys(( + 'mozilla/dom/BindingDeclarations.h', + 'mozilla/dom/Nullable.h', + 'mozilla/ErrorResult.h', + ), + True) + descriptors = config.getDescriptors(webIDLFile=webIDLFile, hasInterfaceOrInterfacePrototypeObject=True, skipGen=False) + def descriptorHasCrossOriginProperties(desc): + def hasCrossOriginProperty(m): + props = memberProperties(m, desc) + return (props.isCrossOriginMethod or + props.isCrossOriginGetter or + props.isCrossOriginSetter) + + return any(hasCrossOriginProperty(m) for m in desc.interface.members) + + bindingDeclareHeaders["jsapi.h"] = any(descriptorHasCrossOriginProperties(d) for d in descriptors) + bindingDeclareHeaders["jspubtd.h"] = not bindingDeclareHeaders["jsapi.h"] + bindingDeclareHeaders["js/RootingAPI.h"] = not bindingDeclareHeaders["jsapi.h"] + def descriptorRequiresPreferences(desc): iface = desc.interface return any(m.getExtendedAttribute("Pref") for m in iface.members + [iface]) @@ -11647,6 +11714,7 @@ class CGBindingRoot(CGThing): isCallback=True) jsImplemented = config.getDescriptors(webIDLFile=webIDLFile, isJSImplemented=True) + bindingDeclareHeaders["nsWeakReference.h"] = jsImplemented bindingHeaders["nsPIDOMWindow.h"] = jsImplemented bindingHeaders["AtomList.h"] = hasNonEmptyDictionaries or jsImplemented or callbackDescriptors @@ -11751,21 +11819,15 @@ class CGBindingRoot(CGThing): bindingHeaders = [header for header, include in bindingHeaders.iteritems() if include] - declareIncludes = [ - 'mozilla/dom/BindingDeclarations.h', - 'mozilla/dom/Nullable.h', - 'mozilla/ErrorResult.h', - 'jspubtd.h', - 'js/RootingAPI.h', - ] - if jsImplemented: - declareIncludes.append('nsWeakReference.h') + bindingDeclareHeaders = [header + for header, include in bindingDeclareHeaders.iteritems() + if include] curr = CGHeaders(descriptors, dictionaries, mainCallbacks + workerCallbacks, callbackDescriptors, - declareIncludes, + bindingDeclareHeaders, bindingHeaders, prefix, curr, From ecc2933e4b06935ea2db02cdf4555ad6469fe43c Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Tue, 5 Aug 2014 09:42:33 -0400 Subject: [PATCH 35/60] Bug 1047592 - mercurial-setup should error when trying to read a config with %include. r=gps --- tools/mercurial/hgsetup/config.py | 13 +++++++++++++ tools/mercurial/hgsetup/wizard.py | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/tools/mercurial/hgsetup/config.py b/tools/mercurial/hgsetup/config.py index 78e3bb6408a..e7f9d830d70 100644 --- a/tools/mercurial/hgsetup/config.py +++ b/tools/mercurial/hgsetup/config.py @@ -16,6 +16,10 @@ HOST_FINGERPRINTS = { } +class HgIncludeException(Exception): + pass + + class MercurialConfig(object): """Interface for manipulating a Mercurial config file.""" @@ -35,6 +39,15 @@ class MercurialConfig(object): else: infile = None + # Mercurial configuration files allow an %include directive to include + # other files, this is not supported by ConfigObj, so throw a useful + # error saying this. + with open(infile, 'r') as f: + for line in f: + if line.startswith('%include'): + raise HgIncludeException( + '%include directive is not supported by MercurialConfig') + # write_empty_values is necessary to prevent built-in extensions (which # have no value) from being dropped on write. # list_values aren't needed by Mercurial and disabling them prevents diff --git a/tools/mercurial/hgsetup/wizard.py b/tools/mercurial/hgsetup/wizard.py index b2c10895e2b..cbb0161c07a 100644 --- a/tools/mercurial/hgsetup/wizard.py +++ b/tools/mercurial/hgsetup/wizard.py @@ -23,6 +23,7 @@ from mozversioncontrol.repoupdate import ( ) from .config import ( + HgIncludeException, HOST_FINGERPRINTS, MercurialConfig, ) @@ -195,6 +196,10 @@ class MercurialSetupWizard(object): print(error.message) return 1 + except HgIncludeException as e: + print(e.message) + + return 1 print(INITIAL_MESSAGE) raw_input() From 526b2765aa61f43aa6ef0d5ac0425d1c29dbbc1b Mon Sep 17 00:00:00 2001 From: Gian-Carlo Pascutto Date: Tue, 5 Aug 2014 15:48:15 +0200 Subject: [PATCH 36/60] Bug 1043350 - Do not disable Aero mode when screen capturing. r=jesup --- .../trunk/webrtc/video_engine/desktop_capture_impl.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/media/webrtc/trunk/webrtc/video_engine/desktop_capture_impl.cc b/media/webrtc/trunk/webrtc/video_engine/desktop_capture_impl.cc index 1a8deb117c9..dd2d7152efb 100644 --- a/media/webrtc/trunk/webrtc/video_engine/desktop_capture_impl.cc +++ b/media/webrtc/trunk/webrtc/video_engine/desktop_capture_impl.cc @@ -359,7 +359,12 @@ int32_t DesktopCaptureImpl::Init(const char* uniqueId, MouseCursorMonitor * pMouseCursorMonitor = MouseCursorMonitor::CreateForScreen(webrtc::DesktopCaptureOptions::CreateDefault(), webrtc::kFullDesktopScreenId); desktop_capturer_cursor_composer_.reset(new DesktopAndCursorComposer(pAppCapturer, pMouseCursorMonitor)); } else if (type == Screen) { - ScreenCapturer *pScreenCapturer = ScreenCapturer::Create(); + + DesktopCaptureOptions options = DesktopCaptureOptions::CreateDefault(); + // Leave desktop effects enabled during WebRTC captures. + options.set_disable_effects(false); + + ScreenCapturer *pScreenCapturer = ScreenCapturer::Create(options); if (!pScreenCapturer) { return -1; } @@ -368,7 +373,7 @@ int32_t DesktopCaptureImpl::Init(const char* uniqueId, pScreenCapturer->SelectScreen(screenid); pScreenCapturer->SetMouseShapeObserver(this); - MouseCursorMonitor * pMouseCursorMonitor = MouseCursorMonitor::CreateForScreen(webrtc::DesktopCaptureOptions::CreateDefault(), screenid); + MouseCursorMonitor * pMouseCursorMonitor = MouseCursorMonitor::CreateForScreen(options, screenid); desktop_capturer_cursor_composer_.reset(new DesktopAndCursorComposer(pScreenCapturer, pMouseCursorMonitor)); } else if (type == Window) { WindowCapturer *pWindowCapturer = WindowCapturer::Create(); From cdcd0b26ea3dd5022795ec376528a7845ba8a7d6 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Mon, 4 Aug 2014 06:55:01 -0700 Subject: [PATCH 37/60] Bug 1047876 - Flatten modules/libjar/zipwriter/{public,src}/ directories. r=glandium --HG-- rename : modules/libjar/zipwriter/src/StreamFunctions.cpp => modules/libjar/zipwriter/StreamFunctions.cpp rename : modules/libjar/zipwriter/src/StreamFunctions.h => modules/libjar/zipwriter/StreamFunctions.h rename : modules/libjar/zipwriter/src/ZipWriterModule.cpp => modules/libjar/zipwriter/ZipWriterModule.cpp rename : modules/libjar/zipwriter/src/nsDeflateConverter.cpp => modules/libjar/zipwriter/nsDeflateConverter.cpp rename : modules/libjar/zipwriter/src/nsDeflateConverter.h => modules/libjar/zipwriter/nsDeflateConverter.h rename : modules/libjar/zipwriter/public/nsIZipWriter.idl => modules/libjar/zipwriter/nsIZipWriter.idl rename : modules/libjar/zipwriter/src/nsZipDataStream.cpp => modules/libjar/zipwriter/nsZipDataStream.cpp rename : modules/libjar/zipwriter/src/nsZipDataStream.h => modules/libjar/zipwriter/nsZipDataStream.h rename : modules/libjar/zipwriter/src/nsZipHeader.cpp => modules/libjar/zipwriter/nsZipHeader.cpp rename : modules/libjar/zipwriter/src/nsZipHeader.h => modules/libjar/zipwriter/nsZipHeader.h rename : modules/libjar/zipwriter/src/nsZipWriter.cpp => modules/libjar/zipwriter/nsZipWriter.cpp rename : modules/libjar/zipwriter/src/nsZipWriter.h => modules/libjar/zipwriter/nsZipWriter.h --- .../zipwriter/{src => }/StreamFunctions.cpp | 0 .../zipwriter/{src => }/StreamFunctions.h | 0 .../zipwriter/{src => }/ZipWriterModule.cpp | 0 modules/libjar/zipwriter/moz.build | 19 ++++++++++++++++++- .../{src => }/nsDeflateConverter.cpp | 0 .../zipwriter/{src => }/nsDeflateConverter.h | 0 .../zipwriter/{public => }/nsIZipWriter.idl | 0 .../zipwriter/{src => }/nsZipDataStream.cpp | 0 .../zipwriter/{src => }/nsZipDataStream.h | 0 .../zipwriter/{src => }/nsZipHeader.cpp | 0 .../libjar/zipwriter/{src => }/nsZipHeader.h | 0 .../zipwriter/{src => }/nsZipWriter.cpp | 0 .../libjar/zipwriter/{src => }/nsZipWriter.h | 0 modules/libjar/zipwriter/public/moz.build | 12 ------------ modules/libjar/zipwriter/src/moz.build | 18 ------------------ 15 files changed, 18 insertions(+), 31 deletions(-) rename modules/libjar/zipwriter/{src => }/StreamFunctions.cpp (100%) rename modules/libjar/zipwriter/{src => }/StreamFunctions.h (100%) rename modules/libjar/zipwriter/{src => }/ZipWriterModule.cpp (100%) rename modules/libjar/zipwriter/{src => }/nsDeflateConverter.cpp (100%) rename modules/libjar/zipwriter/{src => }/nsDeflateConverter.h (100%) rename modules/libjar/zipwriter/{public => }/nsIZipWriter.idl (100%) rename modules/libjar/zipwriter/{src => }/nsZipDataStream.cpp (100%) rename modules/libjar/zipwriter/{src => }/nsZipDataStream.h (100%) rename modules/libjar/zipwriter/{src => }/nsZipHeader.cpp (100%) rename modules/libjar/zipwriter/{src => }/nsZipHeader.h (100%) rename modules/libjar/zipwriter/{src => }/nsZipWriter.cpp (100%) rename modules/libjar/zipwriter/{src => }/nsZipWriter.h (100%) delete mode 100644 modules/libjar/zipwriter/public/moz.build delete mode 100644 modules/libjar/zipwriter/src/moz.build diff --git a/modules/libjar/zipwriter/src/StreamFunctions.cpp b/modules/libjar/zipwriter/StreamFunctions.cpp similarity index 100% rename from modules/libjar/zipwriter/src/StreamFunctions.cpp rename to modules/libjar/zipwriter/StreamFunctions.cpp diff --git a/modules/libjar/zipwriter/src/StreamFunctions.h b/modules/libjar/zipwriter/StreamFunctions.h similarity index 100% rename from modules/libjar/zipwriter/src/StreamFunctions.h rename to modules/libjar/zipwriter/StreamFunctions.h diff --git a/modules/libjar/zipwriter/src/ZipWriterModule.cpp b/modules/libjar/zipwriter/ZipWriterModule.cpp similarity index 100% rename from modules/libjar/zipwriter/src/ZipWriterModule.cpp rename to modules/libjar/zipwriter/ZipWriterModule.cpp diff --git a/modules/libjar/zipwriter/moz.build b/modules/libjar/zipwriter/moz.build index 47e64e62391..5a4f32d31be 100644 --- a/modules/libjar/zipwriter/moz.build +++ b/modules/libjar/zipwriter/moz.build @@ -4,6 +4,23 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ['public', 'src'] TEST_DIRS += ['test'] +XPIDL_SOURCES += [ + 'nsIZipWriter.idl', +] + +XPIDL_MODULE = 'zipwriter' + +UNIFIED_SOURCES += [ + 'nsDeflateConverter.cpp', + 'nsZipDataStream.cpp', + 'nsZipHeader.cpp', + 'nsZipWriter.cpp', + 'StreamFunctions.cpp', + 'ZipWriterModule.cpp', +] + +MSVC_ENABLE_PGO = True + +FINAL_LIBRARY = 'xul' diff --git a/modules/libjar/zipwriter/src/nsDeflateConverter.cpp b/modules/libjar/zipwriter/nsDeflateConverter.cpp similarity index 100% rename from modules/libjar/zipwriter/src/nsDeflateConverter.cpp rename to modules/libjar/zipwriter/nsDeflateConverter.cpp diff --git a/modules/libjar/zipwriter/src/nsDeflateConverter.h b/modules/libjar/zipwriter/nsDeflateConverter.h similarity index 100% rename from modules/libjar/zipwriter/src/nsDeflateConverter.h rename to modules/libjar/zipwriter/nsDeflateConverter.h diff --git a/modules/libjar/zipwriter/public/nsIZipWriter.idl b/modules/libjar/zipwriter/nsIZipWriter.idl similarity index 100% rename from modules/libjar/zipwriter/public/nsIZipWriter.idl rename to modules/libjar/zipwriter/nsIZipWriter.idl diff --git a/modules/libjar/zipwriter/src/nsZipDataStream.cpp b/modules/libjar/zipwriter/nsZipDataStream.cpp similarity index 100% rename from modules/libjar/zipwriter/src/nsZipDataStream.cpp rename to modules/libjar/zipwriter/nsZipDataStream.cpp diff --git a/modules/libjar/zipwriter/src/nsZipDataStream.h b/modules/libjar/zipwriter/nsZipDataStream.h similarity index 100% rename from modules/libjar/zipwriter/src/nsZipDataStream.h rename to modules/libjar/zipwriter/nsZipDataStream.h diff --git a/modules/libjar/zipwriter/src/nsZipHeader.cpp b/modules/libjar/zipwriter/nsZipHeader.cpp similarity index 100% rename from modules/libjar/zipwriter/src/nsZipHeader.cpp rename to modules/libjar/zipwriter/nsZipHeader.cpp diff --git a/modules/libjar/zipwriter/src/nsZipHeader.h b/modules/libjar/zipwriter/nsZipHeader.h similarity index 100% rename from modules/libjar/zipwriter/src/nsZipHeader.h rename to modules/libjar/zipwriter/nsZipHeader.h diff --git a/modules/libjar/zipwriter/src/nsZipWriter.cpp b/modules/libjar/zipwriter/nsZipWriter.cpp similarity index 100% rename from modules/libjar/zipwriter/src/nsZipWriter.cpp rename to modules/libjar/zipwriter/nsZipWriter.cpp diff --git a/modules/libjar/zipwriter/src/nsZipWriter.h b/modules/libjar/zipwriter/nsZipWriter.h similarity index 100% rename from modules/libjar/zipwriter/src/nsZipWriter.h rename to modules/libjar/zipwriter/nsZipWriter.h diff --git a/modules/libjar/zipwriter/public/moz.build b/modules/libjar/zipwriter/public/moz.build deleted file mode 100644 index 193d8cef81b..00000000000 --- a/modules/libjar/zipwriter/public/moz.build +++ /dev/null @@ -1,12 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -XPIDL_SOURCES += [ - 'nsIZipWriter.idl', -] - -XPIDL_MODULE = 'zipwriter' - diff --git a/modules/libjar/zipwriter/src/moz.build b/modules/libjar/zipwriter/src/moz.build deleted file mode 100644 index e1aca964a51..00000000000 --- a/modules/libjar/zipwriter/src/moz.build +++ /dev/null @@ -1,18 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -UNIFIED_SOURCES += [ - 'nsDeflateConverter.cpp', - 'nsZipDataStream.cpp', - 'nsZipHeader.cpp', - 'nsZipWriter.cpp', - 'StreamFunctions.cpp', - 'ZipWriterModule.cpp', -] - -MSVC_ENABLE_PGO = True - -FINAL_LIBRARY = 'xul' From b38e9873f06ffc30fe83a9c8aa2d5c973e085236 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Mon, 4 Aug 2014 07:40:13 -0700 Subject: [PATCH 38/60] Bug 1048277 - Fix selector for hiding about:neterror icon when content area is sufficiently small. r=Unfocused --- browser/base/content/aboutneterror/netError.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/base/content/aboutneterror/netError.css b/browser/base/content/aboutneterror/netError.css index 69fbd10f3bd..bf83610ec3d 100644 --- a/browser/base/content/aboutneterror/netError.css +++ b/browser/base/content/aboutneterror/netError.css @@ -52,7 +52,7 @@ ul { } @media (max-width: 675px) { - #errorTitle { + #errorTitleText { padding-top: 0; background-image: none; -moz-padding-start: 0; From 9a88a971d8e7f6ee30790085c901873bed03b68f Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Tue, 5 Aug 2014 06:47:16 -0700 Subject: [PATCH 39/60] Bug 1048356 - Add missing + +