From 2e1e2ae3c5dc1da3dbb5b8af59a33b30507969f8 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Tue, 17 Jan 2012 15:15:47 -0800 Subject: [PATCH] Back out 88733ce1bef3 (bug 718440) because of Windows build failure --- content/base/src/nsXMLHttpRequest.cpp | 1 - content/base/src/nsXMLHttpRequest.h | 1 - gfx/gl/GLContextProviderCGL.mm | 2 -- gfx/layers/opengl/LayerManagerOGL.cpp | 3 --- image/src/imgFrame.cpp | 2 -- layout/base/nsLayoutUtils.cpp | 3 --- layout/generic/nsObjectFrame.cpp | 6 ------ netwerk/base/src/nsInputStreamPump.cpp | 5 +---- netwerk/base/src/nsStreamLoader.cpp | 2 -- netwerk/protocol/http/nsHttpChannel.cpp | 3 --- parser/html/nsHtml5TreeOpExecutor.cpp | 2 -- storage/src/mozStorageConnection.cpp | 3 --- storage/src/mozStorageStatement.cpp | 2 -- .../components/places/nsAnnotationService.cpp | 3 --- toolkit/components/places/nsNavBookmarks.cpp | 5 ----- tools/profiler/sampler.h | 9 ++++++++- tools/profiler/sps/sps_sampler.h | 17 ++--------------- view/src/nsViewManager.cpp | 2 +- widget/cocoa/nsAppShell.mm | 3 +-- widget/cocoa/nsChildView.mm | 3 --- 20 files changed, 13 insertions(+), 64 deletions(-) diff --git a/content/base/src/nsXMLHttpRequest.cpp b/content/base/src/nsXMLHttpRequest.cpp index 838cec790dc..9707efa6b4a 100644 --- a/content/base/src/nsXMLHttpRequest.cpp +++ b/content/base/src/nsXMLHttpRequest.cpp @@ -2017,7 +2017,6 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt) NS_IMETHODIMP nsXMLHttpRequest::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status) { - SAMPLE_LABEL("content", "nsXMLHttpRequest::OnStopRequest"); if (!IsSameOrBaseChannel(request, mChannel)) { return NS_OK; } diff --git a/content/base/src/nsXMLHttpRequest.h b/content/base/src/nsXMLHttpRequest.h index 7911d2cb112..620b1005558 100644 --- a/content/base/src/nsXMLHttpRequest.h +++ b/content/base/src/nsXMLHttpRequest.h @@ -65,7 +65,6 @@ #include "nsDOMProgressEvent.h" #include "nsDOMEventTargetWrapperCache.h" #include "nsContentUtils.h" -#include "sampler.h" class nsILoadGroup; class AsyncVerifyRedirectCallbackForwarder; diff --git a/gfx/gl/GLContextProviderCGL.mm b/gfx/gl/GLContextProviderCGL.mm index a5d2c203a0b..2953d9f4e67 100644 --- a/gfx/gl/GLContextProviderCGL.mm +++ b/gfx/gl/GLContextProviderCGL.mm @@ -47,7 +47,6 @@ #include "gfxFailure.h" #include "prenv.h" #include "mozilla/Preferences.h" -#include "sampler.h" namespace mozilla { namespace gl { @@ -196,7 +195,6 @@ public: bool SwapBuffers() { - SAMPLE_LABEL("GLContext", "SwapBuffers"); [mContext flushBuffer]; return true; } diff --git a/gfx/layers/opengl/LayerManagerOGL.cpp b/gfx/layers/opengl/LayerManagerOGL.cpp index 501083f7356..087b727dbbb 100644 --- a/gfx/layers/opengl/LayerManagerOGL.cpp +++ b/gfx/layers/opengl/LayerManagerOGL.cpp @@ -64,8 +64,6 @@ #include "gfxCrashReporterUtils.h" -#include "sampler.h" - namespace mozilla { namespace layers { @@ -760,7 +758,6 @@ LayerManagerOGL::BindAndDrawQuadWithTextureRect(LayerProgram *aProg, void LayerManagerOGL::Render() { - SAMPLE_LABEL("LayerManagerOGL", "Render"); if (mDestroyed) { NS_WARNING("Call on destroyed layer manager"); return; diff --git a/image/src/imgFrame.cpp b/image/src/imgFrame.cpp index 21e8172cff2..ea4fbd158a4 100644 --- a/image/src/imgFrame.cpp +++ b/image/src/imgFrame.cpp @@ -49,7 +49,6 @@ static bool gDisableOptimize = false; #include "cairo.h" -#include "sampler.h" #if defined(XP_WIN) @@ -436,7 +435,6 @@ void imgFrame::Draw(gfxContext *aContext, gfxPattern::GraphicsFilter aFilter, const gfxMatrix &aUserSpaceToImageSpace, const gfxRect& aFill, const nsIntMargin &aPadding, const nsIntRect &aSubimage) { - SAMPLE_LABEL("image", "imgFrame::Draw"); NS_ASSERTION(!aFill.IsEmpty(), "zero dest size --- fix caller"); NS_ASSERTION(!aSubimage.IsEmpty(), "zero source size --- fix caller"); NS_ASSERTION(!mPalettedImageData, "Directly drawing a paletted image!"); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index bec0cb79e0f..641cc91cb44 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -116,8 +116,6 @@ #include "nsXULPopupManager.h" #endif -#include "sampler.h" - using namespace mozilla; using namespace mozilla::layers; using namespace mozilla::dom; @@ -3632,7 +3630,6 @@ nsLayoutUtils::DrawBackgroundImage(nsRenderingContext* aRenderingContext, const nsRect& aDirty, PRUint32 aImageFlags) { - SAMPLE_LABEL("layout", "nsLayoutUtils::DrawBackgroundImage"); return DrawImageInternal(aRenderingContext, aImage, aGraphicsFilter, aDest, aFill, aAnchor, aDirty, aImageSize, aImageFlags); diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index 88573fa2bbf..ee61cb85893 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -111,7 +111,6 @@ #include "nsIObserverService.h" #include "nsIScrollableFrame.h" #include "mozilla/Preferences.h" -#include "sampler.h" // headers for plugin scriptability #include "nsIScriptGlobalObject.h" @@ -699,7 +698,6 @@ nsObjectFrame::InstantiatePlugin(nsPluginHost* aPluginHost, const char* aMimeType, nsIURI* aURI) { - SAMPLE_LABEL("nsObjectFrame", "InstantiatePlugin"); NS_ASSERTION(mPreventInstantiation, "Instantiation should be prevented here!"); @@ -2152,7 +2150,6 @@ nsObjectFrame::PrepareInstanceOwner() nsresult nsObjectFrame::Instantiate(nsIChannel* aChannel, nsIStreamListener** aStreamListener) { - SAMPLE_LABEL("plugin", "nsObjectFrame::Instantiate"); if (mPreventInstantiation) { return NS_OK; } @@ -2203,7 +2200,6 @@ nsObjectFrame::Instantiate(nsIChannel* aChannel, nsIStreamListener** aStreamList nsresult nsObjectFrame::Instantiate(const char* aMimeType, nsIURI* aURI) { - SAMPLE_LABEL("plugin", "nsObjectFrame::Instantiate"); PR_LOG(nsObjectFrameLM, PR_LOG_DEBUG, ("nsObjectFrame::Instantiate(%s) called on frame %p\n", aMimeType, this)); @@ -2352,7 +2348,6 @@ DoDelayedStop(nsPluginInstanceOwner *aInstanceOwner, bool aDelayedStop) static void DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, bool aDelayedStop) { - SAMPLE_LABEL("plugin", "DoStopPlugin"); nsRefPtr inst; aInstanceOwner->GetInstance(getter_AddRefs(inst)); if (inst) { @@ -2395,7 +2390,6 @@ nsStopPluginRunnable::Notify(nsITimer *aTimer) NS_IMETHODIMP nsStopPluginRunnable::Run() { - SAMPLE_LABEL("plugin", "nsStopPluginRunnable::Run"); // InitWithCallback calls Release before AddRef so we need to hold a // strong ref on 'this' since we fall through to this scope if it fails. nsCOMPtr kungFuDeathGrip = this; diff --git a/netwerk/base/src/nsInputStreamPump.cpp b/netwerk/base/src/nsInputStreamPump.cpp index 30cd8642eb4..f4cdb0918a9 100644 --- a/netwerk/base/src/nsInputStreamPump.cpp +++ b/netwerk/base/src/nsInputStreamPump.cpp @@ -383,7 +383,7 @@ nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream *stream) { LOG(("nsInputStreamPump::OnInputStreamReady [this=%x]\n", this)); - SAMPLE_LABEL("Input", "nsInputStreamPump::OnInputStreamReady"); + SAMPLE_LABEL("Input", "OnInputStreamReady"); // this function has been called from a PLEvent, so we can safely call // any listener or progress sink methods directly from here. @@ -426,7 +426,6 @@ nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream *stream) PRUint32 nsInputStreamPump::OnStateStart() { - SAMPLE_LABEL("nsInputStreamPump", "OnStateStart"); LOG((" OnStateStart [this=%x]\n", this)); nsresult rv; @@ -454,7 +453,6 @@ nsInputStreamPump::OnStateStart() PRUint32 nsInputStreamPump::OnStateTransfer() { - SAMPLE_LABEL("Input", "nsInputStreamPump::OnStateTransfer"); LOG((" OnStateTransfer [this=%x]\n", this)); // if canceled, go directly to STATE_STOP... @@ -564,7 +562,6 @@ nsInputStreamPump::OnStateTransfer() PRUint32 nsInputStreamPump::OnStateStop() { - SAMPLE_LABEL("Input", "nsInputStreamPump::OnStateTransfer"); LOG((" OnStateStop [this=%x status=%x]\n", this, mStatus)); // if an error occurred, we must be sure to pass the error onto the async diff --git a/netwerk/base/src/nsStreamLoader.cpp b/netwerk/base/src/nsStreamLoader.cpp index 1500d220870..9bf01840035 100644 --- a/netwerk/base/src/nsStreamLoader.cpp +++ b/netwerk/base/src/nsStreamLoader.cpp @@ -39,7 +39,6 @@ #include "nsIInputStream.h" #include "nsIChannel.h" #include "nsNetError.h" -#include "sampler.h" nsStreamLoader::nsStreamLoader() : mData(nsnull), @@ -119,7 +118,6 @@ NS_IMETHODIMP nsStreamLoader::OnStopRequest(nsIRequest* request, nsISupports *ctxt, nsresult aStatus) { - SAMPLE_LABEL("network", "nsStreamLoader::OnStopRequest"); if (mObserver) { // provide nsIStreamLoader::request during call to OnStreamComplete mRequest = request; diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 915871ee8ed..e0195f2d95a 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -69,7 +69,6 @@ #include "mozilla/Telemetry.h" #include "nsDOMError.h" #include "nsAlgorithm.h" -#include "sampler.h" using namespace mozilla; @@ -4214,7 +4213,6 @@ nsHttpChannel::ContinueOnStartRequest3(nsresult result) NS_IMETHODIMP nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult status) { - SAMPLE_LABEL("network", "nsHttpChannel::OnStopRequest"); LOG(("nsHttpChannel::OnStopRequest [this=%p request=%p status=%x]\n", this, request, status)); @@ -4390,7 +4388,6 @@ nsHttpChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *input, PRUint32 offset, PRUint32 count) { - SAMPLE_LABEL("network", "nsHttpChannel::OnDataAvailable"); LOG(("nsHttpChannel::OnDataAvailable [this=%p request=%p offset=%u count=%u]\n", this, request, offset, count)); diff --git a/parser/html/nsHtml5TreeOpExecutor.cpp b/parser/html/nsHtml5TreeOpExecutor.cpp index 09b58170b7b..d0f958780af 100644 --- a/parser/html/nsHtml5TreeOpExecutor.cpp +++ b/parser/html/nsHtml5TreeOpExecutor.cpp @@ -59,7 +59,6 @@ #include "nsHtml5StreamParser.h" #include "mozilla/css/Loader.h" #include "mozilla/Util.h" // DebugOnly -#include "sampler.h" using namespace mozilla; @@ -427,7 +426,6 @@ class nsHtml5FlushLoopGuard void nsHtml5TreeOpExecutor::RunFlushLoop() { - SAMPLE_LABEL("html5", "RunFlushLoop"); if (mRunFlushLoopOnStack) { // There's already a RunFlushLoop() on the call stack. return; diff --git a/storage/src/mozStorageConnection.cpp b/storage/src/mozStorageConnection.cpp index 99ae8cdfca7..f46bd0ee149 100644 --- a/storage/src/mozStorageConnection.cpp +++ b/storage/src/mozStorageConnection.cpp @@ -71,7 +71,6 @@ #include "SQLCollations.h" #include "FileSystemModule.h" #include "mozStorageHelper.h" -#include "sampler.h" #include "prlog.h" #include "prprf.h" @@ -609,7 +608,6 @@ Connection::initialize(nsIFile *aDatabaseFile, const char* aVFSName) { NS_ASSERTION (!mDBConn, "Initialize called on already opened database!"); - SAMPLE_LABEL("storage", "Connection::initialize"); int srv; nsresult rv; @@ -1030,7 +1028,6 @@ NS_IMETHODIMP Connection::Clone(bool aReadOnly, mozIStorageConnection **_connection) { - SAMPLE_LABEL("storage", "Connection::Clone"); if (!mDBConn) return NS_ERROR_NOT_INITIALIZED; if (!mDatabaseFile) diff --git a/storage/src/mozStorageStatement.cpp b/storage/src/mozStorageStatement.cpp index a0e767e9815..fa930e5c85f 100644 --- a/storage/src/mozStorageStatement.cpp +++ b/storage/src/mozStorageStatement.cpp @@ -58,7 +58,6 @@ #include "mozStorageStatementParams.h" #include "mozStorageStatementRow.h" #include "mozStorageStatement.h" -#include "sampler.h" #include "prlog.h" @@ -588,7 +587,6 @@ Statement::Execute() NS_IMETHODIMP Statement::ExecuteStep(bool *_moreResults) { - SAMPLE_LABEL("storage", "Statement::ExecuteStep"); if (!mDBStatement) return NS_ERROR_NOT_INITIALIZED; diff --git a/toolkit/components/places/nsAnnotationService.cpp b/toolkit/components/places/nsAnnotationService.cpp index 6c9eb49a140..dd8fb335577 100644 --- a/toolkit/components/places/nsAnnotationService.cpp +++ b/toolkit/components/places/nsAnnotationService.cpp @@ -54,8 +54,6 @@ #include "nsVariant.h" #include "mozilla/storage.h" -#include "sampler.h" - using namespace mozilla; #define ENSURE_ANNO_TYPE(_type, _statement) \ @@ -238,7 +236,6 @@ nsAnnotationService::SetItemAnnotation(PRInt64 aItemId, PRInt32 aFlags, PRUint16 aExpiration) { - SAMPLE_LABEL("AnnotationService", "SetItemAnnotation"); NS_ENSURE_ARG_MIN(aItemId, 1); NS_ENSURE_ARG(aValue); diff --git a/toolkit/components/places/nsNavBookmarks.cpp b/toolkit/components/places/nsNavBookmarks.cpp index 00260c3ee59..6c9c941da41 100644 --- a/toolkit/components/places/nsNavBookmarks.cpp +++ b/toolkit/components/places/nsNavBookmarks.cpp @@ -57,8 +57,6 @@ #include "mozilla/FunctionTimer.h" #include "mozilla/Util.h" -#include "sampler.h" - #define BOOKMARKS_TO_KEYWORDS_INITIAL_CACHE_SIZE 64 #define RECENT_BOOKMARKS_INITIAL_CACHE_SIZE 10 // Threashold to expire old bookmarks if the initial cache size is exceeded. @@ -683,7 +681,6 @@ nsNavBookmarks::InsertBookmark(PRInt64 aFolder, NS_IMETHODIMP nsNavBookmarks::RemoveItem(PRInt64 aItemId) { - SAMPLE_LABEL("bookmarks", "RemoveItem"); NS_ENSURE_ARG(aItemId != mRoot); BookmarkData bookmark; @@ -1135,7 +1132,6 @@ nsNavBookmarks::GetDescendantChildren(PRInt64 aFolderId, NS_IMETHODIMP nsNavBookmarks::RemoveFolderChildren(PRInt64 aFolderId) { - SAMPLE_LABEL("bookmarks", "RemoveFolderChilder"); NS_ENSURE_ARG_MIN(aFolderId, 1); BookmarkData folder; @@ -2755,7 +2751,6 @@ nsNavBookmarks::EnsureKeywordsHash() { NS_IMETHODIMP nsNavBookmarks::RunInBatchMode(nsINavHistoryBatchCallback* aCallback, nsISupports* aUserData) { - SAMPLE_LABEL("bookmarks", "RunInBatchMode"); NS_ENSURE_ARG(aCallback); mBatching = true; diff --git a/tools/profiler/sampler.h b/tools/profiler/sampler.h index 752d9fae15e..38896f9c22f 100644 --- a/tools/profiler/sampler.h +++ b/tools/profiler/sampler.h @@ -77,6 +77,14 @@ #ifndef SAMPLER_H #define SAMPLER_H +#if defined(_MSC_VER) +#define FULLFUNCTION __FUNCSIG__ +#elif (__GNUC__ >= 4) +#define FULLFUNCTION __PRETTY_FUNCTION__ +#else +#define FULLFUNCTION __FUNCTION__ +#endif + // Redefine the macros for platforms where SPS is supported. #if defined(ANDROID) || defined(__linux__) || defined(XP_MACOSX) || defined(XP_WIN) @@ -98,7 +106,6 @@ #define SAMPLER_GET_RESPONSIVENESS() NULL #define SAMPLER_GET_FEATURES() NULL #define SAMPLE_LABEL(name_space, info) -#define SAMPLE_LABEL_FN(name_space, info) #define SAMPLE_MARKER(info) #endif diff --git a/tools/profiler/sps/sps_sampler.h b/tools/profiler/sps/sps_sampler.h index 6d60b3eb9a1..7d51752c5cb 100644 --- a/tools/profiler/sps/sps_sampler.h +++ b/tools/profiler/sps/sps_sampler.h @@ -49,16 +49,6 @@ extern mozilla::tls::key pkey_stack; extern mozilla::tls::key pkey_ticker; extern bool stack_key_initialized; -#ifndef SAMPLE_FUNCTION_NAME -# ifdef __GNUC__ -# define SAMPLE_FUNCTION_NAME __FUNCTION__ -# elif defined(_MSC_VER) -# define SAMPLE_FUNCTION_NAME __FUNCTION__ -# else -# define SAMPLE_FUNCTION_NAME __func__ // defined in C99, supported in various C++ compilers. Just raw function name. -# endif -#endif - #define SAMPLER_INIT() mozilla_sampler_init() #define SAMPLER_DEINIT() mozilla_sampler_deinit() #define SAMPLER_START(entries, interval, features, featureCount) mozilla_sampler_start(entries, interval, features, featureCount) @@ -69,9 +59,7 @@ extern bool stack_key_initialized; #define SAMPLER_SAVE() mozilla_sampler_save() #define SAMPLER_GET_PROFILE() mozilla_sampler_get_profile() #define SAMPLER_GET_FEATURES() mozilla_sampler_get_features() -// we want the class and function name but can't easily get that using preprocessor macros -// __func__ doesn't have the class name and __PRETTY_FUNCTION__ has the parameters -#define SAMPLE_LABEL(name_space, info) mozilla::SamplerStackFrameRAII only_one_sampleraii_per_scope(name_space "::" info) +#define SAMPLE_LABEL(name_space, info) mozilla::SamplerStackFrameRAII only_one_sampleraii_per_scope(FULLFUNCTION, name_space "::" info) #define SAMPLE_MARKER(info) mozilla_sampler_add_marker(info) /* we duplicate this code here to avoid header dependencies @@ -141,8 +129,7 @@ namespace mozilla { class NS_STACK_CLASS SamplerStackFrameRAII { public: - // we only copy the strings at save time, so to take multiple parameters we'd need to copy them then. - SamplerStackFrameRAII(const char *aInfo) { + SamplerStackFrameRAII(const char *aFuncName, const char *aInfo) { mHandle = mozilla_sampler_call_enter(aInfo); } ~SamplerStackFrameRAII() { diff --git a/view/src/nsViewManager.cpp b/view/src/nsViewManager.cpp index b793eb815d1..d9064fc121d 100644 --- a/view/src/nsViewManager.cpp +++ b/view/src/nsViewManager.cpp @@ -664,7 +664,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, NS_ASSERTION(!aView || static_cast(aView)->GetViewManager() == this, "wrong view manager"); - SAMPLE_LABEL("event", "nsViewManager::DispatchEvent"); + SAMPLE_LABEL("event", "DispatchEvent"); *aStatus = nsEventStatus_eIgnore; diff --git a/widget/cocoa/nsAppShell.mm b/widget/cocoa/nsAppShell.mm index adfcfc03727..428ce562e34 100644 --- a/widget/cocoa/nsAppShell.mm +++ b/widget/cocoa/nsAppShell.mm @@ -63,7 +63,6 @@ #include "nsToolkit.h" #include "TextInputHandler.h" #include "mozilla/HangMonitor.h" -#include "sampler.h" #include "npapi.h" @@ -406,7 +405,7 @@ void nsAppShell::ProcessGeckoEvents(void* aInfo) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - SAMPLE_LABEL("Events", "ProcessGeckoEvents"); + nsAppShell* self = static_cast (aInfo); if (self->mRunningEventLoop) { diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 66b3f2c9112..8c53926c631 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -94,8 +94,6 @@ #include -#include "sampler.h" - using namespace mozilla; using namespace mozilla::layers; using namespace mozilla::gl; @@ -2479,7 +2477,6 @@ NSEvent* gLastDragMouseDownEvent = nil; - (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext { - SAMPLE_LABEL("widget", "ChildView::drawRect"); bool isVisible; if (!mGeckoChild || NS_FAILED(mGeckoChild->IsVisible(isVisible)) || !isVisible)