Bug 826632. Part 2: Use nsRefPtr<nsViewManager> instead of nsCOMPtr. r=tnikkel

--HG--
rename : view/public/nsIViewManager.h => view/public/nsViewManager.h
extra : rebase_source : 7245e7c988a208471d8c860449ff7b06c29a4a52
This commit is contained in:
Robert O'Callahan 2013-01-05 16:12:42 +13:00
parent 970988bc3c
commit aba980bcb4
12 changed files with 18 additions and 18 deletions

View File

@ -89,7 +89,7 @@ private:
static void StopPanningCallback(nsITimer *timer, void *closure);
nsCOMPtr<nsIWidget> mWidget;
nsCOMPtr<nsViewManager> mViewManager;
nsRefPtr<nsViewManager> mViewManager;
nsCOMPtr<nsITimer> mTimer;
};

View File

@ -12023,7 +12023,7 @@ nsCSSFrameConstructor::RebuildAllStyleData(nsChangeHint aExtraHint)
return;
// Make sure that the viewmanager will outlive the presshell
nsCOMPtr<nsViewManager> vm = mPresShell->GetViewManager();
nsRefPtr<nsViewManager> vm = mPresShell->GetViewManager();
// Processing the style changes could cause a flush that propagates to
// the parent frame and thus destroys the pres shell.

View File

@ -397,7 +397,7 @@ protected:
// so they will be destroyed in the reverse order (pinkerton, scc)
nsCOMPtr<nsIDocument> mDocument;
nsCOMPtr<nsIWidget> mWindow; // may be null
nsCOMPtr<nsViewManager> mViewManager;
nsRefPtr<nsViewManager> mViewManager;
nsRefPtr<nsPresContext> mPresContext;
nsCOMPtr<nsIPresShell> mPresShell;

View File

@ -1857,7 +1857,7 @@ PresShell::ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight)
return NS_ERROR_NOT_AVAILABLE;
}
nsCOMPtr<nsViewManager> viewManagerDeathGrip = mViewManager;
nsRefPtr<nsViewManager> viewManagerDeathGrip = mViewManager;
// Take this ref after viewManager so it'll make sure to go away first
nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
@ -3808,7 +3808,7 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush)
NS_ASSERTION(!isSafeToFlush || mViewManager, "Must have view manager");
// Make sure the view manager stays alive.
nsCOMPtr<nsViewManager> viewManagerDeathGrip = mViewManager;
nsRefPtr<nsViewManager> viewManagerDeathGrip = mViewManager;
if (isSafeToFlush && mViewManager) {
// Processing pending notifications can kill us, and some callers only
// hold weak refs when calling FlushPendingNotifications(). :(
@ -8270,7 +8270,7 @@ PresShell::VerifyIncrementalReflow()
nsIWidget* parentWidget = rootView->GetWidget();
// Create a new view manager.
nsCOMPtr<nsViewManager> vm = do_CreateInstance(kViewManagerCID);
nsRefPtr<nsViewManager> vm = do_CreateInstance(kViewManagerCID);
NS_ENSURE_TRUE(vm, false);
rv = vm->Init(dc);
NS_ENSURE_SUCCESS(rv, false);

View File

@ -951,7 +951,7 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
#endif
mViewManagerFlushIsPending = false;
nsCOMPtr<nsViewManager> vm = mPresContext->GetPresShell()->GetViewManager();
nsRefPtr<nsViewManager> vm = mPresContext->GetPresShell()->GetViewManager();
vm->ProcessPendingUpdates();
#ifdef DEBUG_INVALIDATIONS
printf("Ending ProcessPendingUpdates\n");

View File

@ -46,7 +46,7 @@ public:
nsRefPtr<nsPresContext> mPresContext;
nsCOMPtr<nsIPresShell> mPresShell;
nsCOMPtr<nsViewManager> mViewManager;
nsRefPtr<nsViewManager> mViewManager;
nsCOMPtr<nsIContent> mContent;
PrintObjectType mFrameType;

View File

@ -433,7 +433,7 @@ DumpViewsRecur(nsIDocShell* aDocShell, FILE* out)
{
#ifdef DEBUG
fprintf(out, "docshell=%p \n", static_cast<void*>(aDocShell));
nsCOMPtr<nsViewManager> vm(view_manager(aDocShell));
nsRefPtr<nsViewManager> vm(view_manager(aDocShell));
if (vm) {
nsView* root = vm->GetRootView();
if (root) {
@ -524,7 +524,7 @@ nsLayoutDebuggingTools::DumpReflowStats()
void nsLayoutDebuggingTools::ForceRefresh()
{
nsCOMPtr<nsViewManager> vm(view_manager(mDocShell));
nsRefPtr<nsViewManager> vm(view_manager(mDocShell));
if (!vm)
return;
nsView* root = vm->GetRootView();

View File

@ -2295,7 +2295,7 @@ nsXULMenuCommandEvent::Run()
nsPresContext* presContext = menuFrame->PresContext();
nsCOMPtr<nsIPresShell> shell = presContext->PresShell();
nsCOMPtr<nsViewManager> kungFuDeathGrip = shell->GetViewManager();
nsRefPtr<nsViewManager> kungFuDeathGrip = shell->GetViewManager();
// Deselect ourselves.
if (mCloseMenuMode != CloseMenuMode_None)

View File

@ -276,7 +276,7 @@ public:
AutoDisableRefresh(const AutoDisableRefresh& aOther);
const AutoDisableRefresh& operator=(const AutoDisableRefresh& aOther);
nsCOMPtr<nsViewManager> mRootVM;
nsRefPtr<nsViewManager> mRootVM;
};
private:

View File

@ -953,7 +953,7 @@ nsView::RequestWindowClose(nsIWidget* aWidget)
void
nsView::WillPaintWindow(nsIWidget* aWidget, bool aWillSendDidPaint)
{
nsCOMPtr<nsViewManager> vm = mViewManager;
nsRefPtr<nsViewManager> vm = mViewManager;
vm->WillPaintWindow(aWidget, aWillSendDidPaint);
}
@ -963,7 +963,7 @@ nsView::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion, uint32_t aFlags)
NS_ASSERTION(this == nsView::GetViewFor(aWidget), "wrong view for widget?");
mInAlternatePaint = aFlags & PAINT_IS_ALTERNATE;
nsCOMPtr<nsViewManager> vm = mViewManager;
nsRefPtr<nsViewManager> vm = mViewManager;
bool result = vm->PaintWindow(aWidget, aRegion, aFlags);
// PaintWindow can destroy this via WillPaintWindow notification, so we have
// to re-get the view from the widget.
@ -977,7 +977,7 @@ nsView::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion, uint32_t aFlags)
void
nsView::DidPaintWindow()
{
nsCOMPtr<nsViewManager> vm = mViewManager;
nsRefPtr<nsViewManager> vm = mViewManager;
vm->DidPaintWindow();
}
@ -1006,7 +1006,7 @@ nsView::HandleEvent(nsGUIEvent* aEvent, bool aUseAttachedEvents)
}
if (view) {
nsCOMPtr<nsViewManager> vm = view->GetViewManager();
nsRefPtr<nsViewManager> vm = view->GetViewManager();
vm->DispatchEvent(aEvent, view, &result);
}

View File

@ -269,7 +269,7 @@ GetGtkWindow(nsIDOMDocument *aDocument)
if (!presShell)
return NULL;
nsCOMPtr<nsViewManager> vm = presShell->GetViewManager();
nsRefPtr<nsViewManager> vm = presShell->GetViewManager();
if (!vm)
return NULL;

View File

@ -3144,7 +3144,7 @@ TestApp::GetWidget(nsIWidget** aWidget)
return false;
}
nsCOMPtr<nsViewManager> viewManager = presShell->GetViewManager();
nsRefPtr<nsViewManager> viewManager = presShell->GetViewManager();
if (!viewManager) {
return false;
}