Put the PERF_METRICS timing code back into Viewer: it was removed when the WebShell changes were made a while ago. r=dcone

This commit is contained in:
attinasi%netscape.com 2000-04-28 21:27:20 +00:00
Родитель 345bd451f8
Коммит 0a5f5d3875
3 изменённых файлов: 48 добавлений и 13 удалений

Просмотреть файл

@ -93,6 +93,7 @@ LINCS= \
LLIBS= \
$(DIST)\lib\gkgfxwin.lib \
$(DIST)\lib\timer_s.lib \
$(DIST)\lib\util.lib \
$(DIST)\lib\raptornativewidgets_s.lib \
$(DIST)\lib\raptorbasewidget_s.lib \
$(DIST)\lib\raptorwidget_s.lib \

Просмотреть файл

@ -41,7 +41,8 @@
//*** nsWebBrowserChrome: Object Management
//*****************************************************************************
nsWebBrowserChrome::nsWebBrowserChrome() : mBrowserWindow(nsnull)
nsWebBrowserChrome::nsWebBrowserChrome() : mBrowserWindow(nsnull), mTimerSet(PR_FALSE)
{
NS_INIT_REFCNT();
}
@ -436,25 +437,54 @@ void nsWebBrowserChrome::OnLoadStart(nsIChannel* aChannel)
if(mBrowserWindow->mThrobber)
mBrowserWindow->mThrobber->Start();
nsCOMPtr<nsIURI> uri;
aChannel->GetURI(getter_AddRefs(uri));
if(mBrowserWindow->mStatus)
{
nsXPIDLCString uriString;
if (aChannel) {
uri->GetSpec(getter_Copies(uriString));
nsAutoString url; url.AssignWithConversion(uriString);
url.AppendWithConversion(": start");
PRUint32 size;
mBrowserWindow->mStatus->SetText(url,size);
nsCOMPtr<nsIURI> uri;
aChannel->GetURI(getter_AddRefs(uri));
#ifdef MOZ_PERF_METRICS
if (PR_FALSE == mTimerSet) {
char* url;
nsresult rv = NS_OK;
rv = uri->GetSpec(&url);
if (NS_SUCCEEDED(rv)) {
MOZ_TIMER_LOG(("*** Timing layout processes on url: '%s', WebBrowserChrome: %p\n", url, this));
delete [] url;
}
MOZ_TIMER_DEBUGLOG(("Reset and start: nsWebBrowserChrome::OnLoadStart(), this=%p\n", this));
MOZ_TIMER_RESET(mTotalTime);
MOZ_TIMER_START(mTotalTime);
mTimerSet = PR_TRUE;
}
#endif
if(mBrowserWindow->mStatus)
{
nsXPIDLCString uriString;
uri->GetSpec(getter_Copies(uriString));
nsAutoString url; url.AssignWithConversion(uriString);
url.AppendWithConversion(": start");
PRUint32 size;
mBrowserWindow->mStatus->SetText(url,size);
}
} // if (aChannel)
}
void nsWebBrowserChrome::OnLoadFinished(nsIChannel* aChannel,
PRInt32 aProgressStatusFlags)
{
#ifdef MOZ_PERF_METRICS
if ( (aProgressStatusFlags & nsIWebProgress::flag_win_stop) && mTimerSet ) {
MOZ_TIMER_DEBUGLOG(("Stop: nsWebShell::OnEndDocumentLoad(), this=%p\n", this));
MOZ_TIMER_STOP(mTotalTime);
MOZ_TIMER_LOG(("Total (Layout + Page Load) Time (webBrowserChrome=%p): ", this));
MOZ_TIMER_PRINT(mTotalTime);
mTimerSet = PR_FALSE;
}
#endif
nsXPIDLCString uriString;
if(aChannel)
{

Просмотреть файл

@ -32,6 +32,7 @@
#include "nsIBaseWindow.h"
#include "nsIInterfaceRequestor.h"
#include "nsIWebProgressListener.h"
#include "nsTimer.h"
class nsBrowserWindow;
@ -70,6 +71,9 @@ protected:
protected:
nsBrowserWindow* mBrowserWindow;
PRBool mTimerSet;
MOZ_TIMER_DECLARE(mTotalTime)
};
#endif /* nsWebBrowserChrome_h__ */