diff --git a/content/html/document/src/nsHTMLContentSink.cpp b/content/html/document/src/nsHTMLContentSink.cpp
--- a/content/html/document/src/nsHTMLContentSink.cpp
+++ b/content/html/document/src/nsHTMLContentSink.cpp
@@ -132,6 +132,28 @@
#else
#define SINK_TRACE_NODE(_bit, _msg, _tag, _sp, _obj)
#endif
+
+extern bool noisyClose;
+class sinktimer {
+public:
+ sinktimer(int id) : id(id) {
+ if (noisyClose) {
+ mStart = PR_Now();
+ printf("{%d}`", id);
+ }
+ }
+ ~sinktimer() {
+ if (noisyClose)
+ printf("`{%d}(%d)", id, (unsigned int)(PR_Now() - mStart) / 1000);
+ }
+
+ PRUint32 elapsed() {
+ return (PR_Now() - mStart) / 1000;
+ }
+private:
+ int id;
+ PRTime mStart;
+};
//----------------------------------------------------------------------
@@ -1325,7 +1347,9 @@
nsresult
SinkContext::FlushTags()
{
- mSink->mDeflectedCount = 1000000;
+ mSink->mDeflectedCount = 255;
+
+ sinktimer timer800(800);
mSink->mDeferredFlushTags = PR_FALSE;
PRBool oldBeganUpdate = mSink->mBeganUpdate;
@@ -1358,6 +1382,7 @@
content = mStack[stackPos].mContent;
childCount = content->GetChildCount();
+ sinktimer timer801(801);
if (!flushed && (mStack[stackPos].mNumFlushed < childCount)) {
#ifdef NS_DEBUG
{
@@ -1378,8 +1403,20 @@
NS_ASSERTION(content->GetChildAt(childIndex) == child,
"Flushing the wrong child.");
mSink->NotifyInsert(content, child, childIndex);
+ if (noisyClose && timer801.elapsed() > 2000) {
+ const char *string1, *string2;
+ printf("\n==> %s -- %s\n",
+ (content->Tag()->GetUTF8String(&string1), string1),
+ (content->GetChildAt(childIndex)->Tag()->GetUTF8String(&string2), string2));
+ }
} else {
mSink->NotifyAppend(content, mStack[stackPos].mNumFlushed);
+ if (noisyClose && timer801.elapsed() > 2000) {
+ const char *string;
+ printf("\n==> %s -- %d\n",
+ (content->Tag()->GetUTF8String(&string), string),
+ content->GetChildCount() - mStack[stackPos].mNumFlushed);
+ }
}
flushed = PR_TRUE;
@@ -1796,8 +1833,13 @@
MOZ_TIMER_PRINT(mWatch);
#endif
+ PRTime start = PR_Now();
+ printf("1-");
DidBuildModelImpl();
+ printf("-1(%d)", (unsigned int)(PR_Now() - start) / 1000);
+ start = PR_Now();
+ printf("2-");
// Reflow the last batch of content
if (mBody || mFrameset) {
SINK_TRACE(gSinkLogModuleInfo, SINK_TRACE_REFLOW,
@@ -1823,19 +1865,32 @@
StartLayout(PR_FALSE);
}
}
+ printf("-2(%d)", (unsigned int)(PR_Now() - start) / 1000);
+ start = PR_Now();
+ printf("3-");
ScrollToRef();
+ printf("-3(%d)", (unsigned int)(PR_Now() - start) / 1000);
+ start = PR_Now();
+ printf("4-");
mDocument->ScriptLoader()->RemoveObserver(this);
+ printf("-4(%d)", (unsigned int)(PR_Now() - start) / 1000);
// Make sure we no longer respond to document mutations. We've flushed all
// our notifications out, so there's no need to do anything else here.
// XXXbz I wonder whether we could End() our contexts here too, or something,
// just to make sure we no longer notify...
+ start = PR_Now();
+ printf("5-");
mDocument->RemoveObserver(this);
+ printf("-5(%d)", (unsigned int)(PR_Now() - start) / 1000);
+ start = PR_Now();
+ printf("6-");
mDocument->EndLoad();
+ printf("-6(%d)", (unsigned int)(PR_Now() - start) / 1000);
DropParserAndPerfHint();
@@ -2101,7 +2156,7 @@
eHTMLTag_body,
mCurrentContext->mStackPos - 1,
this);
-
+ printf("About to close body\n");
PRBool didFlush;
nsresult rv = mCurrentContext->FlushTextAndRelease(&didFlush);
if (NS_FAILED(rv)) {
@@ -2114,7 +2169,6 @@
// Flush out anything that's left
SINK_TRACE(gSinkLogModuleInfo, SINK_TRACE_REFLOW,
("HTMLContentSink::CloseBody: layout final body content"));
-
mCurrentContext->FlushTags();
mCurrentContext->CloseContainer(eHTMLTag_body, PR_FALSE);
@@ -3098,7 +3152,7 @@
HTMLContentSink::ProcessSCRIPTEndTag(nsGenericHTMLElement *content,
PRBool aMalformed)
{
- mDeflectedCount = 1000000;
+ mDeflectedCount = 255;
// Flush all tags up front so that we are in as stable state as possible
// when calling DoneAddingChildren. This may not be strictly needed since
diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp
--- a/editor/libeditor/base/nsEditor.cpp
+++ b/editor/libeditor/base/nsEditor.cpp
@@ -157,6 +157,7 @@
, mPhonetic(nsnull)
{
//initialize member variables here
+ printf("{EDITOR}");
}
nsEditor::~nsEditor()
@@ -238,34 +239,75 @@
return NS_OK;
}
+extern bool noisyClose;
+class emotimer {
+public:
+ emotimer(int id, bool noise = false) : id(id) {
+ if (noisyClose) {
+ mStart = PR_Now();
+ printf("{%d}^", id);
+ }
+ }
+ ~emotimer() {
+ if (noisyClose) {
+ printf("^{%d}(%d)", id, (unsigned int)(PR_Now() - mStart) / 1000);
+ }
+ }
+
+ PRUint32 elapsed() {
+ return (PR_Now() - mStart) / 1000;
+ }
+private:
+ int id;
+ PRTime mStart;
+};
+
NS_IMETHODIMP
nsEditor::PostCreate()
{
+ emotimer t799(799);
+
// Set up spellchecking
- nsresult rv = SyncRealTimeSpell();
- NS_ENSURE_SUCCESS(rv, rv);
-
- // Set up listeners
- rv = CreateEventListeners();
- if (NS_FAILED(rv))
- {
- RemoveEventListeners();
-
- return rv;
- }
-
- rv = InstallEventListeners();
- NS_ENSURE_SUCCESS(rv, rv);
-
- // nuke the modification count, so the doc appears unmodified
- // do this before we notify listeners
- ResetModificationCount();
-
- // update the UI with our state
- NotifyDocumentListeners(eDocumentCreated);
- NotifyDocumentListeners(eDocumentStateChanged);
-
+ nsresult rv;
+ {
+ emotimer t700(700);
+ rv = SyncRealTimeSpell();
+ NS_ENSURE_SUCCESS(rv, rv);
+ }
+
+ {
+ emotimer t701(701);
+ // Set up listeners
+ rv = CreateEventListeners();
+ if (NS_FAILED(rv))
+ {
+ RemoveEventListeners();
+
+ return rv;
+ }
+ }
+
+ {
+ emotimer t702(702);
+ rv = InstallEventListeners();
+ NS_ENSURE_SUCCESS(rv, rv);
+ }
+
+ {
+ emotimer t703(703);
+ // nuke the modification count, so the doc appears unmodified
+ // do this before we notify listeners
+ ResetModificationCount();
+ }
+
+ {
+ emotimer t704(704);
+ // update the UI with our state
+ NotifyDocumentListeners(eDocumentCreated);
+ NotifyDocumentListeners(eDocumentStateChanged);
+ }
+
return NS_OK;
}
diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -123,6 +123,9 @@
#include "nsStyleUtil.h"
#include "nsIFocusEventSuppressor.h"
#include "nsBox.h"
+#include "nsIDOMHTMLTextAreaElement.h"
+#include "nsIProcess.h"
+#include "nsILocalFile.h"
#ifdef MOZ_XUL
#include "nsIRootBox.h"
@@ -2214,6 +2217,54 @@
aState.mAdditionalStateBits = savedStateBits;
}
+void
+opControl(PRBool start)
+{
+ nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1");
+ file->InitWithPath(NS_LITERAL_STRING("/bin/sh"));
+
+ nsCOMPtr proc = do_CreateInstance("@mozilla.org/process/util;1");
+ proc->Init(file);
+
+ const char **args;
+ const char* startArgs[] = {"/usr/bin/opcontrol", "--start", 0};
+ const char* endArgs[] = {"/usr/bin/opcontrol", "--stop", 0};
+
+ if (start)
+ args = startArgs;
+ else
+ args = endArgs;
+
+ PRUint32 rv;
+ proc->Run(PR_TRUE, args, 2, &rv);
+}
+
+static int staticTimeIt = 0;
+
+extern bool noisyClose;
+class csstimer {
+public:
+ csstimer(int id, const char* name) : id(id), name(name) {
+ if (noisyClose) {
+ mStart = PR_Now();
+ printf("{%d %s}.", id, name);
+ }
+ }
+ ~csstimer() {
+ if (noisyClose) {
+ printf(".{%d %s}(%d)", id, name, (unsigned int)(PR_Now() - mStart) / 1000);
+ }
+ }
+
+ PRUint32 elapsed() {
+ return (PR_Now() - mStart) / 1000;
+ }
+private:
+ int id;
+ const char* name;
+ PRTime mStart;
+};
+
nsresult
nsCSSFrameConstructor::CreateInputFrame(nsFrameConstructorState& aState,
nsIContent* aContent,
@@ -5322,6 +5373,15 @@
return NS_OK;
}
+ const char* tname;
+ csstimer timer388(388, (aContent->Tag()->GetUTF8String(&tname), tname));
+ //if (aTag == nsGkAtoms::textarea) {
+ // nsAutoString text;
+ // nsCOMPtr elem = do_QueryInterface(aContent);
+ // elem->GetDefaultValue(text);
+ // printf("text:%d\n%s\n", text.Length(), NS_ConvertUTF16toUTF8(text).get());
+ //}
+
PRBool frameHasBeenInitialized = PR_FALSE;
nsIFrame* newFrame = nsnull; // the frame we construct
PRBool addToHashTable = PR_TRUE;
@@ -5601,6 +5661,7 @@
PR_FALSE, childItems);
// Set the frame's initial child list
+ csstimer timer908(908, "908");
if (childItems.childList) {
newFrame->SetInitialChildList(nsnull, childItems.childList);
}
diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -4672,6 +4672,28 @@
}
}
+extern bool noisyClose;
+class shelltimer {
+public:
+ shelltimer(int id) : id(id) {
+ if (noisyClose) {
+ mStart = PR_Now();
+ printf("{%d}-", id);
+ }
+ }
+ ~shelltimer() {
+ if (noisyClose)
+ printf("-{%d}(%d)", id, (unsigned int)(PR_Now() - mStart) / 1000);
+ }
+
+ PRUint32 elapsed() {
+ return (PR_Now() - mStart) / 1000;
+ }
+private:
+ int id;
+ PRTime mStart;
+};
+
void
PresShell::ContentAppended(nsIDocument *aDocument,
nsIContent* aContainer,
@@ -4680,6 +4702,8 @@
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentAppended");
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
NS_PRECONDITION(aContainer, "must have container");
+
+ shelltimer timer205(205);
if (!mDidInitialReflow) {
return;
@@ -4692,9 +4716,14 @@
// Call this here so it only happens for real content mutations and
// not cases when the frame constructor calls its own methods to force
// frame reconstruction.
- mFrameConstructor->RestyleForAppend(aContainer, aNewIndexInContainer);
-
- mFrameConstructor->ContentAppended(aContainer, aNewIndexInContainer);
+ {
+ shelltimer timer206(206);
+ mFrameConstructor->RestyleForAppend(aContainer, aNewIndexInContainer);
+ }
+ {
+ shelltimer timer207(207);
+ mFrameConstructor->ContentAppended(aContainer, aNewIndexInContainer);
+ }
VERIFY_STYLE_TREE;
MOZ_TIMER_DEBUGLOG(("Stop: Frame Creation: PresShell::ContentAppended(), this=%p\n", this));
@@ -6266,6 +6295,7 @@
void
PresShell::DoReflow(nsIFrame* target)
{
+ shelltimer timer255(255);
nsIFrame* rootFrame = FrameManager()->GetRootFrame();
nsCOMPtr rcx;
@@ -6386,6 +6416,7 @@
nsresult
PresShell::ProcessReflowCommands(PRBool aInterruptible)
{
+ shelltimer timer250(250);
MOZ_TIMER_DEBUGLOG(("Start: Reflow: PresShell::ProcessReflowCommands(), this=%p\n", this));
MOZ_TIMER_START(mReflowWatch);
diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -188,6 +188,34 @@
return PR_FALSE;
}
+
+extern bool noisyClose;
+class tctimer {
+public:
+ tctimer(int id, bool noise = false) : id(id) {
+ oldNoisyClose = noisyClose;
+ if (noisyClose) {
+ mStart = PR_Now();
+ printf("{%d}$", id);
+ noisyClose = noise;
+ }
+ }
+ ~tctimer() {
+ noisyClose = oldNoisyClose;
+ if (noisyClose) {
+ printf("${%d}(%d)", id, (unsigned int)(PR_Now() - mStart) / 1000);
+ }
+ }
+
+ PRUint32 elapsed() {
+ return (PR_Now() - mStart) / 1000;
+ }
+private:
+ int id;
+ PRTime mStart;
+ bool oldNoisyClose;
+};
+
class nsTextInputListener : public nsISelectionListener,
public nsIDOMFocusListener,
@@ -1412,6 +1440,7 @@
void
nsTextControlFrame::PostCreateFrames()
{
+ tctimer timer510(510);
InitEditor();
// Notify the text listener we have focus and setup the caret etc (bug 446663).
if (IsFocusedContent(PresContext(), GetContent())) {
@@ -1423,6 +1452,7 @@
nsIFrame*
nsTextControlFrame::CreateFrameFor(nsIContent* aContent)
{
+ tctimer timer502(502);
#ifdef DEBUG
NS_ASSERTION(!mCreateFrameForCalled, "CreateFrameFor called more than once!");
mCreateFrameForCalled = PR_TRUE;
@@ -1617,6 +1647,7 @@
nsresult
nsTextControlFrame::InitEditor()
{
+ tctimer timer500(500);
// This method must be called during/after the text
// control frame's initial reflow to avoid any unintened
// forced reflows that might result when the editor
@@ -2808,8 +2839,10 @@
nsIFrame* aChildList)
{
nsresult rv = nsBoxFrame::SetInitialChildList(aListName, aChildList);
- if (mEditor)
+ if (mEditor) {
+ tctimer timer520(520, true);
mEditor->PostCreate();
+ }
//look for scroll view below this frame go along first child list
nsIFrame* first = GetFirstChild(nsnull);
diff --git a/parser/htmlparser/src/CNavDTD.cpp b/parser/htmlparser/src/CNavDTD.cpp
--- a/parser/htmlparser/src/CNavDTD.cpp
+++ b/parser/htmlparser/src/CNavDTD.cpp
@@ -1,5 +1,6 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=2 et tw=78: */
+bool noisyClose;
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -120,6 +121,26 @@
NS_IMPL_CYCLE_COLLECTING_RELEASE(CNavDTD)
NS_IMPL_CYCLE_COLLECTION_1(CNavDTD, mSink)
+
+class timer {
+public:
+ timer(int id, const PRUnichar *name) : id(id), mName(name) {
+ if (noisyClose) {
+ // mStart = PR_Now();
+ // printf("{%d}%s-", id, NS_ConvertUTF16toUTF8(nsDependentString(mName)).get());
+ }
+ }
+ ~timer() {
+ if (noisyClose) {
+ // printf("-{%d}%s(%d)", id, NS_ConvertUTF16toUTF8(nsDependentString(mName)).get(), (unsigned int)(PR_Now() - mStart) / 1000);
+ }
+ }
+private:
+ int id;
+ const PRUnichar *mName;
+ PRTime mStart;
+};
+
CNavDTD::CNavDTD()
: mMisplacedContent(0),
@@ -383,6 +404,9 @@
nsIParser* aParser,
nsIContentSink* aSink)
{
+ PRTime start = PR_Now();
+ printf("{");
+
if (!aSink) {
return NS_OK;
}
@@ -404,7 +428,6 @@
// Keep track of the top index.
PRInt32 topIndex = mBodyContext->mContextTopIndex;
-
// Loop until we've really consumed all of our misplaced content.
do {
mFlags &= ~NS_DTD_FLAG_MISPLACED_CONTENT;
@@ -430,14 +453,23 @@
// Now let's disable style handling to save time when closing remaining
// stack members.
mFlags &= ~NS_DTD_FLAG_ENABLE_RESIDUAL_STYLE;
+#if 1
while (mBodyContext->GetCount() > 0) {
+ //noisyClose = true;
result = CloseContainersTo(mBodyContext->Last(), PR_FALSE);
+ noisyClose = false;
if (NS_FAILED(result)) {
//No matter what, you need to call did build model.
aSink->DidBuildModel();
return result;
}
}
+#else
+ result = CloseContainersTo(eHTMLTag_body, PR_FALSE);
+ if (NS_FAILED(result)) {
+ printf("BLAAAH %x", result);
+ }
+#endif
} else {
// If you're here, then an error occured, but we still have nodes on the stack.
// At a minimum, we should grab the nodes and recycle them.
@@ -458,8 +490,15 @@
}
}
+ printf("}(%d)", (unsigned int)(PR_Now() - start) / 1000);
+
+ start = PR_Now();
+ printf("[");
// No matter what, you need to call did build model.
- return aSink->DidBuildModel();
+ nsresult rv = aSink->DidBuildModel();
+ printf("](%d)", (unsigned int)(PR_Now() - start) / 1000);
+
+ return rv;
}
NS_IMETHODIMP_(void)
@@ -2839,11 +2878,13 @@
NS_PRECONDITION(mBodyContext->GetCount() > 0, kInvalidTagStackPos);
nsresult result = NS_OK;
+ timer t10(10, nsHTMLTags::GetStringValue(aTarget));
if (anIndex < mBodyContext->GetCount() && anIndex >= 0) {
PRInt32 count = 0;
while ((count = mBodyContext->GetCount()) > anIndex) {
nsEntryStack* theChildStyleStack = 0;
eHTMLTags theTag = mBodyContext->Last();
+ timer t9(9, nsHTMLTags::GetStringValue(theTag));
nsCParserNode* theNode = mBodyContext->Pop(theChildStyleStack);
result = CloseContainer(theTag, PR_FALSE);
@@ -2986,9 +3027,9 @@
NS_PRECONDITION(mBodyContext->GetCount() > 0, kInvalidTagStackPos);
PRInt32 pos = mBodyContext->LastOf(aTag);
-
if (kNotFound != pos) {
// The tag is indeed open, so close it.
+ timer t1(1, nsHTMLTags::GetStringValue(aTag));
return CloseContainersTo(pos, aTag, aClosedByStartTag);
}