Bug 1431483 - Add a pseudo stack frame with the image URL to ImageLoader::Notify. r=aosmond
authorMarkus Stange <mstange@themasta.com>
Thu, 18 Jan 2018 14:02:30 -0500
changeset 399897 16f5b0c6d4b416716fcf68c6af679c5882a6bd08
parent 399841 c480ace58f385f656603e2801659899091e9ad6d
child 399898 f23d6c1dc0193190bbec8983750ea49a139cb38f
push id33281
push usernerli@mozilla.com
push dateFri, 19 Jan 2018 10:08:27 +0000
treeherdermozilla-central@3af31d84214f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaosmond
bugs1431483
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1431483 - Add a pseudo stack frame with the image URL to ImageLoader::Notify. r=aosmond MozReview-Commit-ID: F3KU0qpmHx6
layout/style/ImageLoader.cpp
--- a/layout/style/ImageLoader.cpp
+++ b/layout/style/ImageLoader.cpp
@@ -13,16 +13,17 @@
 #include "nsContentUtils.h"
 #include "nsLayoutUtils.h"
 #include "nsError.h"
 #include "nsDisplayList.h"
 #include "FrameLayerBuilder.h"
 #include "SVGObserverUtils.h"
 #include "imgIContainer.h"
 #include "Image.h"
+#include "GeckoProfiler.h"
 
 namespace mozilla {
 namespace css {
 
 void
 ImageLoader::DropDocumentReference()
 {
   // It's okay if GetPresContext returns null here (due to the presshell pointer
@@ -389,16 +390,29 @@ NS_IMPL_RELEASE(ImageLoader)
 
 NS_INTERFACE_MAP_BEGIN(ImageLoader)
   NS_INTERFACE_MAP_ENTRY(imgINotificationObserver)
 NS_INTERFACE_MAP_END
 
 NS_IMETHODIMP
 ImageLoader::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aData)
 {
+#ifdef MOZ_GECKO_PROFILER
+  nsCString uriString;
+  if (profiler_is_active()) {
+    nsCOMPtr<nsIURI> uri;
+    aRequest->GetFinalURI(getter_AddRefs(uri));
+    if (uri) {
+      uri->GetSpec(uriString);
+    }
+  }
+
+  AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING("ImageLoader::Notify", OTHER, uriString);
+#endif
+
   if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
     nsCOMPtr<imgIContainer> image;
     aRequest->GetImage(getter_AddRefs(image));
     return OnSizeAvailable(aRequest, image);
   }
 
   if (aType == imgINotificationObserver::IS_ANIMATED) {
     return OnImageIsAnimated(aRequest);