Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save juliandescottes/426543b08e8b0fedfe17f6a83a707e3a to your computer and use it in GitHub Desktop.

Select an option

Save juliandescottes/426543b08e8b0fedfe17f6a83a707e3a to your computer and use it in GitHub Desktop.
Adding profiler markers with MarkerStack::Capture to investigate bug 2051594
diff --git a/uriloader/base/nsDocLoader.cpp b/uriloader/base/nsDocLoader.cpp
index 524451a83e03..6f3e7f7b83fd 100644
--- a/uriloader/base/nsDocLoader.cpp
+++ b/uriloader/base/nsDocLoader.cpp
@@ -42,6 +42,7 @@
#include "nsIBrowserDOMWindow.h"
#include "mozilla/ThrottledEventQueue.h"
#include "mozilla/ClearOnShutdown.h"
+#include "GeckoProfiler.h"
using namespace mozilla;
using mozilla::DebugOnly;
@@ -802,6 +803,16 @@ void nsDocLoader::DocLoaderIsEmpty(bool aFlushLayout,
// Update the progress status state - the document is done
mProgressStateFlags = nsIWebProgressListener::STATE_STOP;
+ {
+ nsAutoCString uriString;
+ if (docRequest) {
+ docRequest->GetName(uriString);
+ }
+ PROFILER_MARKER_TEXT("nsDocLoader::DocLoaderIsEmpty (STATE_STOP)",
+ NETWORK, MarkerOptions(MarkerStack::Capture()),
+ uriString);
+ }
+
nsresult loadGroupStatus = NS_OK;
if (aOverrideStatus) {
loadGroupStatus = *aOverrideStatus;
@@ -944,7 +955,6 @@ void nsDocLoader::NotifyDoneWithOnload(nsDocLoader* aParent) {
void nsDocLoader::doStartDocumentLoad(void) {
#if defined(DEBUG)
nsAutoCString buffer;
-
GetURIStringFromRequest(mDocumentRequest, buffer);
MOZ_LOG(
gDocLoaderLog, LogLevel::Debug,
@@ -953,6 +963,13 @@ void nsDocLoader::doStartDocumentLoad(void) {
this, buffer.get()));
#endif /* DEBUG */
+ nsAutoCString uriString;
+ if (mDocumentRequest) {
+ mDocumentRequest->GetName(uriString);
+ }
+ PROFILER_MARKER_TEXT("nsDocLoader::doStartDocumentLoad", NETWORK,
+ MarkerOptions(MarkerStack::Capture()), uriString);
+
// Fire an OnStatus(...) notification STATE_START. This indicates
// that the document represented by mDocumentRequest has started to
// load...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment