Bug 1431483 - Add a pseudo stack frame with the image URL to ImageLoader::Notify. r?aosmond
MozReview-Commit-ID: F3KU0qpmHx6
--- 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);