Bug 908995 - Part 3: Add source events for TaskTracer. r=khuey,smaug.

This commit is contained in:
Shelly Lin 2014-04-23 15:32:31 +08:00
parent 6437f8163e
commit 9c64583a64
3 changed files with 41 additions and 0 deletions

View File

@ -10,6 +10,11 @@
#include "WifiUtils.h"
#include "nsCxPusher.h"
#ifdef MOZ_TASK_TRACER
#include "GeckoTaskTracer.h"
using namespace mozilla::tasktracer;
#endif
#define NS_WIFIPROXYSERVICE_CID \
{ 0xc6c9be7e, 0x744f, 0x4222, {0xb2, 0x03, 0xcd, 0x55, 0xdf, 0xc8, 0xbc, 0x12} }
@ -63,6 +68,12 @@ public:
nsAutoString event;
gWpaSupplicant->WaitForEvent(event, mInterface);
if (!event.IsEmpty()) {
#ifdef MOZ_TASK_TRACER
// Make wifi initialization events to be the source events of TaskTracer,
// and originate the rest correlation tasks from here.
AutoSourceEvent taskTracerEvent(SourceEventType::WIFI);
AddLabel("%s %s", mInterface.get(), NS_ConvertUTF16toUTF8(event).get());
#endif
nsCOMPtr<nsIRunnable> runnable = new WifiEventDispatcher(event, mInterface);
NS_DispatchToMainThread(runnable);
}

View File

@ -9,6 +9,11 @@
#include "nsXULAppAPI.h"
#include <fcntl.h>
#ifdef MOZ_TASK_TRACER
#include "GeckoTaskTracer.h"
using namespace mozilla::tasktracer;
#endif
static const size_t MAX_READ_SIZE = 1 << 16;
namespace mozilla {
@ -673,6 +678,12 @@ UnixSocketImpl::OnSocketCanReceiveWithoutBlocking()
return;
}
#ifdef MOZ_TASK_TRACER
// Make unix socket creation events to be the source events of TaskTracer,
// and originate the rest correlation tasks from here.
AutoSourceEvent taskTracerEvent(SourceEventType::UNIXSOCKET);
#endif
incoming->mSize = ret;
nsRefPtr<SocketReceiveRunnable> r =
new SocketReceiveRunnable(this, incoming.forget());

View File

@ -175,6 +175,11 @@
#include "nsIDocShellTreeOwner.h"
#endif
#ifdef MOZ_TASK_TRACER
#include "GeckoTaskTracer.h"
using namespace mozilla::tasktracer;
#endif
#define ANCHOR_SCROLL_FLAGS \
(nsIPresShell::SCROLL_OVERFLOW_HIDDEN | nsIPresShell::SCROLL_NO_PARENT_FRAMES)
@ -6496,6 +6501,20 @@ PresShell::HandleEvent(nsIFrame* aFrame,
bool aDontRetargetEvents,
nsEventStatus* aEventStatus)
{
#ifdef MOZ_TASK_TRACER
// Make touch events, mouse events and hardware key events to be the source
// events of TaskTracer, and originate the rest correlation tasks from here.
SourceEventType type = SourceEventType::UNKNOWN;
if (WidgetTouchEvent* inputEvent = aEvent->AsTouchEvent()) {
type = SourceEventType::TOUCH;
} else if (WidgetMouseEvent* inputEvent = aEvent->AsMouseEvent()) {
type = SourceEventType::MOUSE;
} else if (WidgetKeyboardEvent* inputEvent = aEvent->AsKeyboardEvent()) {
type = SourceEventType::KEY;
}
AutoSourceEvent taskTracerEvent(type);
#endif
if (sPointerEventEnabled) {
DispatchPointerFromMouseOrTouch(this, aFrame, aEvent, aDontRetargetEvents, aEventStatus);
}