author | Shelly Lin <slin@mozilla.com> |
Thu, 20 Nov 2014 10:57:27 +0800 | |
changeset 216816 | 794b5fca57b02ec6d0e9275431b90262c6d962a1 |
parent 216815 | 5261b6dd5487ba8b086fa04ff6f9fe50436af210 |
child 216817 | 58bdcf852b1c2b4ae05be9c2cfed151613cd4c28 |
child 216838 | 23ca43337c3f5db036d1cbb72b291460c37ba055 |
push id | 52145 |
push user | cbook@mozilla.com |
push date | Fri, 21 Nov 2014 07:55:01 +0000 |
treeherder | mozilla-inbound@794b5fca57b0 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | sinker |
bugs | 1100259 |
milestone | 36.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
|
--- a/dom/events/EventDispatcher.cpp +++ b/dom/events/EventDispatcher.cpp @@ -27,16 +27,22 @@ #include "mozilla/InternalMutationEvent.h" #include "mozilla/ipc/MessageChannel.h" #include "mozilla/MiscEvents.h" #include "mozilla/MouseEvents.h" #include "mozilla/TextEvents.h" #include "mozilla/TouchEvents.h" #include "mozilla/unused.h" +#ifdef MOZ_TASK_TRACER +#include "GeckoTaskTracer.h" +#include "mozilla/dom/Element.h" +using namespace mozilla::tasktracer; +#endif + namespace mozilla { using namespace dom; class ELMCreationDetector { public: ELMCreationDetector() @@ -402,16 +408,37 @@ EventDispatcher::Dispatch(nsISupports* a NS_ASSERTION(!aTargets || !aEvent->message, "Wrong parameters!"); // If we're dispatching an already created DOMEvent object, make // sure it is initialized! // If aTargets is non-null, the event isn't going to be dispatched. NS_ENSURE_TRUE(aEvent->message || !aDOMEvent || aTargets, NS_ERROR_DOM_INVALID_STATE_ERR); +#ifdef MOZ_TASK_TRACER + { + if (aDOMEvent) { + nsAutoString eventType; + aDOMEvent->GetType(eventType); + + nsCOMPtr<Element> element = do_QueryInterface(aTarget); + nsAutoString elementId; + nsAutoString elementTagName; + if (element) { + element->GetId(elementId); + element->GetTagName(elementTagName); + } + AddLabel("Event [%s] dispatched at target [id:%s tag:%s]", + NS_ConvertUTF16toUTF8(eventType).get(), + NS_ConvertUTF16toUTF8(elementId).get(), + NS_ConvertUTF16toUTF8(elementTagName).get()); + } + } +#endif + nsCOMPtr<EventTarget> target = do_QueryInterface(aTarget); bool retargeted = false; if (aEvent->mFlags.mRetargetToNonNativeAnonymous) { nsCOMPtr<nsIContent> content = do_QueryInterface(target); if (content && content->IsInNativeAnonymousSubtree()) { nsCOMPtr<EventTarget> newTarget =
--- a/tools/profiler/GeckoTaskTracer.cpp +++ b/tools/profiler/GeckoTaskTracer.cpp @@ -32,16 +32,17 @@ namespace mozilla { namespace tasktracer { static mozilla::ThreadLocal<TraceInfo*>* sTraceInfoTLS = nullptr; static mozilla::StaticMutex sMutex; static nsTArray<nsAutoPtr<TraceInfo>>* sTraceInfos = nullptr; static bool sIsLoggingStarted = false; static TimeStamp sStartTime; +static const char sJSLabelPrefix[] = "#tt#"; namespace { static TraceInfo* AllocTraceInfo(int aTid) { StaticMutexAutoLock lock(sMutex); @@ -397,10 +398,16 @@ GetLoggedData(TimeStamp aStartTime) for (uint32_t i = 0; i < sTraceInfos->Length(); ++i) { (*sTraceInfos)[i]->MoveLogsInto(*result); } return result; } +const char* +GetJSLabelPrefix() +{ + return sJSLabelPrefix; +} + } // namespace tasktracer } // namespace mozilla
--- a/tools/profiler/GeckoTaskTracer.h +++ b/tools/profiler/GeckoTaskTracer.h @@ -78,12 +78,14 @@ already_AddRefed<nsIRunnable> CreateTrac already_AddRefed<FakeTracedTask> CreateFakeTracedTask(int* aVptr); // Free the TraceInfo allocated on a thread's TLS. Currently we are wrapping // tasks running on nsThreads and base::thread, so FreeTraceInfo is called at // where nsThread and base::thread release themselves. void FreeTraceInfo(); +const char* GetJSLabelPrefix(); + } // namespace tasktracer } // namespace mozilla. #endif
--- a/xpcom/base/nsConsoleService.cpp +++ b/xpcom/base/nsConsoleService.cpp @@ -26,16 +26,21 @@ #if defined(ANDROID) #include <android/log.h> #include "mozilla/dom/ContentChild.h" #endif #ifdef XP_WIN #include <windows.h> #endif +#ifdef MOZ_TASK_TRACER +#include "GeckoTaskTracer.h" +using namespace mozilla::tasktracer; +#endif + using namespace mozilla; NS_IMPL_ADDREF(nsConsoleService) NS_IMPL_RELEASE(nsConsoleService) NS_IMPL_CLASSINFO(nsConsoleService, nullptr, nsIClassInfo::THREADSAFE | nsIClassInfo::SINGLETON, NS_CONSOLESERVICE_CID) NS_IMPL_QUERY_INTERFACE_CI(nsConsoleService, nsIConsoleService) @@ -241,16 +246,27 @@ nsConsoleService::LogMessageWithMode(nsI #ifdef XP_WIN if (IsDebuggerPresent()) { nsString msg; aMessage->GetMessageMoz(getter_Copies(msg)); msg.Append('\n'); OutputDebugStringW(msg.get()); } #endif +#ifdef MOZ_TASK_TRACER + { + nsCString msg; + aMessage->ToString(msg); + int prefixPos = msg.Find(GetJSLabelPrefix()); + if (prefixPos >= 0) { + nsDependentCSubstring submsg(msg, prefixPos); + AddLabel("%s", submsg.BeginReading()); + } + } +#endif /* * If there's already a message in the slot we're about to replace, * we've wrapped around, and we need to release the old message. We * save a pointer to it, so we can release below outside the lock. */ retiredMessage = mMessages[mCurrent];