diff options
| author | Derek Sollenberger <djsollen@google.com> | 2010-02-22 16:56:41 -0500 |
|---|---|---|
| committer | Derek Sollenberger <djsollen@google.com> | 2010-02-23 09:41:53 -0500 |
| commit | 15027de75d16455fd1e449b771fac8fd2cf88233 (patch) | |
| tree | f4a2bb5abea8b9996ce8414039bc62e26785a02b /WebKit/android/plugins | |
| parent | 1044e7fd4ebb61e6133d4f4dda69810e3af9da14 (diff) | |
| download | external_webkit-15027de75d16455fd1e449b771fac8fd2cf88233.zip external_webkit-15027de75d16455fd1e449b771fac8fd2cf88233.tar.gz external_webkit-15027de75d16455fd1e449b771fac8fd2cf88233.tar.bz2 | |
Added new logging messages and updated event logs with plugin execution time
Diffstat (limited to 'WebKit/android/plugins')
| -rw-r--r-- | WebKit/android/plugins/PluginDebugAndroid.cpp | 22 | ||||
| -rw-r--r-- | WebKit/android/plugins/PluginDebugAndroid.h | 16 | ||||
| -rw-r--r-- | WebKit/android/plugins/PluginWidgetAndroid.cpp | 14 |
3 files changed, 36 insertions, 16 deletions
diff --git a/WebKit/android/plugins/PluginDebugAndroid.cpp b/WebKit/android/plugins/PluginDebugAndroid.cpp index 3f1db2d..f8a3c50 100644 --- a/WebKit/android/plugins/PluginDebugAndroid.cpp +++ b/WebKit/android/plugins/PluginDebugAndroid.cpp @@ -59,7 +59,7 @@ void anp_logPlugin(const char format[], ...) { va_end(args); } -void anp_logPluginEvent(void* npp, const ANPEvent* evt, int16 returnVal) { +void anp_logPluginEvent(void* npp, const ANPEvent* evt, int16 returnVal, int elapsedTime) { switch(evt->eventType) { @@ -69,8 +69,8 @@ void anp_logPluginEvent(void* npp, const ANPEvent* evt, int16 returnVal) { case kKey_ANPEventType: if(evt->data.key.action < ARRAY_COUNT(inputActions)) { - anp_logPlugin("%p EVENT::KEY[%d] action=%s code=%d vcode=%d unichar=%d repeat=%d mods=%x", - npp, returnVal, inputActions[evt->data.key.action], + anp_logPlugin("%p EVENT::KEY[%d] time=%d action=%s code=%d vcode=%d unichar=%d repeat=%d mods=%x", + npp, returnVal, elapsedTime, inputActions[evt->data.key.action], evt->data.key.nativeCode, evt->data.key.virtualCode, evt->data.key.unichar, evt->data.key.repeatCount, evt->data.key.modifiers); @@ -81,8 +81,8 @@ void anp_logPluginEvent(void* npp, const ANPEvent* evt, int16 returnVal) { case kMouse_ANPEventType: if(evt->data.mouse.action < ARRAY_COUNT(inputActions)) { - anp_logPlugin("%p EVENT::MOUSE[%d] action=%s [%d %d]", npp, - returnVal, inputActions[evt->data.mouse.action], + anp_logPlugin("%p EVENT::MOUSE[%d] time=%d action=%s [%d %d]", npp, + returnVal, elapsedTime, inputActions[evt->data.mouse.action], evt->data.touch.x, evt->data.touch.y); } else { anp_logPlugin("%p EVENT::MOUSE[%d] unknown action", npp, returnVal); @@ -91,8 +91,8 @@ void anp_logPluginEvent(void* npp, const ANPEvent* evt, int16 returnVal) { case kTouch_ANPEventType: if(evt->data.touch.action < ARRAY_COUNT(inputActions)) { - anp_logPlugin("%p EVENT::TOUCH[%d] action=%s [%d %d]", npp, - returnVal, inputActions[evt->data.touch.action], + anp_logPlugin("%p EVENT::TOUCH[%d] time=%d action=%s [%d %d]", npp, + returnVal, elapsedTime,inputActions[evt->data.touch.action], evt->data.touch.x, evt->data.touch.y); } else { anp_logPlugin("%p EVENT::TOUCH[%d] unknown action", npp, returnVal); @@ -101,8 +101,8 @@ void anp_logPluginEvent(void* npp, const ANPEvent* evt, int16 returnVal) { case kDraw_ANPEventType: if (evt->data.draw.model == kBitmap_ANPDrawingModel) { - anp_logPlugin("%p EVENT::DRAW bitmap format=%d clip=[%d,%d,%d,%d]", - npp, evt->data.draw.data.bitmap.format, + anp_logPlugin("%p EVENT::DRAW bitmap time=%d format=%d clip=[%d,%d,%d,%d]", + npp, elapsedTime, evt->data.draw.data.bitmap.format, evt->data.draw.clip.left, evt->data.draw.clip.top, evt->data.draw.clip.right, evt->data.draw.clip.bottom); } else { @@ -112,7 +112,7 @@ void anp_logPluginEvent(void* npp, const ANPEvent* evt, int16 returnVal) { case kLifecycle_ANPEventType: if(evt->data.lifecycle.action < ARRAY_COUNT(lifecycleActions)) { - anp_logPlugin("%p EVENT::LIFECYCLE %s", npp, + anp_logPlugin("%p EVENT::LIFECYCLE time=%d action=%s", npp, elapsedTime, lifecycleActions[evt->data.lifecycle.action]); } else { anp_logPlugin("%p EVENT::LIFECYCLE unknown action", npp); @@ -120,7 +120,7 @@ void anp_logPluginEvent(void* npp, const ANPEvent* evt, int16 returnVal) { break; case kCustom_ANPEventType: - anp_logPlugin("%p EVENT::CUSTOM", npp); + anp_logPlugin("%p EVENT::CUSTOM time=%d", npp, elapsedTime); break; default: diff --git a/WebKit/android/plugins/PluginDebugAndroid.h b/WebKit/android/plugins/PluginDebugAndroid.h index 24944cb..92092d5 100644 --- a/WebKit/android/plugins/PluginDebugAndroid.h +++ b/WebKit/android/plugins/PluginDebugAndroid.h @@ -1,5 +1,5 @@ /* - * Copyright 2008, The Android Open Source Project + * Copyright 2010, The Android Open Source Project * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,14 +37,22 @@ #if PLUGIN_DEBUG_GLOBAL || defined(PLUGIN_DEBUG_LOCAL) # define PLUGIN_LOG(FORMAT, ARGS...) do { anp_logPlugin(FORMAT, ## ARGS); } while(0) -# define PLUGIN_LOG_EVENT(NPP, EVT, RET) do { anp_logPluginEvent(NPP, EVT, RET); } while(0) +# define PLUGIN_LOG_EVENT(NPP, EVT, RET, TIME) do { anp_logPluginEvent(NPP, EVT, RET, TIME); } while(0) +/* Logs the given character array and optional arguments. All log entries use + the DEBUG priority and use the same "webkit_plugin" log tag. + */ void anp_logPlugin(const char format[], ...); -void anp_logPluginEvent(void* npp, const ANPEvent* event, int16 returnVal); +/* Logs a user readable description of a plugin event. The relevant contents of + each event are logged, as well as the value returned by the plugin instance + and how long the instance took to process the event (in milliseconds). + */ +void anp_logPluginEvent(void* npp, const ANPEvent* event, int16 returnVal, int elapsedTime); #else # define PLUGIN_LOG(A, B...) do { } while(0) -# define PLUGIN_LOG_EVENT(NPP, EVENT) do { } while(0) +# define PLUGIN_LOG_EVENT(NPP, EVT, RET, TIME) do { } while(0) + #endif #endif // defined(PLUGIN_DEBUG_ANDROID_H__) diff --git a/WebKit/android/plugins/PluginWidgetAndroid.cpp b/WebKit/android/plugins/PluginWidgetAndroid.cpp index 00f7165..182a1c4 100644 --- a/WebKit/android/plugins/PluginWidgetAndroid.cpp +++ b/WebKit/android/plugins/PluginWidgetAndroid.cpp @@ -35,10 +35,12 @@ #include "SkANP.h" #include "SkFlipPixelRef.h" #include "SkString.h" +#include "SkTime.h" #include "WebViewCore.h" #include "jni_utility.h" #define PLUGIN_DEBUG_LOCAL 0 // controls the printing of log messages +#define DEBUG_EVENTS 0 // logs event contents, return value, and processing time #define DEBUG_VISIBLE_RECTS 1 // temporary debug printfs and fixes // this include statement must follow the declaration of PLUGIN_DEBUG_LOCAL @@ -64,6 +66,7 @@ PluginWidgetAndroid::PluginWidgetAndroid(WebCore::PluginView* view) } PluginWidgetAndroid::~PluginWidgetAndroid() { + PLUGIN_LOG("%p Deleting Plugin", m_pluginView->instance()); m_acceptEvents = false; if (m_core) { m_core->removePlugin(this); @@ -88,6 +91,7 @@ void PluginWidgetAndroid::init(android::WebViewCore* core) { m_core = core; m_core->addPlugin(this); m_acceptEvents = true; + PLUGIN_LOG("%p Initialized Plugin", m_pluginView->instance()); } static SkBitmap::Config computeConfig(bool isTransparent) { @@ -236,11 +240,19 @@ int16 PluginWidgetAndroid::sendEvent(const ANPEvent& evt) { m_hasFocus = true; } +#if DEBUG_EVENTS + SkMSec startTime = SkTime::GetMSecs(); +#endif + // make a localCopy since the actual plugin may not respect its constness, // and so we don't want our caller to have its param modified ANPEvent localCopy = evt; int16 result = pkg->pluginFuncs()->event(instance, &localCopy); - PLUGIN_LOG_EVENT(instance, &evt, result); + +#if DEBUG_EVENTS + SkMSec endTime = SkTime::GetMSecs(); + PLUGIN_LOG_EVENT(instance, &evt, result, endTime - startTime); +#endif // if the plugin is losing focus then delay the update of our state // until after we notify the plugin and allow them to perform actions |
