mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
Fix for 800K leaks on tinderbox. Fix for broken printing. Both bugs r=danm, sr=hewitt
This commit is contained in:
parent
1b3bd5631d
commit
5fd5b52098
@ -2648,21 +2648,26 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
|
||||
}
|
||||
}
|
||||
|
||||
mPaintingSuppressed = PR_TRUE;
|
||||
// Kick off a one-shot timer based off our pref value. When this timer
|
||||
// fires, if painting is still locked down, then we will go ahead and
|
||||
// trigger a full invalidate and allow painting to proceed normally.
|
||||
mPaintSuppressionTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
if (!mPaintSuppressionTimer)
|
||||
// Uh-oh. We must be out of memory. No point in keeping painting locked down.
|
||||
mPaintingSuppressed = PR_FALSE;
|
||||
else {
|
||||
// Initialize the timer.
|
||||
PRInt32 delay = PAINTLOCK_EVENT_DELAY; // Use this value if we fail to get the pref value.
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));
|
||||
if (prefs)
|
||||
prefs->GetIntPref("nglayout.initialpaint.delay", &delay);
|
||||
mPaintSuppressionTimer->Init(sPaintSuppressionCallback, this, delay, NS_PRIORITY_HIGHEST);
|
||||
// For printing, we just immediately unsuppress.
|
||||
PRBool isPaginated = PR_FALSE;
|
||||
mPresContext->IsPaginated(&isPaginated);
|
||||
if (!isPaginated) {
|
||||
// Kick off a one-shot timer based off our pref value. When this timer
|
||||
// fires, if painting is still locked down, then we will go ahead and
|
||||
// trigger a full invalidate and allow painting to proceed normally.
|
||||
mPaintingSuppressed = PR_TRUE;
|
||||
mPaintSuppressionTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
if (!mPaintSuppressionTimer)
|
||||
// Uh-oh. We must be out of memory. No point in keeping painting locked down.
|
||||
mPaintingSuppressed = PR_FALSE;
|
||||
else {
|
||||
// Initialize the timer.
|
||||
PRInt32 delay = PAINTLOCK_EVENT_DELAY; // Use this value if we fail to get the pref value.
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));
|
||||
if (prefs)
|
||||
prefs->GetIntPref("nglayout.initialpaint.delay", &delay);
|
||||
mPaintSuppressionTimer->Init(sPaintSuppressionCallback, this, delay, NS_PRIORITY_HIGHEST);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK; //XXX this needs to be real. MMP
|
||||
|
@ -2648,21 +2648,26 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
|
||||
}
|
||||
}
|
||||
|
||||
mPaintingSuppressed = PR_TRUE;
|
||||
// Kick off a one-shot timer based off our pref value. When this timer
|
||||
// fires, if painting is still locked down, then we will go ahead and
|
||||
// trigger a full invalidate and allow painting to proceed normally.
|
||||
mPaintSuppressionTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
if (!mPaintSuppressionTimer)
|
||||
// Uh-oh. We must be out of memory. No point in keeping painting locked down.
|
||||
mPaintingSuppressed = PR_FALSE;
|
||||
else {
|
||||
// Initialize the timer.
|
||||
PRInt32 delay = PAINTLOCK_EVENT_DELAY; // Use this value if we fail to get the pref value.
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));
|
||||
if (prefs)
|
||||
prefs->GetIntPref("nglayout.initialpaint.delay", &delay);
|
||||
mPaintSuppressionTimer->Init(sPaintSuppressionCallback, this, delay, NS_PRIORITY_HIGHEST);
|
||||
// For printing, we just immediately unsuppress.
|
||||
PRBool isPaginated = PR_FALSE;
|
||||
mPresContext->IsPaginated(&isPaginated);
|
||||
if (!isPaginated) {
|
||||
// Kick off a one-shot timer based off our pref value. When this timer
|
||||
// fires, if painting is still locked down, then we will go ahead and
|
||||
// trigger a full invalidate and allow painting to proceed normally.
|
||||
mPaintingSuppressed = PR_TRUE;
|
||||
mPaintSuppressionTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
if (!mPaintSuppressionTimer)
|
||||
// Uh-oh. We must be out of memory. No point in keeping painting locked down.
|
||||
mPaintingSuppressed = PR_FALSE;
|
||||
else {
|
||||
// Initialize the timer.
|
||||
PRInt32 delay = PAINTLOCK_EVENT_DELAY; // Use this value if we fail to get the pref value.
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));
|
||||
if (prefs)
|
||||
prefs->GetIntPref("nglayout.initialpaint.delay", &delay);
|
||||
mPaintSuppressionTimer->Init(sPaintSuppressionCallback, this, delay, NS_PRIORITY_HIGHEST);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK; //XXX this needs to be real. MMP
|
||||
|
@ -296,16 +296,9 @@ nsOutlinerBodyFrame::Destroy(nsIPresContext* aPresContext)
|
||||
delete mColumns;
|
||||
mColumns = nsnull;
|
||||
|
||||
// Drop our ref to the view.
|
||||
if (mView)
|
||||
mView->SetOutliner(nsnull);
|
||||
|
||||
// Save off our info into the box object.
|
||||
if (mOutlinerBoxObject) {
|
||||
nsCOMPtr<nsIBoxObject> box(do_QueryInterface(mOutlinerBoxObject));
|
||||
nsAutoString view; view.AssignWithConversion("view");
|
||||
box->SetPropertyAsSupports(view.GetUnicode(), mView);
|
||||
|
||||
if (mTopRowIndex > 0) {
|
||||
nsAutoString topRowStr; topRowStr.AssignWithConversion("topRow");
|
||||
nsAutoString topRow;
|
||||
@ -363,8 +356,8 @@ NS_IMETHODIMP nsOutlinerBodyFrame::Reflow(nsIPresContext* aPresContext,
|
||||
// Scroll to the given row.
|
||||
ScrollToRow(rowIndex);
|
||||
|
||||
// Clear out the property info.
|
||||
box->RemoveProperty(view.GetUnicode());
|
||||
// Clear out the property info for the top row, but we always keep the
|
||||
// view current.
|
||||
box->RemoveProperty(topRow.GetUnicode());
|
||||
|
||||
return nsLeafBoxFrame::Reflow(aPresContext, aReflowMetrics, aReflowState, aStatus);
|
||||
@ -422,9 +415,13 @@ NS_IMETHODIMP nsOutlinerBodyFrame::GetView(nsIOutlinerView * *aView)
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::SetView(nsIOutlinerView * aView)
|
||||
{
|
||||
// First clear out the old view.
|
||||
nsCOMPtr<nsIBoxObject> box(do_QueryInterface(mOutlinerBoxObject));
|
||||
nsAutoString view; view.AssignWithConversion("view");
|
||||
|
||||
if (mView) {
|
||||
mView->SetOutliner(nsnull);
|
||||
mView = nsnull;
|
||||
box->RemoveProperty(view.GetUnicode());
|
||||
|
||||
// Only reset the top row index and delete the columns if we had an old non-null view.
|
||||
mTopRowIndex = 0;
|
||||
@ -442,7 +439,9 @@ NS_IMETHODIMP nsOutlinerBodyFrame::SetView(nsIOutlinerView * aView)
|
||||
if (mView) {
|
||||
// View, meet the outliner.
|
||||
mView->SetOutliner(mOutlinerBoxObject);
|
||||
|
||||
|
||||
box->SetPropertyAsSupports(view.GetUnicode(), mView);
|
||||
|
||||
// Give the view a new empty selection object to play with, but only if it
|
||||
// doesn't have one already.
|
||||
nsCOMPtr<nsIOutlinerSelection> sel;
|
||||
|
@ -59,6 +59,17 @@ nsOutlinerBoxObject::SetDocument(nsIDocument* aDocument)
|
||||
// this should only be called with a null document, which indicates
|
||||
// that we're being torn down.
|
||||
NS_ASSERTION(aDocument == nsnull, "SetDocument called with non-null document");
|
||||
|
||||
// Drop the view's ref to us.
|
||||
nsAutoString view; view.AssignWithConversion("view");
|
||||
nsCOMPtr<nsISupports> suppView;
|
||||
GetPropertyAsSupports(view.GetUnicode(), getter_AddRefs(suppView));
|
||||
nsCOMPtr<nsIOutlinerView> outlinerView(do_QueryInterface(suppView));
|
||||
if (outlinerView)
|
||||
outlinerView->SetOutliner(nsnull); // Break the circular ref between the view and us.
|
||||
|
||||
mOutlinerBody = nsnull;
|
||||
|
||||
return nsBoxObject::SetDocument(aDocument);
|
||||
}
|
||||
|
||||
|
@ -296,16 +296,9 @@ nsOutlinerBodyFrame::Destroy(nsIPresContext* aPresContext)
|
||||
delete mColumns;
|
||||
mColumns = nsnull;
|
||||
|
||||
// Drop our ref to the view.
|
||||
if (mView)
|
||||
mView->SetOutliner(nsnull);
|
||||
|
||||
// Save off our info into the box object.
|
||||
if (mOutlinerBoxObject) {
|
||||
nsCOMPtr<nsIBoxObject> box(do_QueryInterface(mOutlinerBoxObject));
|
||||
nsAutoString view; view.AssignWithConversion("view");
|
||||
box->SetPropertyAsSupports(view.GetUnicode(), mView);
|
||||
|
||||
if (mTopRowIndex > 0) {
|
||||
nsAutoString topRowStr; topRowStr.AssignWithConversion("topRow");
|
||||
nsAutoString topRow;
|
||||
@ -363,8 +356,8 @@ NS_IMETHODIMP nsOutlinerBodyFrame::Reflow(nsIPresContext* aPresContext,
|
||||
// Scroll to the given row.
|
||||
ScrollToRow(rowIndex);
|
||||
|
||||
// Clear out the property info.
|
||||
box->RemoveProperty(view.GetUnicode());
|
||||
// Clear out the property info for the top row, but we always keep the
|
||||
// view current.
|
||||
box->RemoveProperty(topRow.GetUnicode());
|
||||
|
||||
return nsLeafBoxFrame::Reflow(aPresContext, aReflowMetrics, aReflowState, aStatus);
|
||||
@ -422,9 +415,13 @@ NS_IMETHODIMP nsOutlinerBodyFrame::GetView(nsIOutlinerView * *aView)
|
||||
NS_IMETHODIMP nsOutlinerBodyFrame::SetView(nsIOutlinerView * aView)
|
||||
{
|
||||
// First clear out the old view.
|
||||
nsCOMPtr<nsIBoxObject> box(do_QueryInterface(mOutlinerBoxObject));
|
||||
nsAutoString view; view.AssignWithConversion("view");
|
||||
|
||||
if (mView) {
|
||||
mView->SetOutliner(nsnull);
|
||||
mView = nsnull;
|
||||
box->RemoveProperty(view.GetUnicode());
|
||||
|
||||
// Only reset the top row index and delete the columns if we had an old non-null view.
|
||||
mTopRowIndex = 0;
|
||||
@ -442,7 +439,9 @@ NS_IMETHODIMP nsOutlinerBodyFrame::SetView(nsIOutlinerView * aView)
|
||||
if (mView) {
|
||||
// View, meet the outliner.
|
||||
mView->SetOutliner(mOutlinerBoxObject);
|
||||
|
||||
|
||||
box->SetPropertyAsSupports(view.GetUnicode(), mView);
|
||||
|
||||
// Give the view a new empty selection object to play with, but only if it
|
||||
// doesn't have one already.
|
||||
nsCOMPtr<nsIOutlinerSelection> sel;
|
||||
|
@ -59,6 +59,17 @@ nsOutlinerBoxObject::SetDocument(nsIDocument* aDocument)
|
||||
// this should only be called with a null document, which indicates
|
||||
// that we're being torn down.
|
||||
NS_ASSERTION(aDocument == nsnull, "SetDocument called with non-null document");
|
||||
|
||||
// Drop the view's ref to us.
|
||||
nsAutoString view; view.AssignWithConversion("view");
|
||||
nsCOMPtr<nsISupports> suppView;
|
||||
GetPropertyAsSupports(view.GetUnicode(), getter_AddRefs(suppView));
|
||||
nsCOMPtr<nsIOutlinerView> outlinerView(do_QueryInterface(suppView));
|
||||
if (outlinerView)
|
||||
outlinerView->SetOutliner(nsnull); // Break the circular ref between the view and us.
|
||||
|
||||
mOutlinerBody = nsnull;
|
||||
|
||||
return nsBoxObject::SetDocument(aDocument);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user