зеркало из https://github.com/mozilla/gecko-dev.git
Bug 560647 - add startup timeline instrumentation; r=vlad
This commit is contained in:
Родитель
dea11722d4
Коммит
db9d404619
|
@ -110,6 +110,8 @@
|
|||
#include "nsXFormsWidgetsAccessible.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessibilityService
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -119,6 +121,8 @@ PRBool nsAccessibilityService::gIsShutdown = PR_TRUE;
|
|||
|
||||
nsAccessibilityService::nsAccessibilityService()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
// Add observers.
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
|
|
|
@ -40,6 +40,9 @@
|
|||
/**
|
||||
* This is the enum used by nsIDocument::FlushPendingNotifications to
|
||||
* decide what to flush.
|
||||
*
|
||||
* Please note that if you change these values, you should sync it with the
|
||||
* flushTypeNames array inside PresShell::FlushPendingNotifications.
|
||||
*/
|
||||
enum mozFlushType {
|
||||
Flush_Content = 1, /* flush the content model construction */
|
||||
|
|
|
@ -76,6 +76,8 @@
|
|||
#include "nsIChannelPolicy.h"
|
||||
#include "nsChannelPolicy.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
static PRLogModuleInfo* gCspPRLog;
|
||||
#endif
|
||||
|
@ -656,6 +658,8 @@ nsScriptLoader::ProcessRequest(nsScriptLoadRequest* aRequest)
|
|||
nsAFlatString* script;
|
||||
nsAutoString textData;
|
||||
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
// If there's no script text, we try to get it from the element
|
||||
if (aRequest->mIsInline) {
|
||||
// XXX This is inefficient - GetText makes multiple
|
||||
|
|
|
@ -208,6 +208,8 @@
|
|||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsXPCOMCID.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
#ifdef MOZ_LOGGING
|
||||
// so we can get logging even in release builds
|
||||
#define FORCE_PR_LOG 1
|
||||
|
@ -8385,6 +8387,8 @@ nsGlobalWindow::RunTimeout(nsTimeout *aTimeout)
|
|||
return;
|
||||
}
|
||||
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
NS_ASSERTION(IsInnerWindow(), "Timeout running on outer window!");
|
||||
NS_ASSERTION(!IsFrozen(), "Timeout running on a window in the bfcache!");
|
||||
|
||||
|
@ -8539,6 +8543,8 @@ nsGlobalWindow::RunTimeout(nsTimeout *aTimeout)
|
|||
PRUint32 lineNo = 0;
|
||||
handler->GetLocation(&filename, &lineNo);
|
||||
|
||||
NS_TIME_FUNCTION_MARK("(file: %s, line: %d)", filename, lineNo);
|
||||
|
||||
PRBool is_undefined;
|
||||
scx->EvaluateString(nsDependentString(script),
|
||||
GetScriptGlobal(handler->GetScriptTypeID()),
|
||||
|
|
|
@ -117,6 +117,8 @@
|
|||
#include "prlog.h"
|
||||
#include "prthread.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
const size_t gStackSize = 8192;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
|
@ -1508,6 +1510,9 @@ nsJSContext::EvaluateStringWithValue(const nsAString& aScript,
|
|||
void* aRetValue,
|
||||
PRBool* aIsUndefined)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN_FMT(1.0, "%s (line %d) (url: %s, line: %d)", MOZ_FUNCTION_NAME,
|
||||
__LINE__, aURL, aLineNo);
|
||||
|
||||
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
if (!mScriptsEnabled) {
|
||||
|
@ -1686,6 +1691,9 @@ nsJSContext::EvaluateString(const nsAString& aScript,
|
|||
nsAString *aRetValue,
|
||||
PRBool* aIsUndefined)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN_FMT(1.0, "%s (line %d) (url: %s, line: %d)", MOZ_FUNCTION_NAME,
|
||||
__LINE__, aURL, aLineNo);
|
||||
|
||||
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
if (!mScriptsEnabled) {
|
||||
|
@ -2011,6 +2019,9 @@ nsJSContext::CompileEventHandler(nsIAtom *aName,
|
|||
PRUint32 aVersion,
|
||||
nsScriptObjectHolder &aHandler)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN_FMT(1.0, "%s (line %d) (url: %s, line: %d)", MOZ_FUNCTION_NAME,
|
||||
__LINE__, aURL, aLineNo);
|
||||
|
||||
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
NS_PRECONDITION(AtomIsEventHandlerName(aName), "Bad event name");
|
||||
|
@ -2074,6 +2085,9 @@ nsJSContext::CompileFunction(void* aTarget,
|
|||
PRBool aShared,
|
||||
void** aFunctionObject)
|
||||
{
|
||||
NS_TIME_FUNCTION_FMT(1.0, "%s (line %d) (function: %s, url: %s, line: %d)", MOZ_FUNCTION_NAME,
|
||||
__LINE__, aName.BeginReading(), aURL, aLineNo);
|
||||
|
||||
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
// Don't compile if aVersion is unknown. Since the caller is responsible for
|
||||
|
@ -2131,6 +2145,9 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, void *aScope, void *aHandler
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_TIME_FUNCTION_FMT(1.0, "%s (line %d) (function: %s)", MOZ_FUNCTION_NAME,
|
||||
__LINE__, JS_GetFunctionName(static_cast<JSFunction *>(JS_GetPrivate(mContext, static_cast<JSObject *>(aHandler)))));
|
||||
|
||||
JSObject* target = nsnull;
|
||||
nsresult rv = JSObjectFromInterface(aTarget, aScope, &target);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -2362,6 +2379,8 @@ nsJSContext::Deserialize(nsIObjectInputStream* aStream,
|
|||
JSObject *result = nsnull;
|
||||
nsresult rv;
|
||||
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
NS_TIMELINE_MARK_FUNCTION("js script deserialize");
|
||||
|
||||
PRUint32 size;
|
||||
|
@ -3547,6 +3566,8 @@ nsJSContext::ScriptExecuted()
|
|||
void
|
||||
nsJSContext::CC()
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
++sCCollectCount;
|
||||
#ifdef DEBUG_smaug
|
||||
printf("Will run cycle collector (%i), %lldms since previous.\n",
|
||||
|
|
|
@ -111,6 +111,8 @@
|
|||
|
||||
#include "nsITransferable.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
#define NS_ERROR_EDITOR_NO_SELECTION NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_EDITOR,1)
|
||||
#define NS_ERROR_EDITOR_NO_TEXTNODE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_EDITOR,2)
|
||||
|
||||
|
@ -1273,6 +1275,8 @@ NS_IMETHODIMP nsEditor::GetInlineSpellChecker(PRBool autoCreate,
|
|||
|
||||
NS_IMETHODIMP nsEditor::SyncRealTimeSpell()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
PRBool enable = GetDesiredSpellCheckState();
|
||||
|
||||
nsCOMPtr<nsIInlineSpellChecker> spellChecker;
|
||||
|
|
|
@ -84,6 +84,8 @@
|
|||
#include "nsITransferable.h"
|
||||
#include "nsCopySupport.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
// prototype for rules creation shortcut
|
||||
nsresult NS_NewTextEditRules(nsIEditRules** aInstancePtrResult);
|
||||
|
||||
|
@ -143,6 +145,8 @@ NS_INTERFACE_MAP_END_INHERITING(nsEditor)
|
|||
NS_IMETHODIMP nsPlaintextEditor::Init(nsIDOMDocument *aDoc,
|
||||
nsIPresShell *aPresShell, nsIContent *aRoot, nsISelectionController *aSelCon, PRUint32 aFlags)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
NS_PRECONDITION(aDoc && aPresShell, "bad arg");
|
||||
if (!aDoc || !aPresShell)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsAppStartupNotifier.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsAppStartupNotifier, nsIObserver)
|
||||
|
||||
nsAppStartupNotifier::nsAppStartupNotifier()
|
||||
|
@ -57,6 +59,8 @@ nsAppStartupNotifier::~nsAppStartupNotifier()
|
|||
|
||||
NS_IMETHODIMP nsAppStartupNotifier::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
NS_ENSURE_ARG(aTopic);
|
||||
nsresult rv;
|
||||
|
||||
|
@ -70,6 +74,8 @@ NS_IMETHODIMP nsAppStartupNotifier::Observe(nsISupports *aSubject, const char *a
|
|||
getter_AddRefs(enumerator));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_TIME_FUNCTION_MARK("EnumerateCategory");
|
||||
|
||||
nsCOMPtr<nsISupports> entry;
|
||||
while (NS_SUCCEEDED(enumerator->GetNext(getter_AddRefs(entry)))) {
|
||||
nsCOMPtr<nsISupportsCString> category = do_QueryInterface(entry, &rv);
|
||||
|
@ -113,6 +119,9 @@ NS_IMETHODIMP nsAppStartupNotifier::Observe(nsISupports *aSubject, const char *a
|
|||
NS_WARNING(warnStr.get());
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_TIME_FUNCTION_MARK("observer: category: %s cid: %s", categoryEntry.get(), nsPromiseFlatCString(contractId).get());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include "gfxFont.h"
|
||||
#include "gfxPlatform.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
// gfxPlatformFontList is an abstract class for the global font list on the system;
|
||||
// concrete subclasses for each platform implement the actual interface to the system fonts.
|
||||
// This class exists because we cannot rely on the platform font-finding APIs to behave
|
||||
|
@ -62,6 +64,8 @@ public:
|
|||
}
|
||||
|
||||
static nsresult Init() {
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
NS_ASSERTION(!sPlatformFontList, "What's this doing here?");
|
||||
sPlatformFontList = gfxPlatform::GetPlatform()->CreatePlatformFontList();
|
||||
if (!sPlatformFontList) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
|
@ -87,6 +87,8 @@
|
|||
#include "jsdbgapi.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
static const char kJSRuntimeServiceContractID[] = "@mozilla.org/js/xpc/RuntimeService;1";
|
||||
static const char kXPConnectServiceContractID[] = "@mozilla.org/js/xpc/XPConnect;1";
|
||||
static const char kObserverServiceContractID[] = "@mozilla.org/observer-service;1";
|
||||
|
@ -579,6 +581,8 @@ NS_IMPL_ISUPPORTS3(mozJSComponentLoader,
|
|||
nsresult
|
||||
mozJSComponentLoader::ReallyInit()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
/*
|
||||
|
@ -676,6 +680,13 @@ mozJSComponentLoader::LoadModule(nsILocalFile* aComponentFile,
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
nsAutoString path__(NS_LITERAL_STRING("N/A"));
|
||||
aComponentFile->GetPath(path__);
|
||||
NS_TIME_FUNCTION_FMT("%s (line %d) (file: %s)", MOZ_FUNCTION_NAME,
|
||||
__LINE__, nsPromiseFlatCString(NS_LossyConvertUTF16toASCII(path__)).BeginReading());
|
||||
#endif
|
||||
|
||||
nsCAutoString leafName;
|
||||
aComponentFile->GetNativeLeafName(leafName);
|
||||
if (!StringTail(leafName, 3).LowerCaseEqualsLiteral(".js"))
|
||||
|
@ -1429,6 +1440,9 @@ mozJSComponentLoader::Import(const nsACString & registryLocation)
|
|||
// This function should only be called from JS.
|
||||
nsresult rv;
|
||||
|
||||
NS_TIME_FUNCTION_FMT("%s (line %d) (file: %s)", MOZ_FUNCTION_NAME,
|
||||
__LINE__, registryLocation.BeginReading());
|
||||
|
||||
nsCOMPtr<nsIXPConnect> xpc =
|
||||
do_GetService(kXPConnectServiceContractID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -60,6 +60,8 @@
|
|||
#include "jsapi.h"
|
||||
#include "jsdbgapi.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
/* load() error msgs, XXX localize? */
|
||||
#define LOAD_ERROR_NOSERVICE "Error creating IO Service."
|
||||
#define LOAD_ERROR_NOURI "Error creating URI (invalid URL scheme?)"
|
||||
|
@ -88,7 +90,7 @@ mozJSSubScriptLoader::~mozJSSubScriptLoader()
|
|||
NS_IMPL_THREADSAFE_ISUPPORTS1(mozJSSubScriptLoader, mozIJSSubScriptLoader)
|
||||
|
||||
NS_IMETHODIMP /* args and return value are delt with using XPConnect and JSAPI */
|
||||
mozJSSubScriptLoader::LoadSubScript (const PRUnichar * /*url*/
|
||||
mozJSSubScriptLoader::LoadSubScript (const PRUnichar * aURL
|
||||
/* [, JSObject *target_obj] */)
|
||||
{
|
||||
/*
|
||||
|
@ -107,6 +109,13 @@ mozJSSubScriptLoader::LoadSubScript (const PRUnichar * /*url*/
|
|||
nsresult rv;
|
||||
JSBool ok;
|
||||
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
NS_TIME_FUNCTION_FMT("%s (line %d) (url: %s)", MOZ_FUNCTION_NAME,
|
||||
__LINE__, NS_LossyConvertUTF16toASCII(aURL).get());
|
||||
#else
|
||||
aURL; // prevent compiler warning
|
||||
#endif
|
||||
|
||||
/* get JS things from the CallContext */
|
||||
nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID());
|
||||
if (!xpc) return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
#include "xpcprivate.h"
|
||||
#include "dom_quickstubs.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
const char* XPCJSRuntime::mStrings[] = {
|
||||
|
@ -1067,6 +1069,7 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
|
|||
JS_NewDHashTable(JS_DHashGetStubOps(), nsnull,
|
||||
sizeof(JSDHashEntryStub), 128);
|
||||
#endif
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
DOM_InitInterfaces();
|
||||
|
||||
|
@ -1139,6 +1142,8 @@ XPCJSRuntime::newXPCJSRuntime(nsXPConnect* aXPConnect)
|
|||
JSBool
|
||||
XPCJSRuntime::OnJSContextNew(JSContext *cx)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
// if it is our first context then we need to generate our string ids
|
||||
JSBool ok = JS_TRUE;
|
||||
if(!mStrIDs[0])
|
||||
|
|
|
@ -206,6 +206,22 @@
|
|||
#include "imgIEncoder.h"
|
||||
#include "gfxPlatform.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
#define NS_TIME_FUNCTION_DECLARE_DOCURL \
|
||||
nsCAutoString docURL__("N/A"); \
|
||||
nsIURI *uri__ = mDocument->GetDocumentURI(); \
|
||||
if (uri__) uri__->GetSpec(docURL__);
|
||||
#define NS_TIME_FUNCTION_WITH_DOCURL \
|
||||
NS_TIME_FUNCTION_DECLARE_DOCURL \
|
||||
NS_TIME_FUNCTION_MIN_FMT(1.0, \
|
||||
"%s (line %d) (document: %s)", MOZ_FUNCTION_NAME, \
|
||||
__LINE__, docURL__.get())
|
||||
#else
|
||||
#define NS_TIME_FUNCTION_WITH_DOCURL do{} while(0)
|
||||
#endif
|
||||
|
||||
#include "nsContentCID.h"
|
||||
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
|
||||
|
||||
|
@ -1550,6 +1566,8 @@ PresShell::Init(nsIDocument* aDocument,
|
|||
nsStyleSet* aStyleSet,
|
||||
nsCompatibility aCompatMode)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
NS_PRECONDITION(nsnull != aDocument, "null ptr");
|
||||
NS_PRECONDITION(nsnull != aPresContext, "null ptr");
|
||||
NS_PRECONDITION(nsnull != aViewManager, "null ptr");
|
||||
|
@ -1698,6 +1716,8 @@ PresShell::Init(nsIDocument* aDocument,
|
|||
void
|
||||
PresShell::Destroy()
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
|
||||
"destroy called on presshell while scripts not blocked");
|
||||
|
||||
|
@ -1936,6 +1956,8 @@ nsIPresShell::GetAuthorStyleDisabled() const
|
|||
nsresult
|
||||
PresShell::SetPreferenceStyleRules(PRBool aForceReflow)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
if (!mDocument) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
@ -2024,6 +2046,8 @@ nsresult PresShell::ClearPreferenceStyleRules(void)
|
|||
|
||||
nsresult PresShell::CreatePreferenceStyleSheet(void)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
NS_ASSERTION(!mPrefStyleSheet, "prefStyleSheet already exists");
|
||||
nsresult result = NS_NewCSSStyleSheet(getter_AddRefs(mPrefStyleSheet));
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
|
@ -2063,6 +2087,8 @@ static PRUint32 sInsertPrefSheetRulesAt = 1;
|
|||
nsresult
|
||||
PresShell::SetPrefNoScriptRule()
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// also handle the case where print is done from print preview
|
||||
|
@ -2093,6 +2119,8 @@ PresShell::SetPrefNoScriptRule()
|
|||
|
||||
nsresult PresShell::SetPrefNoFramesRule(void)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
NS_ASSERTION(mPresContext,"null prescontext not allowed");
|
||||
if (!mPresContext) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -2128,6 +2156,8 @@ nsresult PresShell::SetPrefNoFramesRule(void)
|
|||
|
||||
nsresult PresShell::SetPrefLinkRules(void)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
NS_ASSERTION(mPresContext,"null prescontext not allowed");
|
||||
if (!mPresContext) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -2203,6 +2233,8 @@ nsresult PresShell::SetPrefLinkRules(void)
|
|||
|
||||
nsresult PresShell::SetPrefFocusRules(void)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
NS_ASSERTION(mPresContext,"null prescontext not allowed");
|
||||
nsresult result = NS_OK;
|
||||
|
||||
|
@ -2438,6 +2470,8 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_TIME_FUNCTION_WITH_DOCURL;
|
||||
|
||||
NS_ASSERTION(!mDidInitialReflow, "Why are we being called?");
|
||||
|
||||
nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
|
||||
|
@ -2509,6 +2543,8 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
|
|||
// Run the XBL binding constructors for any new frames we've constructed
|
||||
mDocument->BindingManager()->ProcessAttachedQueue();
|
||||
|
||||
NS_TIME_FUNCTION_MARK("XBL binding constructors fired");
|
||||
|
||||
// Constructors may have killed us too
|
||||
NS_ENSURE_STATE(!mHaveShutDown);
|
||||
|
||||
|
@ -2715,6 +2751,8 @@ PresShell::SetIgnoreFrameDestruction(PRBool aIgnore)
|
|||
void
|
||||
PresShell::NotifyDestroyingFrame(nsIFrame* aFrame)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
if (!mIgnoreFrameDestruction) {
|
||||
mPresContext->StopImagesFor(aFrame);
|
||||
|
||||
|
@ -3207,6 +3245,15 @@ void
|
|||
PresShell::FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty,
|
||||
nsFrameState aBitToAdd)
|
||||
{
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
NS_TIME_FUNCTION_DECLARE_DOCURL;
|
||||
nsCAutoString frameType__("N/A");
|
||||
nsIAtom *atomType__ = aFrame ? aFrame->GetType() : nsnull;
|
||||
if (atomType__) atomType__->ToUTF8String(frameType__);
|
||||
NS_TIME_FUNCTION_MIN_FMT(1.0, "%s (line %d) (document: %s, frame type: %s)", MOZ_FUNCTION_NAME,
|
||||
__LINE__, docURL__.get(), frameType__.get());
|
||||
#endif
|
||||
|
||||
NS_PRECONDITION(aBitToAdd == NS_FRAME_IS_DIRTY ||
|
||||
aBitToAdd == NS_FRAME_HAS_DIRTY_CHILDREN,
|
||||
"Unexpected bits being added");
|
||||
|
@ -3438,6 +3485,8 @@ void nsIPresShell::InvalidateAccessibleSubtree(nsIContent *aContent)
|
|||
nsresult
|
||||
PresShell::RecreateFramesFor(nsIContent* aContent)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
NS_ENSURE_TRUE(mPresContext, NS_ERROR_FAILURE);
|
||||
if (!mDidInitialReflow) {
|
||||
// Nothing to do here. In fact, if we proceed and aContent is the
|
||||
|
@ -3506,6 +3555,8 @@ nsresult
|
|||
PresShell::CreateRenderingContext(nsIFrame *aFrame,
|
||||
nsIRenderingContext** aResult)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
NS_PRECONDITION(nsnull != aResult, "null ptr");
|
||||
if (nsnull == aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -4320,6 +4371,8 @@ PresShell::ClearMouseCapture(nsIView* aView)
|
|||
nsresult
|
||||
PresShell::CaptureHistoryState(nsILayoutHistoryState** aState, PRBool aLeavingPage)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_PRECONDITION(nsnull != aState, "null state pointer");
|
||||
|
@ -4555,6 +4608,20 @@ PresShell::IsSafeToFlush() const
|
|||
void
|
||||
PresShell::FlushPendingNotifications(mozFlushType aType)
|
||||
{
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
NS_TIME_FUNCTION_DECLARE_DOCURL;
|
||||
static const char *flushTypeNames[] = {
|
||||
"Flush_Content",
|
||||
"Flush_ContentAndNotify",
|
||||
"Flush_Styles",
|
||||
"Flush_InterruptibleLayout",
|
||||
"Flush_Layout",
|
||||
"Flush_Display"
|
||||
};
|
||||
NS_TIME_FUNCTION_MIN_FMT(1.0, "%s (line %d) (document: %s, type: %s)", MOZ_FUNCTION_NAME,
|
||||
__LINE__, docURL__.get(), flushTypeNames[aType - 1]);
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(aType >= Flush_Frames, "Why did we get called?");
|
||||
|
||||
PRBool isSafeToFlush = IsSafeToFlush();
|
||||
|
@ -5030,6 +5097,8 @@ static inline PRBool
|
|||
PrepareContext(const nsRect& aRect, nscolor aBackgroundColor,
|
||||
gfxContext* aThebesContext, nsRegion *aFillRegion = nsnull)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
gfxRect r(0, 0,
|
||||
nsPresContext::AppUnitsToFloatCSSPixels(aRect.width),
|
||||
nsPresContext::AppUnitsToFloatCSSPixels(aRect.height));
|
||||
|
@ -5076,6 +5145,8 @@ PresShell::RenderDocument(const nsRect& aRect, PRUint32 aFlags,
|
|||
nscolor aBackgroundColor,
|
||||
gfxContext* aThebesContext)
|
||||
{
|
||||
NS_TIME_FUNCTION_WITH_DOCURL;
|
||||
|
||||
NS_ENSURE_TRUE(!(aFlags & RENDER_IS_UNTRUSTED), NS_ERROR_NOT_IMPLEMENTED);
|
||||
|
||||
// we want the window to be composited as a single image using
|
||||
|
@ -5182,6 +5253,8 @@ PresShell::ClipListToRange(nsDisplayListBuilder *aBuilder,
|
|||
nsDisplayList* aList,
|
||||
nsIRange* aRange)
|
||||
{
|
||||
NS_TIME_FUNCTION_WITH_DOCURL;
|
||||
|
||||
// iterate though the display items and add up the bounding boxes of each.
|
||||
// This will allow the total area of the frames within the range to be
|
||||
// determined. To do this, remove an item from the bottom of the list, check
|
||||
|
@ -5273,6 +5346,8 @@ RangePaintInfo*
|
|||
PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
|
||||
nsRect& aSurfaceRect)
|
||||
{
|
||||
NS_TIME_FUNCTION_WITH_DOCURL;
|
||||
|
||||
RangePaintInfo* info = nsnull;
|
||||
|
||||
nsCOMPtr<nsIRange> range = do_QueryInterface(aRange);
|
||||
|
@ -5344,6 +5419,8 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
|
|||
nsIntPoint& aPoint,
|
||||
nsIntRect* aScreenRect)
|
||||
{
|
||||
NS_TIME_FUNCTION_WITH_DOCURL;
|
||||
|
||||
nsPresContext* pc = GetPresContext();
|
||||
if (!pc || aArea.width == 0 || aArea.height == 0)
|
||||
return nsnull;
|
||||
|
@ -5608,6 +5685,17 @@ PresShell::Paint(nsIView* aDisplayRoot,
|
|||
const nsRegion& aDirtyRegion,
|
||||
PRBool aPaintDefaultBackground)
|
||||
{
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
NS_TIME_FUNCTION_DECLARE_DOCURL;
|
||||
const nsRect& bounds__ = aDirtyRegion.GetBounds();
|
||||
NS_TIME_FUNCTION_MIN_FMT(1.0, "%s (line %d) (document: %s, dirty rect: (<%f, %f>, <%f, %f>)",
|
||||
MOZ_FUNCTION_NAME, __LINE__, docURL__.get(),
|
||||
NSCoordToFloat(bounds__.x),
|
||||
NSCoordToFloat(bounds__.y),
|
||||
NSCoordToFloat(bounds__.XMost()),
|
||||
NSCoordToFloat(bounds__.YMost()));
|
||||
#endif
|
||||
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
AUTO_LAYOUT_PHASE_ENTRY_POINT(presContext, Paint);
|
||||
|
||||
|
@ -5861,6 +5949,8 @@ PresShell::HandleEvent(nsIView *aView,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
if (aEvent->eventStructType == NS_ACCESSIBLE_EVENT) {
|
||||
// Accessibility events come through OS requests and not from scripts,
|
||||
|
@ -6330,6 +6420,8 @@ nsresult
|
|||
PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView,
|
||||
nsEventStatus* aStatus)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
if (aEvent->eventStructType == NS_ACCESSIBLE_EVENT)
|
||||
{
|
||||
|
@ -7137,6 +7229,8 @@ PresShell::ScheduleReflowOffTimer()
|
|||
PRBool
|
||||
PresShell::DoReflow(nsIFrame* target, PRBool aInterruptible)
|
||||
{
|
||||
NS_TIME_FUNCTION_WITH_DOCURL;
|
||||
|
||||
if (mReflowContinueTimer) {
|
||||
mReflowContinueTimer->Cancel();
|
||||
mReflowContinueTimer = nsnull;
|
||||
|
@ -7295,6 +7389,8 @@ PresShell::DoVerifyReflow()
|
|||
PRBool
|
||||
PresShell::ProcessReflowCommands(PRBool aInterruptible)
|
||||
{
|
||||
NS_TIME_FUNCTION_WITH_DOCURL;
|
||||
|
||||
PRBool interrupted = PR_FALSE;
|
||||
if (0 != mDirtyRoots.Length()) {
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@
|
|||
#include "nsIParser.h"
|
||||
#include "nsMimeTypes.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
// plugins
|
||||
#include "nsIPluginHost.h"
|
||||
static NS_DEFINE_CID(kPluginDocumentCID, NS_PLUGINDOCUMENT_CID);
|
||||
|
@ -164,6 +166,16 @@ nsContentDLF::CreateInstance(const char* aCommand,
|
|||
nsIStreamListener** aDocListener,
|
||||
nsIContentViewer** aDocViewer)
|
||||
{
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
nsCAutoString channelURL__("N/A");
|
||||
nsCOMPtr<nsIURI> url__;
|
||||
if (aChannel && NS_SUCCEEDED(aChannel->GetURI(getter_AddRefs(url__)))) {
|
||||
url__->GetSpec(channelURL__);
|
||||
}
|
||||
NS_TIME_FUNCTION_FMT("%s (line %d) (url: %s)", MOZ_FUNCTION_NAME,
|
||||
__LINE__, channelURL__.get());
|
||||
#endif
|
||||
|
||||
// Declare "type" here. This is because although the variable itself only
|
||||
// needs limited scope, we need to use the raw string memory -- as returned
|
||||
// by "type.get()" farther down in the function.
|
||||
|
@ -310,6 +322,8 @@ nsContentDLF::CreateInstanceForDocument(nsISupports* aContainer,
|
|||
const char *aCommand,
|
||||
nsIContentViewer** aDocViewerResult)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
do {
|
||||
|
@ -332,6 +346,8 @@ nsContentDLF::CreateBlankDocument(nsILoadGroup *aLoadGroup,
|
|||
nsIPrincipal* aPrincipal,
|
||||
nsIDocument **aDocument)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
*aDocument = nsnull;
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
@ -406,6 +422,8 @@ nsContentDLF::CreateDocument(const char* aCommand,
|
|||
nsIStreamListener** aDocListener,
|
||||
nsIContentViewer** aDocViewer)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIURI> aURL;
|
||||
|
@ -462,6 +480,8 @@ nsContentDLF::CreateXULDocument(const char* aCommand,
|
|||
nsIStreamListener** aDocListener,
|
||||
nsIContentViewer** aDocViewer)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDocument> doc = do_CreateInstance(kXULDocumentCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -560,6 +580,8 @@ nsContentDLF::RegisterDocumentFactories(nsIComponentManager* aCompMgr,
|
|||
const char *aType,
|
||||
const nsModuleComponentInfo* aInfo)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsICategoryManager> catmgr(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
|
||||
|
@ -585,6 +607,8 @@ nsContentDLF::UnregisterDocumentFactories(nsIComponentManager* aCompMgr,
|
|||
const char* aRegistryLocation,
|
||||
const nsModuleComponentInfo* aInfo)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICategoryManager> catmgr(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
|
|
@ -121,6 +121,8 @@
|
|||
#include "nsFocusManager.h"
|
||||
#include "nsTextEditRules.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
#define DEFAULT_COLUMN_WIDTH 20
|
||||
|
||||
#include "nsContentCID.h"
|
||||
|
@ -1373,6 +1375,8 @@ nsTextControlFrame::EnsureEditorInitializedInternal()
|
|||
if (mUseEditor)
|
||||
return NS_OK;
|
||||
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsIDocument* doc = mContent->GetCurrentDoc();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
|
||||
|
|
|
@ -100,6 +100,8 @@
|
|||
#include "nsIChannelPolicy.h"
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
/**
|
||||
* OVERALL ARCHITECTURE
|
||||
*
|
||||
|
@ -1382,6 +1384,13 @@ Loader::LoadSheet(SheetLoadData* aLoadData, StyleSheetState aSheetState)
|
|||
"Shouldn't use system principal for async loads");
|
||||
NS_ASSERTION(mLoadingDatas.IsInitialized(), "mLoadingDatas should be initialized by now.");
|
||||
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
nsCAutoString spec__("N/A");
|
||||
if (aLoadData->mURI) aLoadData->mURI->GetSpec(spec__);
|
||||
NS_TIME_FUNCTION_FMT("Loading stylesheet (url: %s, %ssync)",
|
||||
spec__.get(), aLoadData->mSyncLoad ? "" : "a");
|
||||
#endif
|
||||
|
||||
LOG_URI(" Load from: '%s'", aLoadData->mURI);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -1630,6 +1639,12 @@ Loader::ParseSheet(nsIUnicharInputStream* aStream,
|
|||
NS_PRECONDITION(aLoadData, "Must have load data");
|
||||
NS_PRECONDITION(aLoadData->mSheet, "Must have sheet to parse into");
|
||||
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
nsCAutoString spec__("N/A");
|
||||
if (aLoadData->mURI) aLoadData->mURI->GetSpec(spec__);
|
||||
NS_TIME_FUNCTION_FMT("Parsing stylesheet (url: %s)", spec__.get());
|
||||
#endif
|
||||
|
||||
aCompleted = PR_FALSE;
|
||||
|
||||
nsCSSParser parser(this, aLoadData->mSheet);
|
||||
|
|
|
@ -60,6 +60,8 @@
|
|||
#include "nsWildCard.h"
|
||||
#include "nsZipArchive.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
/**
|
||||
* Global allocator used with zlib. Destroyed in module shutdown.
|
||||
*/
|
||||
|
@ -521,6 +523,8 @@ nsZipItem* nsZipArchive::CreateZipItem()
|
|||
//---------------------------------------------
|
||||
nsresult nsZipArchive::BuildFileList()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
// Get archive size using end pos
|
||||
PRUint8* buf;
|
||||
PRUint8* startp = mFd->mFileData;
|
||||
|
|
|
@ -75,6 +75,8 @@
|
|||
// until this point, we have an evil hack:
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
#if defined(DEBUG_pavlov) || defined(DEBUG_timeless)
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsXPCOM.h"
|
||||
|
@ -666,6 +668,8 @@ imgCacheQueue & imgLoader::GetCacheQueue(nsIURI *aURI)
|
|||
|
||||
nsresult imgLoader::InitCache()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
if (!os)
|
||||
|
|
|
@ -75,6 +75,8 @@
|
|||
#include "nsIConsoleService.h"
|
||||
#include "nsIUploadChannel2.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_ENABLE_LIBCONIC)
|
||||
#include "nsNativeConnectionHelper.h"
|
||||
#endif
|
||||
|
@ -185,6 +187,8 @@ nsIOService::nsIOService()
|
|||
nsresult
|
||||
nsIOService::Init()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
// We need to get references to these services so that we can shut them
|
||||
|
@ -199,12 +203,16 @@ nsIOService::Init()
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_TIME_FUNCTION_MARK("got SocketTransportService");
|
||||
|
||||
mDNSService = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("failed to get DNS service");
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_TIME_FUNCTION_MARK("got DNS Service");
|
||||
|
||||
// XXX hack until xpidl supports error info directly (bug 13423)
|
||||
nsCOMPtr<nsIErrorService> errorService = do_GetService(NS_ERRORSERVICE_CONTRACTID);
|
||||
if (errorService) {
|
||||
|
@ -213,6 +221,8 @@ nsIOService::Init()
|
|||
else
|
||||
NS_WARNING("failed to get error service");
|
||||
|
||||
NS_TIME_FUNCTION_MARK("got Error Service");
|
||||
|
||||
// setup our bad port list stuff
|
||||
for(int i=0; gBadPortList[i]; i++)
|
||||
mRestrictedPortList.AppendElement(gBadPortList[i]);
|
||||
|
@ -239,6 +249,8 @@ nsIOService::Init()
|
|||
else
|
||||
NS_WARNING("failed to get observer service");
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Registered observers");
|
||||
|
||||
// Get the allocator ready
|
||||
if (!gBufferCache) {
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -255,6 +267,8 @@ nsIOService::Init()
|
|||
CallQueryInterface(recyclingAllocator, &gBufferCache);
|
||||
}
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Set up the recycling allocator");
|
||||
|
||||
gIOService = this;
|
||||
|
||||
// go into managed mode if we can
|
||||
|
@ -264,6 +278,8 @@ nsIOService::Init()
|
|||
|
||||
if (mManageOfflineStatus)
|
||||
TrackNetworkLinkStatusForOffline();
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Set up network link service");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -53,6 +53,8 @@
|
|||
#include "nsIPrefBranch2.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
PRLogModuleInfo *gSocketTransportLog = nsnull;
|
||||
#endif
|
||||
|
@ -378,6 +380,8 @@ NS_IMPL_THREADSAFE_ISUPPORTS6(nsSocketTransportService,
|
|||
NS_IMETHODIMP
|
||||
nsSocketTransportService::Init()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
NS_ENSURE_TRUE(mLock, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
if (!NS_IsMainThread()) {
|
||||
|
@ -408,6 +412,8 @@ nsSocketTransportService::Init()
|
|||
LOG(("running socket transport thread without a pollable event"));
|
||||
}
|
||||
}
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Created thread");
|
||||
|
||||
nsCOMPtr<nsIThread> thread;
|
||||
nsresult rv = NS_NewThread(getter_AddRefs(thread), this);
|
||||
|
@ -424,6 +430,8 @@ nsSocketTransportService::Init()
|
|||
tmpPrefService->AddObserver(SEND_BUFFER_PREF, this, PR_FALSE);
|
||||
UpdatePrefs();
|
||||
|
||||
NS_TIME_FUNCTION_MARK("UpdatePrefs");
|
||||
|
||||
mInitialized = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
#include <math.h> // for log()
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
/******************************************************************************
|
||||
* nsCacheProfilePrefObserver
|
||||
|
@ -669,6 +670,8 @@ nsCacheService::~nsCacheService()
|
|||
nsresult
|
||||
nsCacheService::Init()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
NS_ASSERTION(!mInitialized, "nsCacheService already initialized.");
|
||||
if (mInitialized)
|
||||
return NS_ERROR_ALREADY_INITIALIZED;
|
||||
|
|
|
@ -80,6 +80,8 @@
|
|||
#include "nsCOMArray.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
static const char DISK_CACHE_DEVICE_ID[] = { "disk" };
|
||||
|
||||
|
||||
|
@ -359,6 +361,8 @@ nsDiskCacheDevice::~nsDiskCacheDevice()
|
|||
nsresult
|
||||
nsDiskCacheDevice::Init()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
NS_ENSURE_TRUE(!Initialized(), NS_ERROR_FAILURE);
|
||||
|
|
|
@ -63,6 +63,8 @@
|
|||
#include "nsICacheVisitor.h"
|
||||
#include "nsISeekableStream.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
static const char OFFLINE_CACHE_DEVICE_ID[] = { "offline" };
|
||||
static NS_DEFINE_CID(kCacheServiceCID, NS_CACHESERVICE_CID);
|
||||
|
||||
|
@ -956,6 +958,8 @@ nsOfflineCacheDevice::GetInstance()
|
|||
nsresult
|
||||
nsOfflineCacheDevice::Init()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
NS_ENSURE_TRUE(!mDB, NS_ERROR_ALREADY_INITIALIZED);
|
||||
|
||||
// SetCacheParentDirectory must have been called
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
#include "nsIPrivateBrowsingService.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "mozilla/storage.h"
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
/******************************************************************************
|
||||
* nsCookieService impl:
|
||||
|
@ -518,6 +519,8 @@ nsCookieService::nsCookieService()
|
|||
nsresult
|
||||
nsCookieService::Init()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
if (!mDBState->hostTable.Init()) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#include "prio.h"
|
||||
#include "plstr.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
static const char kPrefDnsCacheEntries[] = "network.dnsCacheEntries";
|
||||
static const char kPrefDnsCacheExpiration[] = "network.dnsCacheExpiration";
|
||||
static const char kPrefEnableIDN[] = "network.enableIDN";
|
||||
|
@ -319,6 +321,8 @@ NS_IMPL_THREADSAFE_ISUPPORTS3(nsDNSService, nsIDNSService, nsPIDNSService,
|
|||
NS_IMETHODIMP
|
||||
nsDNSService::Init()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
NS_ENSURE_TRUE(!mResolver, NS_ERROR_ALREADY_INITIALIZED);
|
||||
|
||||
PRBool firstTime = (mLock == nsnull);
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "prnetdb.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsEffectiveTLDService, nsIEffectiveTLDService)
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -60,6 +62,8 @@ static const ETLDEntry gEntries[] =
|
|||
nsresult
|
||||
nsEffectiveTLDService::Init()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
// We'll probably have to rehash at least once, since nsTHashtable doesn't
|
||||
// use a perfect hash, but at least we'll save a few rehashes along the way.
|
||||
// Next optimization here is to precompute the hash using something like
|
||||
|
|
|
@ -66,6 +66,8 @@
|
|||
#include "plstr.h"
|
||||
#include "nsURLHelper.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// Use a persistent thread pool in order to avoid spinning up new threads all the time.
|
||||
|
@ -361,6 +363,8 @@ nsHostResolver::~nsHostResolver()
|
|||
nsresult
|
||||
nsHostResolver::Init()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
mLock = PR_NewLock();
|
||||
if (!mLock)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
#include "nsISupportsPrimitives.h"
|
||||
#include "punycode.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// RFC 1034 - 3.1. Name space specifications and terminology
|
||||
static const PRUint32 kMaxDNSNodeLen = 63;
|
||||
|
@ -79,6 +81,8 @@ NS_IMPL_THREADSAFE_ISUPPORTS3(nsIDNService,
|
|||
|
||||
nsresult nsIDNService::Init()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsCOMPtr<nsIPrefService> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
||||
if (prefs)
|
||||
prefs->GetBranch(NS_NET_PREF_IDNWHITELIST, getter_AddRefs(mIDNWhitelistPrefBranch));
|
||||
|
|
|
@ -94,6 +94,8 @@
|
|||
#include <os2.h>
|
||||
#endif
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
// defined by the socket transport service while active
|
||||
extern PRThread *gSocketThread;
|
||||
|
@ -211,6 +213,8 @@ nsHttpHandler::~nsHttpHandler()
|
|||
nsresult
|
||||
nsHttpHandler::Init()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
LOG(("nsHttpHandler::Init\n"));
|
||||
|
@ -307,6 +311,8 @@ nsHttpHandler::Init()
|
|||
nsresult
|
||||
nsHttpHandler::InitConnectionMgr()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (!mConnMgr) {
|
||||
|
|
|
@ -61,6 +61,8 @@
|
|||
#include "nsServiceManagerUtils.h" // do_GetService
|
||||
#include "nsIHttpActivityObserver.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -172,6 +174,8 @@ nsHttpTransaction::Init(PRUint8 caps,
|
|||
nsITransportEventSink *eventsink,
|
||||
nsIAsyncInputStream **responseBody)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
LOG(("nsHttpTransaction::Init [this=%x caps=%x]\n", this, caps));
|
||||
|
|
|
@ -596,6 +596,14 @@ Connection::internalClose()
|
|||
return convertResultCode(srv);
|
||||
}
|
||||
|
||||
nsCString
|
||||
Connection::getFilename()
|
||||
{
|
||||
nsCString leafname;
|
||||
(void)mDatabaseFile->GetNativeLeafName(leafname);
|
||||
return leafname;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// mozIStorageConnection
|
||||
|
||||
|
|
|
@ -121,6 +121,11 @@ public:
|
|||
*/
|
||||
nsresult internalClose();
|
||||
|
||||
/**
|
||||
* Obtains the filename of the connection. Useful for logging.
|
||||
*/
|
||||
nsCString getFilename();
|
||||
|
||||
private:
|
||||
~Connection();
|
||||
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#include "nsIPromptService.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace storage {
|
||||
|
||||
|
@ -160,6 +162,8 @@ Service::shutdown()
|
|||
nsresult
|
||||
Service::initialize()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
int rc;
|
||||
|
||||
// Explicitly initialize sqlite3. Although this is implicitly called by
|
||||
|
@ -300,6 +304,12 @@ NS_IMETHODIMP
|
|||
Service::OpenDatabase(nsIFile *aDatabaseFile,
|
||||
mozIStorageConnection **_connection)
|
||||
{
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
nsCString leafname;
|
||||
(void)aDatabaseFile->GetNativeLeafName(leafname);
|
||||
NS_TIME_FUNCTION_FMT("mozIStorageService::OpenDatabase(%s)", leafname.get());
|
||||
#endif
|
||||
|
||||
nsRefPtr<Connection> msc = new Connection(this);
|
||||
NS_ENSURE_TRUE(msc, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
|
@ -317,6 +327,13 @@ NS_IMETHODIMP
|
|||
Service::OpenUnsharedDatabase(nsIFile *aDatabaseFile,
|
||||
mozIStorageConnection **_connection)
|
||||
{
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
nsCString leafname;
|
||||
(void)aDatabaseFile->GetNativeLeafName(leafname);
|
||||
NS_TIME_FUNCTION_FMT("mozIStorageService::OpenUnsharedDatabase(%s)",
|
||||
leafname.get());
|
||||
#endif
|
||||
|
||||
nsRefPtr<Connection> msc = new Connection(this);
|
||||
NS_ENSURE_TRUE(msc, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@
|
|||
|
||||
#include "prlog.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
extern PRLogModuleInfo* gStorageLog;
|
||||
#endif
|
||||
|
@ -590,6 +592,9 @@ Statement::ExecuteStep(PRBool *_moreResults)
|
|||
if (!mDBStatement)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
NS_TIME_FUNCTION_MIN_FMT(5, "mozIStorageStatement::ExecuteStep(%s) (0x%p)",
|
||||
mDBConnection->getFilename().get(), mDBStatement);
|
||||
|
||||
// Bind any parameters first before executing.
|
||||
if (mParamsArray) {
|
||||
// If we have more than one row of parameters to bind, they shouldn't be
|
||||
|
|
|
@ -59,6 +59,8 @@
|
|||
#include "nsPlacesMacros.h"
|
||||
#include "Helpers.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
const PRInt32 nsNavBookmarks::kFindBookmarksIndex_ID = 0;
|
||||
const PRInt32 nsNavBookmarks::kFindBookmarksIndex_Type = 1;
|
||||
const PRInt32 nsNavBookmarks::kFindBookmarksIndex_PlaceID = 2;
|
||||
|
@ -127,6 +129,8 @@ NS_IMPL_ISUPPORTS3(nsNavBookmarks,
|
|||
nsresult
|
||||
nsNavBookmarks::Init()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsNavHistory* history = nsNavHistory::GetHistoryService();
|
||||
NS_ENSURE_TRUE(history, NS_ERROR_OUT_OF_MEMORY);
|
||||
mDBConn = history->GetStorageConnection();
|
||||
|
|
|
@ -79,6 +79,8 @@
|
|||
#include "Helpers.h"
|
||||
#include "History.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsIAutoCompleteInput.h"
|
||||
#include "nsIAutoCompletePopup.h"
|
||||
|
@ -418,6 +420,8 @@ nsNavHistory::~nsNavHistory()
|
|||
nsresult
|
||||
nsNavHistory::Init()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsCOMPtr<nsIPrefService> prefService =
|
||||
do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
nsCOMPtr<nsIPrefBranch> placesBranch;
|
||||
|
|
|
@ -70,6 +70,8 @@
|
|||
#include "nsAppShellCID.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
|
||||
class nsAppExitEvent : public nsRunnable {
|
||||
|
@ -107,17 +109,22 @@ nsAppStartup::nsAppStartup() :
|
|||
nsresult
|
||||
nsAppStartup::Init()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
nsresult rv;
|
||||
|
||||
// Create widget application shell
|
||||
mAppShell = do_GetService(kAppShellCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Got AppShell service");
|
||||
|
||||
nsCOMPtr<nsIObserverService> os =
|
||||
mozilla::services::GetObserverService();
|
||||
if (!os)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Got Observer service");
|
||||
|
||||
os->AddObserver(this, "quit-application-forced", PR_TRUE);
|
||||
os->AddObserver(this, "profile-change-teardown", PR_TRUE);
|
||||
os->AddObserver(this, "xul-window-registered", PR_TRUE);
|
||||
|
|
|
@ -210,6 +210,8 @@
|
|||
#include "base/command_line.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
#ifdef WINCE
|
||||
class WindowsMutex {
|
||||
public:
|
||||
|
@ -1228,6 +1230,7 @@ nsSingletonFactory::LockFactory(PRBool)
|
|||
nsresult
|
||||
ScopedXPCOMStartup::SetWindowCreator(nsINativeAppSupport* native)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar
|
||||
|
@ -1243,18 +1246,28 @@ ScopedXPCOMStartup::SetWindowCreator(nsINativeAppSupport* native)
|
|||
nativeFactory);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_TIME_FUNCTION_MARK("RegisterFactory done");
|
||||
|
||||
// Inform the chrome registry about OS accessibility
|
||||
nsCOMPtr<nsIToolkitChromeRegistry> cr =
|
||||
mozilla::services::GetToolkitChromeRegistryService();
|
||||
NS_TIME_FUNCTION_MARK("Got ToolkitChromeRegistry service");
|
||||
|
||||
if (cr)
|
||||
cr->CheckForOSAccessibility();
|
||||
|
||||
NS_TIME_FUNCTION_MARK("OS Accessibility check");
|
||||
|
||||
nsCOMPtr<nsIWindowCreator> creator (do_GetService(NS_APPSTARTUP_CONTRACTID));
|
||||
if (!creator) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Got AppStartup service");
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch
|
||||
(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Got WindowWatcher service");
|
||||
|
||||
return wwatch->SetWindowCreator(creator);
|
||||
}
|
||||
|
@ -3332,6 +3345,8 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||
|
||||
NS_TIME_FUNCTION_MARK("Next: ScopedXPCOMStartup");
|
||||
|
||||
NS_TIME_FUNCTION_MARK("ScopedXPCOMStartup");
|
||||
|
||||
// Allows the user to forcefully bypass the restart process at their
|
||||
// own risk. Useful for debugging or for tinderboxes where child
|
||||
// processes can be problematic.
|
||||
|
@ -3339,12 +3354,46 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||
// Start the real application
|
||||
ScopedXPCOMStartup xpcom;
|
||||
rv = xpcom.Initialize();
|
||||
NS_TIME_FUNCTION_MARK("ScopedXPCOMStartup: Initialize");
|
||||
NS_ENSURE_SUCCESS(rv, 1);
|
||||
rv = xpcom.DoAutoreg();
|
||||
NS_TIME_FUNCTION_MARK("ScopedXPCOMStartup: DoAutoreg");
|
||||
|
||||
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
// initialize some common services, so we don't pay the cost for these at odd times later on;
|
||||
// SetWindowCreator -> ChromeRegistry -> IOService -> SocketTransportService -> (nspr wspm init), Prefs
|
||||
{
|
||||
nsCOMPtr<nsISupports> comp;
|
||||
|
||||
comp = do_GetService("@mozilla.org/preferences-service;1");
|
||||
NS_TIME_FUNCTION_MARK("Pref Service");
|
||||
|
||||
comp = do_GetService("@mozilla.org/network/socket-transport-service;1");
|
||||
NS_TIME_FUNCTION_MARK("Socket Transport Service");
|
||||
|
||||
comp = do_GetService("@mozilla.org/network/dns-service;1");
|
||||
NS_TIME_FUNCTION_MARK("DNS Service");
|
||||
|
||||
comp = do_GetService("@mozilla.org/network/io-service;1");
|
||||
NS_TIME_FUNCTION_MARK("IO Service");
|
||||
|
||||
comp = do_GetService("@mozilla.org/chrome/chrome-registry;1");
|
||||
NS_TIME_FUNCTION_MARK("Chrome Registry Service");
|
||||
|
||||
comp = do_GetService("@mozilla.org/focus-event-suppressor-service;1");
|
||||
NS_TIME_FUNCTION_MARK("Focus Event Suppressor Service");
|
||||
}
|
||||
#endif
|
||||
|
||||
rv |= xpcom.RegisterProfileService();
|
||||
NS_TIME_FUNCTION_MARK("ScopedXPCOMStartup: RegisterProfileService");
|
||||
rv |= xpcom.SetWindowCreator(nativeApp);
|
||||
NS_TIME_FUNCTION_MARK("ScopedXPCOMStartup: SetWindowCreator");
|
||||
NS_ENSURE_SUCCESS(rv, 1);
|
||||
|
||||
NS_TIME_FUNCTION_MARK("ScopedXPCOMStartup: Done");
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
// tell the crash reporter to also send the release channel
|
||||
nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
|
||||
|
@ -3383,10 +3432,14 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||
NS_TIMELINE_LEAVE("startupNotifier");
|
||||
}
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Finished startupNotifier");
|
||||
|
||||
nsCOMPtr<nsIAppStartup2> appStartup
|
||||
(do_GetService(NS_APPSTARTUP_CONTRACTID));
|
||||
NS_ENSURE_TRUE(appStartup, 1);
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Created AppStartup");
|
||||
|
||||
if (gDoMigration) {
|
||||
nsCOMPtr<nsIFile> file;
|
||||
dirProvider.GetAppDir()->Clone(getter_AddRefs(file));
|
||||
|
@ -3413,8 +3466,13 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||
if (pm)
|
||||
pm->Migrate(&dirProvider);
|
||||
}
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Profile migration");
|
||||
|
||||
dirProvider.DoStartup();
|
||||
|
||||
NS_TIME_FUNCTION_MARK("dirProvider.DoStartup() (profile-after-change)");
|
||||
|
||||
PRBool shuttingDown = PR_FALSE;
|
||||
appStartup->GetShuttingDown(&shuttingDown);
|
||||
|
||||
|
@ -3440,6 +3498,8 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||
obsService->NotifyObservers(cmdLine, "command-line-startup", nsnull);
|
||||
}
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Early command line init");
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Next: prepare for Run");
|
||||
|
||||
if (!upgraded)
|
||||
|
@ -3469,6 +3529,8 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||
SaveToEnv("NO_EM_RESTART=");
|
||||
SaveToEnv("XUL_APP_FILE=");
|
||||
SaveToEnv("XRE_BINARY_PATH=");
|
||||
|
||||
NS_TIME_FUNCTION_MARK("env munging");
|
||||
|
||||
if (!shuttingDown) {
|
||||
NS_TIME_FUNCTION_MARK("Next: CreateHiddenWindow");
|
||||
|
@ -3511,6 +3573,8 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||
if (obsService)
|
||||
obsService->NotifyObservers(nsnull, "final-ui-startup", nsnull);
|
||||
|
||||
NS_TIME_FUNCTION_MARK("final-ui-startup done");
|
||||
|
||||
appStartup->GetShuttingDown(&shuttingDown);
|
||||
}
|
||||
|
||||
|
@ -3540,6 +3604,8 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||
|
||||
NS_TIME_FUNCTION_MARK("Next: Run");
|
||||
|
||||
NS_TIME_FUNCTION_MARK("appStartup->Run");
|
||||
|
||||
MOZ_SPLASHSCREEN_UPDATE(90);
|
||||
{
|
||||
NS_TIMELINE_ENTER("appStartup->Run");
|
||||
|
@ -3553,6 +3619,8 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||
|
||||
NS_TIME_FUNCTION_MARK("Next: Finish");
|
||||
|
||||
NS_TIME_FUNCTION_MARK("appStartup->Run done");
|
||||
|
||||
// Check for an application initiated restart. This is one that
|
||||
// corresponds to nsIAppStartup.quit(eRestart)
|
||||
if (rv == NS_SUCCESS_RESTART_APP) {
|
||||
|
|
|
@ -80,6 +80,19 @@
|
|||
|
||||
#include "nsDocLoader.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
#define TIME_URILOADER_FUNCTION(req) \
|
||||
nsCAutoString name__("N/A"); \
|
||||
(req)->GetName(name__); \
|
||||
NS_TIME_FUNCTION_FMT("%s (line %d) (request: %s)", \
|
||||
MOZ_FUNCTION_NAME, \
|
||||
__LINE__, \
|
||||
name__.get())
|
||||
#else
|
||||
#define TIME_URILOADER_FUNCTION(req) do {} while(0)
|
||||
#endif
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
PRLogModuleInfo* nsURILoader::mLog = nsnull;
|
||||
#endif
|
||||
|
@ -224,6 +237,8 @@ nsresult nsDocumentOpenInfo::Prepare()
|
|||
|
||||
NS_IMETHODIMP nsDocumentOpenInfo::OnStartRequest(nsIRequest *request, nsISupports * aCtxt)
|
||||
{
|
||||
TIME_URILOADER_FUNCTION(request);
|
||||
|
||||
LOG(("[0x%p] nsDocumentOpenInfo::OnStartRequest", this));
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -297,6 +312,8 @@ NS_IMETHODIMP nsDocumentOpenInfo::OnStartRequest(nsIRequest *request, nsISupport
|
|||
NS_IMETHODIMP nsDocumentOpenInfo::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt,
|
||||
nsIInputStream * inStr, PRUint32 sourceOffset, PRUint32 count)
|
||||
{
|
||||
TIME_URILOADER_FUNCTION(request);
|
||||
|
||||
// if we have retarged to the end stream listener, then forward the call....
|
||||
// otherwise, don't do anything
|
||||
|
||||
|
@ -310,6 +327,8 @@ NS_IMETHODIMP nsDocumentOpenInfo::OnDataAvailable(nsIRequest *request, nsISuppor
|
|||
NS_IMETHODIMP nsDocumentOpenInfo::OnStopRequest(nsIRequest *request, nsISupports *aCtxt,
|
||||
nsresult aStatus)
|
||||
{
|
||||
TIME_URILOADER_FUNCTION(request);
|
||||
|
||||
LOG(("[0x%p] nsDocumentOpenInfo::OnStopRequest", this));
|
||||
|
||||
if ( m_targetStreamListener)
|
||||
|
@ -332,6 +351,8 @@ NS_IMETHODIMP nsDocumentOpenInfo::OnStopRequest(nsIRequest *request, nsISupports
|
|||
|
||||
nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest *request, nsISupports * aCtxt)
|
||||
{
|
||||
TIME_URILOADER_FUNCTION(request);
|
||||
|
||||
LOG(("[0x%p] nsDocumentOpenInfo::DispatchContent for type '%s'", this, mContentType.get()));
|
||||
|
||||
NS_PRECONDITION(!m_targetStreamListener,
|
||||
|
@ -609,6 +630,8 @@ nsDocumentOpenInfo::ConvertData(nsIRequest *request,
|
|||
const nsACString& aSrcContentType,
|
||||
const nsACString& aOutContentType)
|
||||
{
|
||||
TIME_URILOADER_FUNCTION(request);
|
||||
|
||||
LOG(("[0x%p] nsDocumentOpenInfo::ConvertData from '%s' to '%s'", this,
|
||||
PromiseFlatCString(aSrcContentType).get(),
|
||||
PromiseFlatCString(aOutContentType).get()));
|
||||
|
@ -665,6 +688,8 @@ PRBool
|
|||
nsDocumentOpenInfo::TryContentListener(nsIURIContentListener* aListener,
|
||||
nsIChannel* aChannel)
|
||||
{
|
||||
TIME_URILOADER_FUNCTION(aChannel);
|
||||
|
||||
LOG(("[0x%p] nsDocumentOpenInfo::TryContentListener; mFlags = 0x%x",
|
||||
this, mFlags));
|
||||
|
||||
|
@ -809,6 +834,8 @@ NS_IMETHODIMP nsURILoader::OpenURI(nsIChannel *channel,
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(channel);
|
||||
|
||||
TIME_URILOADER_FUNCTION(channel);
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (LOG_ENABLED()) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
@ -856,6 +883,8 @@ nsresult nsURILoader::OpenChannel(nsIChannel* channel,
|
|||
NS_ASSERTION(channel, "Trying to open a null channel!");
|
||||
NS_ASSERTION(aWindowContext, "Window context must not be null");
|
||||
|
||||
TIME_URILOADER_FUNCTION(channel);
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (LOG_ENABLED()) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
|
|
@ -209,6 +209,8 @@
|
|||
#include "nsGfxCIID.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
/**************************************************************
|
||||
**************************************************************
|
||||
**
|
||||
|
@ -1092,7 +1094,7 @@ NS_METHOD nsWindow::Show(PRBool bState)
|
|||
mWindowType == eWindowType_popup))
|
||||
{
|
||||
firstShow = false;
|
||||
mozilla::FunctionTimer::LogMessage("First toplevel/dialog/popup showing");
|
||||
mozilla::FunctionTimer::LogMessage("@ First toplevel/dialog/popup showing");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3882,6 +3884,10 @@ nsWindow::IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam)
|
|||
// The WndProc procedure for all nsWindows in this toolkit
|
||||
LRESULT CALLBACK nsWindow::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
NS_TIME_FUNCTION_MIN_FMT(5.0, "%s (line %d) (hWnd: %p, msg: %p, wParam: %p, lParam: %p",
|
||||
MOZ_FUNCTION_NAME, __LINE__, hWnd, msg,
|
||||
wParam, lParam);
|
||||
|
||||
// Get the window which caused the event and ask it to process the message
|
||||
nsWindow *someWindow = GetNSWindowPtr(hWnd);
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
|
||||
#ifdef _MSC_VER
|
||||
#define vsnprintf _vsnprintf
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -60,10 +62,11 @@ using namespace mozilla;
|
|||
// assigned the Now() value to it.
|
||||
static TimeStamp sAppStart;
|
||||
|
||||
FunctionTimerLog *FunctionTimer::sLog = nsnull;
|
||||
nsAutoPtr<FunctionTimerLog> FunctionTimer::sLog;
|
||||
char *FunctionTimer::sBuf1 = nsnull;
|
||||
char *FunctionTimer::sBuf2 = nsnull;
|
||||
int FunctionTimer::sBufSize = FunctionTimer::InitTimers();
|
||||
unsigned FunctionTimer::sDepth = 0;
|
||||
|
||||
int
|
||||
FunctionTimer::InitTimers()
|
||||
|
@ -95,12 +98,21 @@ FunctionTimerLog::FunctionTimerLog(const char *fname)
|
|||
}
|
||||
mFile = fp;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Get 1ms resolution on Windows
|
||||
timeBeginPeriod(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
FunctionTimerLog::~FunctionTimerLog()
|
||||
{
|
||||
if (mFile && mFile != stdout && mFile != stderr)
|
||||
fclose((FILE*)mFile);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
timeEndPeriod(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nscore.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
#if defined(NS_FORCE_FUNCTION_TIMER) && !defined(NS_FUNCTION_TIMER)
|
||||
#define NS_FUNCTION_TIMER
|
||||
|
@ -54,11 +55,20 @@
|
|||
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define MOZ_FUNCTION_NAME __PRETTY_FUNCTION__
|
||||
#elif defined(_MSC_VER)
|
||||
#define MOZ_FUNCTION_NAME __FUNCTION__
|
||||
#else
|
||||
#warning "Define a suitable MOZ_FUNCTION_NAME for this platform"
|
||||
#define MOZ_FUNCTION_NAME ""
|
||||
#endif
|
||||
|
||||
// Add a timer for this function, from this declaration until the
|
||||
// function returns. The function name will be used as the
|
||||
// log string, and both function entry and exit will be printed.
|
||||
#define NS_TIME_FUNCTION \
|
||||
mozilla::FunctionTimer ft__autogen("%s (line %d)", __FUNCTION__, __LINE__)
|
||||
mozilla::FunctionTimer ft__autogen("%s (line %d)", MOZ_FUNCTION_NAME, __LINE__)
|
||||
|
||||
// Add a timer for this block, but print only a) if the exit time is
|
||||
// greater than the given number of milliseconds; or b) if the
|
||||
|
@ -66,12 +76,12 @@
|
|||
// No function entry will be printed. If the value given is negative,
|
||||
// no function entry or exit will ever be printed, but all marks will.
|
||||
#define NS_TIME_FUNCTION_MIN(_ms) \
|
||||
mozilla::FunctionTimer ft__autogen((_ms), "%s (line %d)", __FUNCTION__, __LINE__)
|
||||
mozilla::FunctionTimer ft__autogen((_ms), "%s (line %d)", MOZ_FUNCTION_NAME, __LINE__)
|
||||
|
||||
// Add a timer for this block, but print only marks, not function
|
||||
// entry and exit. The same as calling the above macro with a negative value.
|
||||
#define NS_TIME_FUNCTION_MARK_ONLY \
|
||||
mozilla::FunctionTimer ft__autogen((-1), "%s (line %d)", __FUNCTION__, __LINE__)
|
||||
mozilla::FunctionTimer ft__autogen((-1), "%s (line %d)", MOZ_FUNCTION_NAME, __LINE__)
|
||||
|
||||
// Add a timer for this block, using the printf-style format.
|
||||
// Both function entry and exit will be printed.
|
||||
|
@ -131,12 +141,13 @@ private:
|
|||
|
||||
class NS_COM FunctionTimer
|
||||
{
|
||||
static FunctionTimerLog* sLog;
|
||||
static nsAutoPtr<FunctionTimerLog> sLog;
|
||||
static char *sBuf1;
|
||||
static char *sBuf2;
|
||||
static int sBufSize;
|
||||
static unsigned sDepth;
|
||||
|
||||
enum { BUF_LOG_LENGTH = 256 };
|
||||
enum { BUF_LOG_LENGTH = 1024 };
|
||||
|
||||
public:
|
||||
static int InitTimers();
|
||||
|
@ -156,55 +167,58 @@ public:
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
private:
|
||||
void Init(const char *s, va_list ap) {
|
||||
if (mEnabled) {
|
||||
TimeInit();
|
||||
|
||||
ft_vsnprintf(mString, BUF_LOG_LENGTH, s, ap);
|
||||
|
||||
ft_snprintf(sBuf1, sBufSize, "> (% 3d)%*s|%s%s", mDepth, mDepth, " ", mHasMinMs ? "?MINMS " : "", mString);
|
||||
sLog->LogString(sBuf1);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
inline void TimeInit() {
|
||||
if (sLog) {
|
||||
if (mEnabled) {
|
||||
mStart = TimeStamp::Now();
|
||||
mLastMark = mStart;
|
||||
}
|
||||
}
|
||||
|
||||
inline double Elapsed() {
|
||||
if (sLog)
|
||||
if (mEnabled)
|
||||
return (TimeStamp::Now() - mStart).ToSeconds() * 1000.0;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
inline double ElapsedSinceMark() {
|
||||
if (sLog)
|
||||
if (mEnabled)
|
||||
return (TimeStamp::Now() - mLastMark).ToSeconds() * 1000.0;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
FunctionTimer(double minms, const char *s, ...)
|
||||
: mMinMs(minms)
|
||||
: mMinMs(minms), mHasMinMs(PR_TRUE),
|
||||
mEnabled(sLog && s && *s), mDepth(++sDepth)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, s);
|
||||
|
||||
if (sLog) {
|
||||
TimeInit();
|
||||
|
||||
ft_vsnprintf(mString, BUF_LOG_LENGTH, s, ap);
|
||||
}
|
||||
Init(s, ap);
|
||||
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
FunctionTimer(const char *s, ...)
|
||||
: mMinMs(0.0)
|
||||
: mMinMs(0.0), mHasMinMs(PR_FALSE),
|
||||
mEnabled(sLog && s && *s), mDepth(++sDepth)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, s);
|
||||
|
||||
if (sLog) {
|
||||
TimeInit();
|
||||
|
||||
ft_vsnprintf(mString, BUF_LOG_LENGTH, s, ap);
|
||||
|
||||
ft_snprintf(sBuf1, sBufSize, "> %s", mString);
|
||||
sLog->LogString(sBuf1);
|
||||
}
|
||||
Init(s, ap);
|
||||
|
||||
va_end(ap);
|
||||
}
|
||||
|
@ -214,7 +228,7 @@ public:
|
|||
va_list ap;
|
||||
va_start(ap, s);
|
||||
|
||||
if (sLog) {
|
||||
if (mEnabled) {
|
||||
ft_vsnprintf(sBuf1, sBufSize, s, ap);
|
||||
|
||||
TimeStamp now(TimeStamp::Now());
|
||||
|
@ -222,31 +236,34 @@ public:
|
|||
double msl = (now - mLastMark).ToSeconds() * 1000.0;
|
||||
mLastMark = now;
|
||||
|
||||
if (msl > mMinMs) {
|
||||
ft_snprintf(sBuf2, sBufSize, "%s- %9.2f ms (%9.2f ms total) - %s [%s]", mMinMs < 0.0 ? "" : "*", msl, ms, mString, sBuf1);
|
||||
sLog->LogString(sBuf2);
|
||||
}
|
||||
ft_snprintf(sBuf2, sBufSize, "* (% 3d)%*s|%s%9.2f ms (%9.2f ms total) - %s [%s]", mDepth, mDepth, " ",
|
||||
(!mHasMinMs || mMinMs < 0.0 || msl > mMinMs) ? "<MINMS " : "", msl, ms, mString, sBuf1);
|
||||
sLog->LogString(sBuf2);
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
~FunctionTimer() {
|
||||
if (sLog) {
|
||||
if (mEnabled) {
|
||||
TimeStamp now(TimeStamp::Now());
|
||||
double ms = (now - mStart).ToSeconds() * 1000.0;
|
||||
double msl = (now - mLastMark).ToSeconds() * 1000.0;
|
||||
|
||||
if (mMinMs < 0.0 || (mMinMs >= 0.0 && msl > mMinMs)) {
|
||||
ft_snprintf(sBuf1, sBufSize, "%s %9.2f ms (%9.2f ms total) - %s", mMinMs < 0.0 ? "<" : "*", msl, ms, mString);
|
||||
sLog->LogString(sBuf1);
|
||||
}
|
||||
ft_snprintf(sBuf1, sBufSize, "< (% 3d)%*s|%s%9.2f ms (%9.2f ms total) - %s", mDepth, mDepth, " ",
|
||||
(!mHasMinMs || (mMinMs >= 0.0 && msl > mMinMs)) ? "" : "<MINMS ", msl, ms, mString);
|
||||
sLog->LogString(sBuf1);
|
||||
}
|
||||
|
||||
--sDepth;
|
||||
}
|
||||
|
||||
TimeStamp mStart, mLastMark;
|
||||
const double mMinMs;
|
||||
char mString[BUF_LOG_LENGTH+1];
|
||||
double mMinMs;
|
||||
const PRBool mHasMinMs;
|
||||
const PRBool mEnabled;
|
||||
const unsigned mDepth;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include <stdio.h>
|
||||
#include "plstr.h"
|
||||
#include "nsMemory.h" // for NS_ARRAY_LENGTH
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
#include "nspr.h"
|
||||
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||
|
@ -601,6 +602,8 @@ WalkStackThread(void* aData)
|
|||
DWORD ret;
|
||||
|
||||
struct WalkStackData *data = (WalkStackData *)msg.lParam;
|
||||
if (!data)
|
||||
continue;
|
||||
|
||||
// Don't suspend the calling thread until it's waiting for
|
||||
// us; otherwise the number of frames on the stack could vary.
|
||||
|
@ -945,6 +948,8 @@ EnsureSymInitialized()
|
|||
if (gInitialized)
|
||||
return gInitialized;
|
||||
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
if (!EnsureImageHlpInitialized())
|
||||
return PR_FALSE;
|
||||
|
||||
|
|
|
@ -143,6 +143,7 @@ NS_DECL_CLASSINFO(nsStringInputStream)
|
|||
|
||||
#include <locale.h>
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#include "base/at_exit.h"
|
||||
|
@ -475,6 +476,8 @@ NS_InitXPCOM3(nsIServiceManager* *result,
|
|||
nsStaticModuleInfo const *staticComponents,
|
||||
PRUint32 componentCount)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
#ifdef MOZ_ENABLE_LIBXUL
|
||||
|
@ -487,9 +490,13 @@ NS_InitXPCOM3(nsIServiceManager* *result,
|
|||
// We are not shutting down
|
||||
gXPCOMShuttingDown = PR_FALSE;
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Next: log init");
|
||||
|
||||
NS_LogInit();
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
NS_TIME_FUNCTION_MARK("Next: IPC init");
|
||||
|
||||
// Set up chromium libs
|
||||
NS_ASSERTION(!sExitManager && !sMessageLoop, "Bad logic!");
|
||||
|
||||
|
@ -517,15 +524,21 @@ NS_InitXPCOM3(nsIServiceManager* *result,
|
|||
}
|
||||
#endif
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Next: thread manager init");
|
||||
|
||||
// Establish the main thread here.
|
||||
rv = nsThreadManager::get()->Init();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Next: timer startup");
|
||||
|
||||
// Set up the timer globals/timer thread
|
||||
rv = nsTimerImpl::Startup();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
#ifndef WINCE
|
||||
NS_TIME_FUNCTION_MARK("Next: setlocale");
|
||||
|
||||
// If the locale hasn't already been setup by our embedder,
|
||||
// get us out of the "C" locale and into the system
|
||||
if (strcmp(setlocale(LC_ALL, NULL), "C") == 0)
|
||||
|
@ -533,8 +546,12 @@ NS_InitXPCOM3(nsIServiceManager* *result,
|
|||
#endif
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_OS2)
|
||||
NS_TIME_FUNCTION_MARK("Next: startup native charset utils");
|
||||
|
||||
NS_StartupNativeCharsetUtils();
|
||||
#endif
|
||||
NS_TIME_FUNCTION_MARK("Next: startup local file");
|
||||
|
||||
NS_StartupLocalFile();
|
||||
|
||||
StartupSpecialSystemDirectory();
|
||||
|
@ -573,6 +590,8 @@ NS_InitXPCOM3(nsIServiceManager* *result,
|
|||
|
||||
#ifdef MOZ_IPC
|
||||
if ((sCommandLineWasInitialized = !CommandLine::IsInitialized())) {
|
||||
NS_TIME_FUNCTION_MARK("Next: IPC command line init");
|
||||
|
||||
#ifdef OS_WIN
|
||||
CommandLine::Init(0, nsnull);
|
||||
#else
|
||||
|
@ -597,6 +616,8 @@ NS_InitXPCOM3(nsIServiceManager* *result,
|
|||
|
||||
NS_ASSERTION(nsComponentManagerImpl::gComponentManager == NULL, "CompMgr not null at init");
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Next: component manager init");
|
||||
|
||||
// Create the Component/Service Manager
|
||||
nsComponentManagerImpl *compMgr = new nsComponentManagerImpl();
|
||||
if (compMgr == NULL)
|
||||
|
@ -627,6 +648,8 @@ NS_InitXPCOM3(nsIServiceManager* *result,
|
|||
rv = compMgr->RegisterService(kComponentManagerCID, static_cast<nsIComponentManager*>(compMgr));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Next: cycle collector startup");
|
||||
|
||||
rv = nsCycleCollector_startup();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -635,6 +658,8 @@ NS_InitXPCOM3(nsIServiceManager* *result,
|
|||
|
||||
// Category Manager
|
||||
{
|
||||
NS_TIME_FUNCTION_MARK("Next: category manager factory init");
|
||||
|
||||
nsCOMPtr<nsIFactory> categoryManagerFactory;
|
||||
if ( NS_FAILED(rv = NS_CategoryManagerGetFactory(getter_AddRefs(categoryManagerFactory))) )
|
||||
return rv;
|
||||
|
@ -669,24 +694,34 @@ NS_InitXPCOM3(nsIServiceManager* *result,
|
|||
nsSimpleUnicharStreamFactory::GetInstance());
|
||||
}
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Next: interface info manager init");
|
||||
|
||||
// Pay the cost at startup time of starting this singleton.
|
||||
nsIInterfaceInfoManager* iim =
|
||||
xptiInterfaceInfoManager::GetInterfaceInfoManagerNoAddRef();
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Next: try to load compreg.dat");
|
||||
|
||||
// "Re-register the world" if compreg.dat doesn't exist
|
||||
rv = nsComponentManagerImpl::gComponentManager->ReadPersistentRegistry();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_TIME_FUNCTION_MARK("Next: try to register all components (compreg.dat not found)");
|
||||
|
||||
// If the component registry is out of date, malformed, or incomplete,
|
||||
// autoregister the default component directories.
|
||||
(void) iim->AutoRegisterInterfaces();
|
||||
nsComponentManagerImpl::gComponentManager->AutoRegister(nsnull);
|
||||
}
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Next: register category providers");
|
||||
|
||||
// After autoreg, but before we actually instantiate any components,
|
||||
// add any services listed in the "xpcom-directory-providers" category
|
||||
// to the directory service.
|
||||
nsDirectoryService::gService->RegisterCategoryProviders();
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Next: create services from category");
|
||||
|
||||
// Notify observers of xpcom autoregistration start
|
||||
NS_CreateServicesFromCategory(NS_XPCOM_STARTUP_CATEGORY,
|
||||
nsnull,
|
||||
|
|
|
@ -62,6 +62,8 @@
|
|||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
using namespace mozilla;
|
||||
class nsIComponentLoaderManager;
|
||||
|
||||
|
@ -851,6 +853,8 @@ NS_CreateServicesFromCategory(const char *category,
|
|||
nsISupports *origin,
|
||||
const char *observerTopic)
|
||||
{
|
||||
NS_TIME_FUNCTION_FMT("NS_CreateServicesFromCategory: %s (%s)", category, observerTopic ? observerTopic : "(no topic)");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
int nFailed = 0;
|
||||
|
@ -890,11 +894,14 @@ NS_CreateServicesFromCategory(const char *category,
|
|||
continue;
|
||||
}
|
||||
|
||||
NS_TIME_FUNCTION_MARK("service: %s", nsPromiseFlatCString(contractID).get());
|
||||
|
||||
if (observerTopic) {
|
||||
// try an observer, if it implements it.
|
||||
nsCOMPtr<nsIObserver> observer = do_QueryInterface(instance, &rv);
|
||||
if (NS_SUCCEEDED(rv) && observer)
|
||||
observer->Observe(origin, observerTopic, EmptyString().get());
|
||||
NS_TIME_FUNCTION_MARK(" & observe %s", observerTopic);
|
||||
}
|
||||
}
|
||||
return (nFailed ? NS_ERROR_FAILURE : NS_OK);
|
||||
|
|
|
@ -87,6 +87,7 @@
|
|||
#include "private/pprthred.h"
|
||||
#include "nsTArray.h"
|
||||
#include "prio.h"
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
#include "nsInt64.h"
|
||||
#include "nsManifestLineReader.h"
|
||||
|
@ -164,6 +165,20 @@ static void GetIDString(const nsID& aCID, char buf[UID_STRING_LENGTH])
|
|||
(PRUint32) aCID.m3[6], (PRUint32) aCID.m3[7]);
|
||||
}
|
||||
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
#define COMPMGR_TIME_FUNCTION_CID(cid) \
|
||||
char cid_buf__[NSID_LENGTH] = { '\0' }; \
|
||||
cid.ToProvidedString(cid_buf__); \
|
||||
NS_TIME_FUNCTION_MIN_FMT(5, "%s (line %d) (cid: %s)", MOZ_FUNCTION_NAME, \
|
||||
__LINE__, cid_buf__)
|
||||
#define COMPMGR_TIME_FUNCTION_CONTRACTID(cid) \
|
||||
NS_TIME_FUNCTION_MIN_FMT(5, "%s (line %d) (contractid: %s)", MOZ_FUNCTION_NAME, \
|
||||
__LINE__, (cid))
|
||||
#else
|
||||
#define COMPMGR_TIME_FUNCTION_CID(cid) do {} while (0)
|
||||
#define COMPMGR_TIME_FUNCTION_CONTRACTID(cid) do {} while (0)
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
nsGetServiceFromCategory::operator()(const nsIID& aIID, void** aInstancePtr) const
|
||||
{
|
||||
|
@ -604,6 +619,8 @@ nsComponentManagerImpl::nsComponentManagerImpl()
|
|||
nsresult nsComponentManagerImpl::Init(nsStaticModuleInfo const *aStaticModules,
|
||||
PRUint32 aStaticModuleCount)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
PR_ASSERT(mShuttingDown != NS_SHUTDOWN_INPROGRESS);
|
||||
if (mShuttingDown == NS_SHUTDOWN_INPROGRESS)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -616,6 +633,7 @@ nsresult nsComponentManagerImpl::Init(nsStaticModuleInfo const *aStaticModules,
|
|||
}
|
||||
|
||||
// Initialize our arena
|
||||
NS_TIME_FUNCTION_MARK("Next: init component manager arena");
|
||||
PL_INIT_ARENA_POOL(&mArena, "ComponentManagerArena", NS_CM_BLOCK_SIZE);
|
||||
|
||||
if (!mFactories.ops) {
|
||||
|
@ -691,10 +709,12 @@ nsresult nsComponentManagerImpl::Init(nsStaticModuleInfo const *aStaticModules,
|
|||
PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG,
|
||||
("nsComponentManager: Initialized."));
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Next: init native module loader");
|
||||
rv = mNativeModuleLoader.Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Next: init static module loader");
|
||||
rv = mStaticModuleLoader.Init(aStaticModules, aStaticModuleCount);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -704,6 +724,8 @@ nsresult nsComponentManagerImpl::Init(nsStaticModuleInfo const *aStaticModules,
|
|||
|
||||
nsresult nsComponentManagerImpl::Shutdown(void)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
PR_ASSERT(mShuttingDown == NS_SHUTDOWN_NEVERHAPPENED);
|
||||
if (mShuttingDown != NS_SHUTDOWN_NEVERHAPPENED)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -830,6 +852,8 @@ PRBool ReadSectionHeader(nsManifestLineReader& reader, const char *token)
|
|||
nsresult
|
||||
nsComponentManagerImpl::ReadPersistentRegistry()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
NS_ASSERTION(mComponentsDir, "nsComponentManager not initialized.");
|
||||
|
||||
nsresult rv;
|
||||
|
@ -1190,6 +1214,8 @@ nsComponentManagerImpl::WritePersistentRegistry()
|
|||
if (!mRegistryFile)
|
||||
return NS_ERROR_FAILURE; // this should have been set by Init().
|
||||
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsCOMPtr<nsIFile> file;
|
||||
mRegistryFile->Clone(getter_AddRefs(file));
|
||||
if (!file)
|
||||
|
@ -1549,6 +1575,8 @@ nsComponentManagerImpl::CreateInstance(const nsCID &aClass,
|
|||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
COMPMGR_TIME_FUNCTION_CID(aClass);
|
||||
|
||||
// test this first, since there's no point in creating a component during
|
||||
// shutdown -- whether it's available or not would depend on the order it
|
||||
// occurs in the list
|
||||
|
@ -1634,6 +1662,8 @@ nsComponentManagerImpl::CreateInstanceByContractID(const char *aContractID,
|
|||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
COMPMGR_TIME_FUNCTION_CONTRACTID(aContractID);
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aContractID);
|
||||
|
||||
// test this first, since there's no point in creating a component during
|
||||
|
@ -1833,6 +1863,9 @@ nsComponentManagerImpl::GetService(const nsCID& aClass,
|
|||
return supports->QueryInterface(aIID, result);
|
||||
}
|
||||
|
||||
// We only care about time when we create the service.
|
||||
COMPMGR_TIME_FUNCTION_CID(aClass);
|
||||
|
||||
PRThread* currentPRThread = PR_GetCurrentThread();
|
||||
NS_ASSERTION(currentPRThread, "This should never be null!");
|
||||
|
||||
|
@ -1936,6 +1969,8 @@ nsComponentManagerImpl::GetService(const nsCID& aClass,
|
|||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::RegisterService(const nsCID& aClass, nsISupports* aService)
|
||||
{
|
||||
COMPMGR_TIME_FUNCTION_CID(aClass);
|
||||
|
||||
nsAutoMonitor mon(mMon);
|
||||
|
||||
// check to see if we have a factory entry for the service
|
||||
|
@ -1969,6 +2004,8 @@ nsComponentManagerImpl::RegisterService(const nsCID& aClass, nsISupports* aServi
|
|||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::UnregisterService(const nsCID& aClass)
|
||||
{
|
||||
COMPMGR_TIME_FUNCTION_CID(aClass);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsFactoryEntry* entry = nsnull;
|
||||
|
@ -1995,6 +2032,8 @@ NS_IMETHODIMP
|
|||
nsComponentManagerImpl::RegisterService(const char* aContractID,
|
||||
nsISupports* aService)
|
||||
{
|
||||
COMPMGR_TIME_FUNCTION_CONTRACTID(aContractID);
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aContractID);
|
||||
|
||||
nsAutoMonitor mon(mMon);
|
||||
|
@ -2045,6 +2084,8 @@ nsComponentManagerImpl::IsServiceInstantiated(const nsCID & aClass,
|
|||
const nsIID& aIID,
|
||||
PRBool *result)
|
||||
{
|
||||
COMPMGR_TIME_FUNCTION_CID(aClass);
|
||||
|
||||
// Now we want to get the service if we already got it. If not, we don't want
|
||||
// to create an instance of it. mmh!
|
||||
|
||||
|
@ -2087,6 +2128,8 @@ NS_IMETHODIMP nsComponentManagerImpl::IsServiceInstantiatedByContractID(const ch
|
|||
const nsIID& aIID,
|
||||
PRBool *result)
|
||||
{
|
||||
COMPMGR_TIME_FUNCTION_CONTRACTID(aContractID);
|
||||
|
||||
// Now we want to get the service if we already got it. If not, we don't want
|
||||
// to create an instance of it. mmh!
|
||||
|
||||
|
@ -2131,6 +2174,8 @@ NS_IMETHODIMP nsComponentManagerImpl::IsServiceInstantiatedByContractID(const ch
|
|||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::UnregisterService(const char* aContractID)
|
||||
{
|
||||
COMPMGR_TIME_FUNCTION_CONTRACTID(aContractID);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsAutoMonitor mon(mMon);
|
||||
|
@ -2196,6 +2241,9 @@ nsComponentManagerImpl::GetServiceByContractID(const char* aContractID,
|
|||
return serviceObject->QueryInterface(aIID, result);
|
||||
}
|
||||
|
||||
// We only care about time when we create the service.
|
||||
COMPMGR_TIME_FUNCTION_CONTRACTID(aContractID);
|
||||
|
||||
PRThread* currentPRThread = PR_GetCurrentThread();
|
||||
NS_ASSERTION(currentPRThread, "This should never be null!");
|
||||
|
||||
|
@ -2305,6 +2353,8 @@ NS_IMETHODIMP
|
|||
nsComponentManagerImpl::RegistryLocationForSpec(nsIFile *aSpec,
|
||||
char **aRegistryName)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsCAutoString location;
|
||||
nsresult rv = RegistryLocationForFile(aSpec, location);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -2320,6 +2370,8 @@ nsresult
|
|||
nsComponentManagerImpl::RegistryLocationForFile(nsIFile* aFile,
|
||||
nsCString& aRegistryName)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (!mComponentsDir)
|
||||
|
@ -2379,6 +2431,8 @@ nsresult
|
|||
nsComponentManagerImpl::FileForRegistryLocation(const nsCString &aLocation,
|
||||
nsILocalFile **aSpec)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
// i18n: assuming aLocation is encoded for the current locale
|
||||
|
||||
nsresult rv;
|
||||
|
@ -2453,6 +2507,8 @@ nsComponentManagerImpl::RegisterFactory(const nsCID &aClass,
|
|||
nsIFactory *aFactory,
|
||||
PRBool aReplace)
|
||||
{
|
||||
COMPMGR_TIME_FUNCTION_CID(aClass);
|
||||
|
||||
nsAutoMonitor mon(mMon);
|
||||
#ifdef PR_LOGGING
|
||||
if (PR_LOG_TEST(nsComponentManagerLog, PR_LOG_WARNING))
|
||||
|
@ -2609,6 +2665,8 @@ nsComponentManagerImpl::RegisterComponentCommon(const nsCID &aClass,
|
|||
PRBool aPersist,
|
||||
const char *aType)
|
||||
{
|
||||
COMPMGR_TIME_FUNCTION_CONTRACTID(aContractID);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsAutoMonitor mon(mMon);
|
||||
|
@ -2713,6 +2771,8 @@ nsComponentManagerImpl::LoaderForType(LoaderType aType)
|
|||
void
|
||||
nsComponentManagerImpl::GetAllLoaders()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
NS_ASSERTION(mCategoryManager, "nsComponentManager used uninitialized");
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> loaderEnum;
|
||||
|
@ -2818,6 +2878,8 @@ nsresult
|
|||
nsComponentManagerImpl::UnregisterFactory(const nsCID &aClass,
|
||||
nsIFactory *aFactory)
|
||||
{
|
||||
COMPMGR_TIME_FUNCTION_CID(aClass);
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (PR_LOG_TEST(nsComponentManagerLog, PR_LOG_WARNING))
|
||||
{
|
||||
|
@ -2928,6 +2990,8 @@ nsComponentManagerImpl::AutoRegisterDirectory(nsIFile *inDirSpec,
|
|||
nsCOMArray<nsILocalFile> &aLeftovers,
|
||||
nsTArray<DeferredModule> &aDeferred)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIFile> componentsList;
|
||||
|
@ -2986,6 +3050,8 @@ nsComponentManagerImpl::AutoRegisterComponentsList(nsIFile* inDir,
|
|||
nsCOMArray<nsILocalFile>& aLeftovers,
|
||||
nsTArray<DeferredModule>& aDeferred)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
PRFileInfo info;
|
||||
if (PR_SUCCESS != PR_GetOpenFileInfo(fd, &info))
|
||||
return NS_ErrorAccordingToNSPR();
|
||||
|
@ -3050,6 +3116,8 @@ nsComponentManagerImpl::AutoRegisterComponent(nsILocalFile* aComponentFile,
|
|||
nsTArray<DeferredModule> &aDeferred,
|
||||
LoaderType minLoader)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
NS_ASSERTION(minLoader < GetLoaderCount(), "Bad minLoader");
|
||||
|
@ -3217,6 +3285,8 @@ NS_IMETHODIMP
|
|||
nsComponentManagerImpl::AutoUnregisterComponent(PRInt32 /* unused */,
|
||||
nsIFile *component)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
GetAllLoaders();
|
||||
|
@ -3272,6 +3342,8 @@ nsComponentManagerImpl::IsRegistered(const nsCID &aClass,
|
|||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::EnumerateCLSIDs(nsIEnumerator** aEnumerator)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
NS_ASSERTION(aEnumerator != nsnull, "null ptr");
|
||||
if (!aEnumerator)
|
||||
{
|
||||
|
@ -3296,6 +3368,8 @@ nsComponentManagerImpl::EnumerateCLSIDs(nsIEnumerator** aEnumerator)
|
|||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::EnumerateContractIDs(nsIEnumerator** aEnumerator)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
NS_ASSERTION(aEnumerator != nsnull, "null ptr");
|
||||
if (!aEnumerator)
|
||||
{
|
||||
|
@ -3349,6 +3423,8 @@ ReportLoadFailure(nsIFile* aFile, nsIConsoleService* aCS)
|
|||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::AutoRegister(nsIFile *aSpec)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (!mCategoryManager) {
|
||||
|
@ -3542,6 +3618,8 @@ nsComponentManagerImpl::IsContractIDRegistered(const char *aClass,
|
|||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::EnumerateCIDs(nsISimpleEnumerator **aEnumerator)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
NS_ASSERTION(aEnumerator != nsnull, "null ptr");
|
||||
|
||||
if (!aEnumerator)
|
||||
|
@ -3565,6 +3643,8 @@ nsComponentManagerImpl::EnumerateCIDs(nsISimpleEnumerator **aEnumerator)
|
|||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::EnumerateContractIDs(nsISimpleEnumerator **aEnumerator)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
NS_ASSERTION(aEnumerator != nsnull, "null ptr");
|
||||
if (!aEnumerator)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsDependentString.h"
|
||||
#include "nsString.h"
|
||||
#include "nsArrayEnumerator.h"
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
|
||||
#define NS_ZIPLOADER_CONTRACTID NS_XPTLOADER_CONTRACTID_PREFIX "zip"
|
||||
|
||||
|
@ -61,6 +62,9 @@ xptiInterfaceInfoManager::GetInterfaceInfoManagerNoAddRef()
|
|||
{
|
||||
if(!gInterfaceInfoManager)
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Next: build file search path");
|
||||
nsCOMPtr<nsISupportsArray> searchPath;
|
||||
BuildFileSearchPath(getter_AddRefs(searchPath));
|
||||
if(!searchPath)
|
||||
|
@ -84,6 +88,7 @@ xptiInterfaceInfoManager::GetInterfaceInfoManagerNoAddRef()
|
|||
}
|
||||
else
|
||||
{
|
||||
NS_TIME_FUNCTION_MARK("Next: read xpti manifest");
|
||||
PRBool mustAutoReg =
|
||||
!xptiManifest::Read(gInterfaceInfoManager,
|
||||
&gInterfaceInfoManager->mWorkingSet);
|
||||
|
@ -97,8 +102,10 @@ xptiInterfaceInfoManager::GetInterfaceInfoManagerNoAddRef()
|
|||
mustAutoReg = PR_TRUE;
|
||||
}
|
||||
#endif // DEBUG
|
||||
if(mustAutoReg)
|
||||
if(mustAutoReg) {
|
||||
NS_TIME_FUNCTION_MARK("Next: auto register interfaces");
|
||||
gInterfaceInfoManager->AutoRegisterInterfaces();
|
||||
}
|
||||
}
|
||||
}
|
||||
return gInterfaceInfoManager;
|
||||
|
@ -1884,6 +1891,8 @@ NS_IMETHODIMP xptiInterfaceInfoManager::EnumerateInterfacesWhoseNamesStartWith(c
|
|||
/* void autoRegisterInterfaces (); */
|
||||
NS_IMETHODIMP xptiInterfaceInfoManager::AutoRegisterInterfaces()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
|
||||
nsCOMPtr<nsISupportsArray> fileList;
|
||||
AutoRegMode mode;
|
||||
PRBool ok;
|
||||
|
@ -1902,17 +1911,20 @@ NS_IMETHODIMP xptiInterfaceInfoManager::AutoRegisterInterfaces()
|
|||
// We re-read the manifest rather than muck with the 'live' one.
|
||||
// It is OK if this fails.
|
||||
// XXX But we should track failure as a warning.
|
||||
NS_TIME_FUNCTION_MARK("Next: read the manifest");
|
||||
ok = xptiManifest::Read(this, &workingSet);
|
||||
|
||||
LOG_AUTOREG(("read of manifest %s\n", ok ? "successful" : "FAILED"));
|
||||
|
||||
// Grovel for all the typelibs we can find (in .xpt or .zip, .jar,...).
|
||||
NS_TIME_FUNCTION_MARK("Next: build file list");
|
||||
if(!BuildFileList(mSearchPath, getter_AddRefs(fileList)) || !fileList)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
// DEBUG_DumpFileList(fileList);
|
||||
|
||||
// Check to see how much work we need to do.
|
||||
NS_TIME_FUNCTION_MARK("Next: determining registration strategy");
|
||||
mode = DetermineAutoRegStrategy(mSearchPath, fileList, &workingSet);
|
||||
|
||||
switch(mode)
|
||||
|
@ -1923,6 +1935,7 @@ NS_IMETHODIMP xptiInterfaceInfoManager::AutoRegisterInterfaces()
|
|||
return NS_OK;
|
||||
case FILES_ADDED_ONLY:
|
||||
LOG_AUTOREG(("autoreg strategy: files added only\n"));
|
||||
NS_TIME_FUNCTION_MARK("Next: adding only new files");
|
||||
if(!AddOnlyNewFilesFromFileList(mSearchPath, fileList, &workingSet))
|
||||
{
|
||||
LOG_AUTOREG(("FAILED to add new files\n"));
|
||||
|
@ -1931,6 +1944,7 @@ NS_IMETHODIMP xptiInterfaceInfoManager::AutoRegisterInterfaces()
|
|||
break;
|
||||
case FULL_VALIDATION_REQUIRED:
|
||||
LOG_AUTOREG(("autoreg strategy: doing full validation merge\n"));
|
||||
NS_TIME_FUNCTION_MARK("Next: full validation merge");
|
||||
if(!DoFullValidationMergeFromFileList(mSearchPath, fileList, &workingSet))
|
||||
{
|
||||
LOG_AUTOREG(("FAILED to do full validation\n"));
|
||||
|
@ -1947,12 +1961,14 @@ NS_IMETHODIMP xptiInterfaceInfoManager::AutoRegisterInterfaces()
|
|||
// xpt files. This will make that startup slower. If this ever becomes a
|
||||
// chronic problem for anyone, then we'll want to figure out why!
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Next: writing manifest");
|
||||
if(!xptiManifest::Write(this, &workingSet))
|
||||
{
|
||||
LOG_AUTOREG(("FAILED to write manifest\n"));
|
||||
NS_ERROR("Failed to write xpti manifest!");
|
||||
}
|
||||
|
||||
NS_TIME_FUNCTION_MARK("Next: merging working sets");
|
||||
if(!MergeWorkingSets(&mWorkingSet, &workingSet))
|
||||
{
|
||||
LOG_AUTOREG(("FAILED to merge into live workingset\n"));
|
||||
|
|
|
@ -46,6 +46,15 @@
|
|||
#include "prlog.h"
|
||||
#include "nsThreadUtilsInternal.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
#if defined(NS_FUNCTION_TIMER) && defined(_MSC_VER)
|
||||
#include "nsTimerImpl.h"
|
||||
#include "nsStackWalk.h"
|
||||
#endif
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
#include "nsCRT.h"
|
||||
#endif
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
static PRLogModuleInfo *sLog = PR_NewLogModule("nsThread");
|
||||
#endif
|
||||
|
@ -520,6 +529,17 @@ nsThread::ProcessNextEvent(PRBool mayWait, PRBool *result)
|
|||
nsCOMPtr<nsIRunnable> event;
|
||||
mEvents->GetEvent(mayWait && !ShuttingDown(), getter_AddRefs(event));
|
||||
|
||||
#ifdef NS_FUNCTION_TIMER
|
||||
char message[1024] = {'\0'};
|
||||
if (NS_IsMainThread()) {
|
||||
mozilla::FunctionTimer::ft_snprintf(message, sizeof(message),
|
||||
"@ Main Thread Event %p", (void*)event.get());
|
||||
}
|
||||
// If message is empty, it means that we're not on the main thread, and
|
||||
// FunctionTimer won't time this function.
|
||||
NS_TIME_FUNCTION_MIN_FMT(5.0, message);
|
||||
#endif
|
||||
|
||||
*result = (event.get() != nsnull);
|
||||
|
||||
if (event) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче