Skip to content

Commit

Permalink
Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=To…
Browse files Browse the repository at this point in the history
…mcat

The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
  • Loading branch information
froydnj committed Oct 18, 2015
1 parent 4837836 commit 0158360
Show file tree
Hide file tree
Showing 3,177 changed files with 16,667 additions and 16,667 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
18 changes: 9 additions & 9 deletions accessible/base/AccEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class AccEvent
bool mIsFromUserInput;
uint32_t mEventType;
EEventRule mEventRule;
nsRefPtr<Accessible> mAccessible;
RefPtr<Accessible> mAccessible;

friend class EventQueue;
friend class AccReorderEvent;
Expand Down Expand Up @@ -237,8 +237,8 @@ class AccMutationEvent: public AccEvent

protected:
nsCOMPtr<nsINode> mNode;
nsRefPtr<Accessible> mParent;
nsRefPtr<AccTextChangeEvent> mTextChangeEvent;
RefPtr<Accessible> mParent;
RefPtr<AccTextChangeEvent> mTextChangeEvent;

friend class EventQueue;
};
Expand Down Expand Up @@ -268,8 +268,8 @@ class AccHideEvent: public AccMutationEvent

protected:
bool mNeedsShutdown;
nsRefPtr<Accessible> mNextSibling;
nsRefPtr<Accessible> mPrevSibling;
RefPtr<Accessible> mNextSibling;
RefPtr<Accessible> mPrevSibling;

friend class EventQueue;
};
Expand Down Expand Up @@ -397,7 +397,7 @@ class AccTextSelChangeEvent : public AccEvent
bool IsCaretMoveOnly() const;

private:
nsRefPtr<dom::Selection> mSel;
RefPtr<dom::Selection> mSel;
int32_t mReason;

friend class EventQueue;
Expand Down Expand Up @@ -432,8 +432,8 @@ class AccSelChangeEvent : public AccEvent
Accessible* Widget() const { return mWidget; }

private:
nsRefPtr<Accessible> mWidget;
nsRefPtr<Accessible> mItem;
RefPtr<Accessible> mWidget;
RefPtr<Accessible> mItem;
SelChangeType mSelChangeType;
uint32_t mPreceedingCount;
AccSelChangeEvent* mPackedEvent;
Expand Down Expand Up @@ -495,7 +495,7 @@ class AccVCChangeEvent : public AccEvent
int32_t Reason() const { return mReason; }

private:
nsRefPtr<Accessible> mOldAccessible;
RefPtr<Accessible> mOldAccessible;
int32_t mOldStart;
int32_t mOldEnd;
int16_t mReason;
Expand Down
2 changes: 1 addition & 1 deletion accessible/base/AccIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ ARIAOwnsIterator::Next()
Accessible*
SingleAccIterator::Next()
{
nsRefPtr<Accessible> nextAcc;
RefPtr<Accessible> nextAcc;
mAcc.swap(nextAcc);
if (!nextAcc || nextAcc->IsDefunct()) {
return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion accessible/base/AccIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class SingleAccIterator : public AccIterable
SingleAccIterator(const SingleAccIterator&);
SingleAccIterator& operator = (const SingleAccIterator&);

nsRefPtr<Accessible> mAcc;
RefPtr<Accessible> mAcc;
};


Expand Down
2 changes: 1 addition & 1 deletion accessible/base/DocManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ DocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
// We only create root accessibles for the true root, otherwise create a
// doc accessible.
nsIContent *rootElm = nsCoreUtils::GetRoleContent(aDocument);
nsRefPtr<DocAccessible> docAcc = isRootDoc ?
RefPtr<DocAccessible> docAcc = isRootDoc ?
new RootAccessibleWrap(aDocument, rootElm, presShell) :
new DocAccessibleWrap(aDocument, rootElm, presShell);

Expand Down
4 changes: 2 additions & 2 deletions accessible/base/EventQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ EventQueue::PushEvent(AccEvent* aEvent)
ENameValueFlag nameFlag = parent->Name(name);
// If name is obtained from subtree, fire name change event.
if (nameFlag == eNameFromSubtree) {
nsRefPtr<AccEvent> nameChangeEvent =
RefPtr<AccEvent> nameChangeEvent =
new AccEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, parent);
PushEvent(nameChangeEvent);
}
Expand Down Expand Up @@ -482,7 +482,7 @@ void
EventQueue::ProcessEventQueue()
{
// Process only currently queued events.
nsTArray<nsRefPtr<AccEvent> > events;
nsTArray<RefPtr<AccEvent> > events;
events.SwapElements(mEvents);

uint32_t eventCount = events.Length();
Expand Down
2 changes: 1 addition & 1 deletion accessible/base/EventQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class EventQueue
* Pending events array. Don't make this an nsAutoTArray; we use
* SwapElements() on it.
*/
nsTArray<nsRefPtr<AccEvent> > mEvents;
nsTArray<RefPtr<AccEvent> > mEvents;
};

} // namespace a11y
Expand Down
10 changes: 5 additions & 5 deletions accessible/base/FocusManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ FocusManager::DispatchFocusEvent(DocAccessible* aDocument,
{
NS_PRECONDITION(aDocument, "No document for focused accessible!");
if (aDocument) {
nsRefPtr<AccEvent> event =
RefPtr<AccEvent> event =
new AccEvent(nsIAccessibleEvent::EVENT_FOCUS, aTarget,
eAutoDetect, AccEvent::eCoalesceOfSameType);
aDocument->FireDelayedEvent(event);
Expand Down Expand Up @@ -331,7 +331,7 @@ FocusManager::ProcessFocusEvent(AccEvent* aEvent)
if (ARIAMenubar != mActiveARIAMenubar) {
// Leaving ARIA menu. Fire menu_end event on current menubar.
if (mActiveARIAMenubar) {
nsRefPtr<AccEvent> menuEndEvent =
RefPtr<AccEvent> menuEndEvent =
new AccEvent(nsIAccessibleEvent::EVENT_MENU_END, mActiveARIAMenubar,
aEvent->FromUserInput());
nsEventShell::FireEvent(menuEndEvent);
Expand All @@ -341,15 +341,15 @@ FocusManager::ProcessFocusEvent(AccEvent* aEvent)

// Entering ARIA menu. Fire menu_start event.
if (mActiveARIAMenubar) {
nsRefPtr<AccEvent> menuStartEvent =
RefPtr<AccEvent> menuStartEvent =
new AccEvent(nsIAccessibleEvent::EVENT_MENU_START,
mActiveARIAMenubar, aEvent->FromUserInput());
nsEventShell::FireEvent(menuStartEvent);
}
}
} else if (mActiveARIAMenubar) {
// Focus left a menu. Fire menu_end event.
nsRefPtr<AccEvent> menuEndEvent =
RefPtr<AccEvent> menuEndEvent =
new AccEvent(nsIAccessibleEvent::EVENT_MENU_END, mActiveARIAMenubar,
aEvent->FromUserInput());
nsEventShell::FireEvent(menuEndEvent);
Expand All @@ -367,7 +367,7 @@ FocusManager::ProcessFocusEvent(AccEvent* aEvent)
// offset before the caret move event is handled.
SelectionMgr()->ResetCaretOffset();

nsRefPtr<AccEvent> focusEvent =
RefPtr<AccEvent> focusEvent =
new AccEvent(nsIAccessibleEvent::EVENT_FOCUS, target, aEvent->FromUserInput());
nsEventShell::FireEvent(focusEvent);

Expand Down
4 changes: 2 additions & 2 deletions accessible/base/FocusManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ class FocusManager
nsIDocument* FocusedDOMDocument() const;

private:
nsRefPtr<Accessible> mActiveItem;
nsRefPtr<Accessible> mActiveARIAMenubar;
RefPtr<Accessible> mActiveItem;
RefPtr<Accessible> mActiveARIAMenubar;
};

} // namespace a11y
Expand Down
8 changes: 4 additions & 4 deletions accessible/base/NotificationController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ NotificationController::ScheduleContentInsertion(Accessible* aContainer,
nsIContent* aStartChildNode,
nsIContent* aEndChildNode)
{
nsRefPtr<ContentInsertion> insertion = new ContentInsertion(mDocument,
RefPtr<ContentInsertion> insertion = new ContentInsertion(mDocument,
aContainer);
if (insertion && insertion->InitChildList(aStartChildNode, aEndChildNode) &&
mContentInsertions.AppendElement(insertion)) {
Expand Down Expand Up @@ -193,7 +193,7 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
// document accessible.

// Process only currently queued content inserted notifications.
nsTArray<nsRefPtr<ContentInsertion> > contentInsertions;
nsTArray<RefPtr<ContentInsertion> > contentInsertions;
contentInsertions.SwapElements(mContentInsertions);

uint32_t insertionCount = contentInsertions.Length();
Expand Down Expand Up @@ -291,7 +291,7 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)

// Bind hanging child documents.
uint32_t hangingDocCnt = mHangingChildDocuments.Length();
nsTArray<nsRefPtr<DocAccessible>> newChildDocs;
nsTArray<RefPtr<DocAccessible>> newChildDocs;
for (uint32_t idx = 0; idx < hangingDocCnt; idx++) {
DocAccessible* childDoc = mHangingChildDocuments[idx];
if (childDoc->IsDefunct())
Expand Down Expand Up @@ -337,7 +337,7 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
}

// Process only currently queued generic notifications.
nsTArray < nsRefPtr<Notification> > notifications;
nsTArray < RefPtr<Notification> > notifications;
notifications.SwapElements(mNotifications);

uint32_t notificationCount = notifications.Length();
Expand Down
14 changes: 7 additions & 7 deletions accessible/base/NotificationController.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class TNotification : public Notification

Class* mInstance;
Callback mCallback;
Tuple<nsRefPtr<Args> ...> mArgs;
Tuple<RefPtr<Args> ...> mArgs;
};

/**
Expand Down Expand Up @@ -161,7 +161,7 @@ class NotificationController final : public EventQueue,
return;
}

nsRefPtr<Notification> notification =
RefPtr<Notification> notification =
new TNotification<Class, Arg>(aInstance, aMethod, aArg);
if (notification && mNotifications.AppendElement(notification))
ScheduleProcessing();
Expand All @@ -177,7 +177,7 @@ class NotificationController final : public EventQueue,
inline void ScheduleNotification(Class* aInstance,
typename TNotification<Class>::Callback aMethod)
{
nsRefPtr<Notification> notification =
RefPtr<Notification> notification =
new TNotification<Class>(aInstance, aMethod);
if (notification && mNotifications.AppendElement(notification))
ScheduleProcessing();
Expand Down Expand Up @@ -227,7 +227,7 @@ class NotificationController final : public EventQueue,
/**
* Child documents that needs to be bound to the tree.
*/
nsTArray<nsRefPtr<DocAccessible> > mHangingChildDocuments;
nsTArray<RefPtr<DocAccessible> > mHangingChildDocuments;

/**
* Storage for content inserted notification information.
Expand Down Expand Up @@ -257,7 +257,7 @@ class NotificationController final : public EventQueue,
DocAccessible* mDocument;

// The container accessible that content insertion occurs within.
nsRefPtr<Accessible> mContainer;
RefPtr<Accessible> mContainer;

// Array of inserted contents.
nsTArray<nsCOMPtr<nsIContent> > mInsertedContent;
Expand All @@ -267,7 +267,7 @@ class NotificationController final : public EventQueue,
* A pending accessible tree update notifications for content insertions.
* Don't make this an nsAutoTArray; we use SwapElements() on it.
*/
nsTArray<nsRefPtr<ContentInsertion> > mContentInsertions;
nsTArray<RefPtr<ContentInsertion> > mContentInsertions;

template<class T>
class nsCOMPtrHashKey : public PLDHashEntryHdr
Expand Down Expand Up @@ -302,7 +302,7 @@ class NotificationController final : public EventQueue,
* Other notifications like DOM events. Don't make this an nsAutoTArray; we
* use SwapElements() on it.
*/
nsTArray<nsRefPtr<Notification> > mNotifications;
nsTArray<RefPtr<Notification> > mNotifications;
};

} // namespace a11y
Expand Down
8 changes: 4 additions & 4 deletions accessible/base/SelectionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct mozilla::a11y::SelData final
SelData(Selection* aSel, int32_t aReason) :
mSel(aSel), mReason(aReason) {}

nsRefPtr<Selection> mSel;
RefPtr<Selection> mSel;
int16_t mReason;

NS_INLINE_DECL_REFCOUNTING(SelData)
Expand Down Expand Up @@ -164,7 +164,7 @@ SelectionManager::ProcessTextSelChangeEvent(AccEvent* aEvent)
selection->FocusOffset());
mAccWithCaret = caretCntr;
if (mCaretOffset != -1) {
nsRefPtr<AccCaretMoveEvent> caretMoveEvent =
RefPtr<AccCaretMoveEvent> caretMoveEvent =
new AccCaretMoveEvent(caretCntr, mCaretOffset, aEvent->FromUserInput());
nsEventShell::FireEvent(caretMoveEvent);
}
Expand All @@ -189,7 +189,7 @@ SelectionManager::NotifySelectionChanged(nsIDOMDocument* aDOMDocument,
// Selection manager has longer lifetime than any document accessible,
// so that we are guaranteed that the notification is processed before
// the selection manager is destroyed.
nsRefPtr<SelData> selData =
RefPtr<SelData> selData =
new SelData(static_cast<Selection*>(aSelection), aReason);
document->HandleNotification<SelectionManager, SelData>
(this, &SelectionManager::ProcessSelectionChanged, selData);
Expand Down Expand Up @@ -226,7 +226,7 @@ SelectionManager::ProcessSelectionChanged(SelData* aSelData)
}

if (selection->GetType() == nsISelectionController::SELECTION_NORMAL) {
nsRefPtr<AccEvent> event =
RefPtr<AccEvent> event =
new AccTextSelChangeEvent(text, selection, aSelData->mReason);
text->Document()->FireDelayedEvent(event);

Expand Down
2 changes: 1 addition & 1 deletion accessible/base/StyleInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class StyleInfo
void Margin(Side aSide, nsAString& aValue);

dom::Element* mElement;
nsRefPtr<nsStyleContext> mStyleContext;
RefPtr<nsStyleContext> mStyleContext;
};

} // namespace a11y
Expand Down
4 changes: 2 additions & 2 deletions accessible/base/TextAttrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ bool
TextAttrsMgr::FontFamilyTextAttr::
GetFontFamily(nsIFrame* aFrame, nsString& aFamily)
{
nsRefPtr<nsFontMetrics> fm;
RefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm));

gfxFontGroup* fontGroup = fm->GetThebesFontGroup();
Expand Down Expand Up @@ -618,7 +618,7 @@ TextAttrsMgr::FontWeightTextAttr::
{
// nsFont::width isn't suitable here because it's necessary to expose real
// value of font weight (used font might not have some font weight values).
nsRefPtr<nsFontMetrics> fm;
RefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm));

gfxFontGroup *fontGroup = fm->GetThebesFontGroup();
Expand Down
6 changes: 3 additions & 3 deletions accessible/base/TextRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ class TextRange final
HyperTextAccessible* aStopContainer = nullptr,
int32_t aStopOffset = 0);

nsRefPtr<HyperTextAccessible> mRoot;
nsRefPtr<HyperTextAccessible> mStartContainer;
nsRefPtr<HyperTextAccessible> mEndContainer;
RefPtr<HyperTextAccessible> mRoot;
RefPtr<HyperTextAccessible> mStartContainer;
RefPtr<HyperTextAccessible> mEndContainer;
int32_t mStartOffset;
int32_t mEndOffset;
};
Expand Down
8 changes: 4 additions & 4 deletions accessible/base/TextUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ TextUpdater::DoUpdate(const nsAString& aNewText, const nsAString& aOldText,
strLen1 > kMaxStrLen || strLen2 > kMaxStrLen) {
if (strLen1 > 0) {
// Fire text change event for removal.
nsRefPtr<AccEvent> textRemoveEvent =
RefPtr<AccEvent> textRemoveEvent =
new AccTextChangeEvent(mHyperText, mTextOffset, str1, false);
mDocument->FireDelayedEvent(textRemoveEvent);
}

if (strLen2 > 0) {
// Fire text change event for insertion.
nsRefPtr<AccEvent> textInsertEvent =
RefPtr<AccEvent> textInsertEvent =
new AccTextChangeEvent(mHyperText, mTextOffset, str2, true);
mDocument->FireDelayedEvent(textInsertEvent);
}
Expand Down Expand Up @@ -129,7 +129,7 @@ TextUpdater::DoUpdate(const nsAString& aNewText, const nsAString& aOldText,
}

// Compute events based on the difference.
nsTArray<nsRefPtr<AccEvent> > events;
nsTArray<RefPtr<AccEvent> > events;
ComputeTextChangeEvents(str1, str2, entries, events);

delete [] entries;
Expand All @@ -148,7 +148,7 @@ void
TextUpdater::ComputeTextChangeEvents(const nsAString& aStr1,
const nsAString& aStr2,
uint32_t* aEntries,
nsTArray<nsRefPtr<AccEvent> >& aEvents)
nsTArray<RefPtr<AccEvent> >& aEvents)
{
int32_t colIdx = aStr1.Length(), rowIdx = aStr2.Length();

Expand Down
Loading

0 comments on commit 0158360

Please sign in to comment.