diff options
author | Philip Withnall <philip@tecnocode.co.uk> | 2009-07-27 00:04:30 +0100 |
---|---|---|
committer | Philip Withnall <philip@tecnocode.co.uk> | 2009-07-27 00:04:30 +0100 |
commit | 011a99b05e764798b90bcd7dff94ec4dfad49101 (patch) | |
tree | aea6731969c5dd9d9dc081234a260b11f4ca025c /browser-plugin | |
parent | 9a9e4c909da87157c532d41ff4ea20e7c2e1760c (diff) | |
download | totem-011a99b05e764798b90bcd7dff94ec4dfad49101.tar.gz |
Bug 537399 – debug option mess
Tidied up the debugging infrastructure as well.
Diffstat (limited to 'browser-plugin')
-rw-r--r-- | browser-plugin/totemNPObject.h | 40 | ||||
-rw-r--r-- | browser-plugin/totemPlugin.cpp | 78 | ||||
-rw-r--r-- | browser-plugin/totemPluginGlue.cpp | 19 |
3 files changed, 59 insertions, 78 deletions
diff --git a/browser-plugin/totemNPObject.h b/browser-plugin/totemNPObject.h index 13abec6bd..bb104618e 100644 --- a/browser-plugin/totemNPObject.h +++ b/browser-plugin/totemNPObject.h @@ -25,11 +25,6 @@ #include "npapi.h" #include "npruntime.h" -//FIXME force debug on -#define GNOME_ENABLE_DEBUG 1 - -#include "debug.h" - class totemPlugin; class totemNPObject; class totemNPClass_base; @@ -104,17 +99,14 @@ class totemNPObject : public NPObject { }; /* Helper macros */ - -#ifdef GNOME_ENABLE_DEBUG - -#define TOTEM_LOG_CTOR() D ("%s [%p]", __func__, (void*) this) -#define TOTEM_LOG_DTOR() D ("%s [%p]", __func__, (void*) this) +#define TOTEM_LOG_CTOR() g_debug ("%s [%p]", __func__, (void*) this) +#define TOTEM_LOG_DTOR() g_debug ("%s [%p]", __func__, (void*) this) #define TOTEM_LOG_INVOKE(i, T) \ {\ static bool logAccess[G_N_ELEMENTS (methodNames)];\ if (!logAccess[i]) {\ - D ("NOTE: site calls function %s::%s", #T, methodNames[i]);\ + g_debug ("NOTE: site calls function %s::%s", #T, methodNames[i]);\ logAccess[i] = true;\ }\ } @@ -123,7 +115,7 @@ class totemNPObject : public NPObject { {\ static bool logAccess[G_N_ELEMENTS (propertyNames)];\ if (!logAccess[i]) {\ - D ("NOTE: site gets property %s::%s", #T, propertyNames[i]);\ + g_debug ("NOTE: site gets property %s::%s", #T, propertyNames[i]);\ logAccess[i] = true;\ }\ } @@ -132,26 +124,16 @@ class totemNPObject : public NPObject { {\ static bool logAccess[G_N_ELEMENTS (propertyNames)];\ if (!logAccess[i]) {\ - D ("NOTE: site sets property %s::%s", #T, propertyNames[i]);\ + g_debug ("NOTE: site sets property %s::%s", #T, propertyNames[i]);\ logAccess[i] = true;\ }\ } -#else - -#define TOTEM_LOG_CTOR() -#define TOTEM_LOG_DTOR() -#define TOTEM_LOG_INVOKE(i, T) -#define TOTEM_LOG_GETTER(i, T) -#define TOTEM_LOG_SETTER(i, T) - -#endif /* GNOME_ENABLE_DEBUG */ - #define TOTEM_WARN_INVOKE_UNIMPLEMENTED(i, T) \ {\ static bool logWarning[G_N_ELEMENTS (methodNames)];\ if (!logWarning[i]) {\ - D ("WARNING: function %s::%s is unimplemented", #T, methodNames[i]);\ + g_warning ("WARNING: function %s::%s is unimplemented", #T, methodNames[i]);\ logWarning[i] = true;\ }\ } @@ -160,7 +142,7 @@ class totemNPObject : public NPObject { {\ static bool logWarning;\ if (!logWarning) {\ - D ("WARNING: function %s::%s is unimplemented", #T, methodNames[i]);\ + g_warning ("WARNING: function %s::%s is unimplemented", #T, methodNames[i]);\ logWarning = true;\ }\ } @@ -169,7 +151,7 @@ class totemNPObject : public NPObject { {\ static bool logWarning[G_N_ELEMENTS (propertyNames)];\ if (!logWarning[i]) {\ - D ("WARNING: getter for property %s::%s is unimplemented", #T, propertyNames[i]);\ + g_warning ("WARNING: getter for property %s::%s is unimplemented", #T, propertyNames[i]);\ logWarning[i] = true;\ }\ } @@ -178,7 +160,7 @@ class totemNPObject : public NPObject { {\ static bool logWarning;\ if (!logWarning) {\ - D ("WARNING: getter for property %s::%s is unimplemented", #T, propertyNames[i]);\ + g_warning ("WARNING: getter for property %s::%s is unimplemented", #T, propertyNames[i]);\ logWarning = true;\ }\ } @@ -187,7 +169,7 @@ class totemNPObject : public NPObject { {\ static bool logWarning[G_N_ELEMENTS (propertyNames)];\ if (!logWarning[i]) {\ - D ("WARNING: setter for property %s::%s is unimplemented", #T, propertyNames[i]);\ + g_warning ("WARNING: setter for property %s::%s is unimplemented", #T, propertyNames[i]);\ logWarning[i] = true;\ }\ } @@ -196,7 +178,7 @@ class totemNPObject : public NPObject { {\ static bool logWarning;\ if (!logWarning) {\ - D ("WARNING: setter for property %s::%s is unimplemented", #T, propertyNames[i]);\ + g_warning ("WARNING: setter for property %s::%s is unimplemented", #T, propertyNames[i]);\ logWarning = true;\ }\ } diff --git a/browser-plugin/totemPlugin.cpp b/browser-plugin/totemPlugin.cpp index 273869956..13a5c5706 100644 --- a/browser-plugin/totemPlugin.cpp +++ b/browser-plugin/totemPlugin.cpp @@ -43,16 +43,18 @@ #include "npruntime.h" #include "npupp.h" -/* define GNOME_ENABLE_DEBUG for more debug spew */ -#define GNOME_ENABLE_DEBUG 1 -/* FIXME define D() so that it prints the |this| pointer, so we can differentiate between different concurrent plugins! */ -#include "debug.h" +#ifdef G_HAVE_ISO_VARARGS +#define D(m, ...) g_debug ("%p: "#m, this, __VA_ARGS__) +#elif defined(G_HAVE_GNUC_VARARGS) +#define D(m, x...) g_debug ("%p: "#m, this, x) +#endif +#define Dm(m) g_debug ("%p: "#m, this) -// really noisy debug +// Really noisy messages; let's noop them for now #ifdef G_HAVE_ISO_VARARGS #define DD(...) #elif defined(G_HAVE_GNUC_VARARGS) -#define DD(args...) +#define DD(x...) #endif #include "totemPlugin.h" @@ -343,7 +345,7 @@ totemPlugin::SetFullscreen (bool enabled) void totemPlugin::ClearPlaylist () { - D ("ClearPlaylist"); + Dm ("ClearPlaylist"); /* FIXME: queue the action instead */ if (!mViewerReady) @@ -466,7 +468,7 @@ totemPlugin::ViewerFork () const char *userAgent = NPN_UserAgent (mNPP); if (!userAgent) { /* See https://bugzilla.mozilla.org/show_bug.cgi?id=328778 */ - D ("User agent has more than 127 characters; fix your browser!"); + Dm ("User agent has more than 127 characters; fix your browser!"); } GPtrArray *arr = g_ptr_array_new (); @@ -619,7 +621,7 @@ totemPlugin::ViewerSetup () mViewerSetUp = true; - D ("ViewerSetup"); + Dm ("ViewerSetup"); /* Cancel timeout */ if (mTimerID != 0) { @@ -758,7 +760,7 @@ totemPlugin::ViewerSetWindow () return; if (!mViewerProxy) { - D ("No viewer proxy yet, deferring SetWindow"); + Dm ("No viewer proxy yet, deferring SetWindow"); return; } @@ -771,7 +773,7 @@ totemPlugin::ViewerSetWindow () assert (mViewerPendingCall == NULL); /* Have a pending call */ - D ("Calling SetWindow"); + Dm ("Calling SetWindow"); mViewerPendingCall = dbus_g_proxy_begin_call (mViewerProxy, "SetWindow", @@ -794,7 +796,7 @@ totemPlugin::ViewerSetWindow () void totemPlugin::ViewerReady () { - D ("ViewerReady"); + Dm ("ViewerReady"); assert (!mViewerReady); @@ -823,7 +825,7 @@ totemPlugin::ViewerReady () void totemPlugin::ViewerButtonPressed (guint aTimestamp, guint aButton) { - D ("ButtonPress"); + Dm ("ButtonPress"); #ifdef TOTEM_NARROWSPACE_PLUGIN /* FIXME set href="" afterwards, so we don't try to launch again when the user clicks again? */ @@ -910,14 +912,14 @@ totemPlugin::NameOwnerChanged (const char *aName, aNewOwner[0] != '\0' /* non-empty */) { if (mViewerBusAddress && strcmp (mViewerBusAddress, aNewOwner) == 0) { - D ("Already have owner, why are we notified again?"); + Dm ("Already have owner, why are we notified again?"); g_free (mViewerBusAddress); } else if (mViewerBusAddress) { - D ("WTF, new owner!?"); + Dm ("WTF, new owner!?"); g_free (mViewerBusAddress); } else { /* This is the regular case */ - D ("Viewer now connected to the bus"); + Dm ("Viewer now connected to the bus"); } mViewerBusAddress = g_strdup (aNewOwner); @@ -925,7 +927,7 @@ totemPlugin::NameOwnerChanged (const char *aName, ViewerSetup (); } else if (mViewerBusAddress && strcmp (mViewerBusAddress, aOldOwner) == 0) { - D ("Viewer lost connection!"); + Dm ("Viewer lost connection!"); g_free (mViewerBusAddress); mViewerBusAddress = NULL; @@ -961,7 +963,7 @@ totemPlugin::RequestStream (bool aForceViewer) return;//FIXMEchpe if (mStream) { - D ("Unexpectedly have a stream!"); + Dm ("Unexpectedly have a stream!"); /* FIXME cancel existing stream, schedule new timer to try again */ return; } @@ -1117,7 +1119,7 @@ totemPlugin::ViewerForkTimeoutCallback (void *aData) plugin->mTimerID = 0; - D ("ViewerForkTimeoutCallback"); + g_debug ("ViewerForkTimeoutCallback"); /* FIXME: can this really happen? */ assert (!plugin->mViewerReady); /* Viewer ready but timeout running? */ @@ -1136,7 +1138,7 @@ totemPlugin::ButtonPressCallback (DBusGProxy *proxy, { totemPlugin *plugin = reinterpret_cast<totemPlugin*>(aData); - D ("ButtonPress signal received"); + g_debug ("ButtonPress signal received"); plugin->ViewerButtonPressed (aTimestamp, aButton); } @@ -1147,7 +1149,7 @@ totemPlugin::StopStreamCallback (DBusGProxy *proxy, { totemPlugin *plugin = reinterpret_cast<totemPlugin*>(aData); - D ("StopStream signal received"); + g_debug ("StopStream signal received"); plugin->UnsetStream (); } @@ -1227,7 +1229,7 @@ totemPlugin::ViewerSetWindowCallback (DBusGProxy *aProxy, { totemPlugin *plugin = reinterpret_cast<totemPlugin*>(aData); - D ("SetWindow reply"); + g_debug ("SetWindow reply"); //assert (aCall == plugin->mViewerPendingCall, "SetWindow not the current call"); if (aCall != plugin->mViewerPendingCall) @@ -1253,7 +1255,7 @@ totemPlugin::ViewerOpenStreamCallback (DBusGProxy *aProxy, { totemPlugin *plugin = reinterpret_cast<totemPlugin*>(aData); - D ("OpenStream reply"); + g_debug ("OpenStream reply"); // assert (aCall == plugin->mViewerPendingCall, "OpenStream not the current call"); if (aCall != plugin->mViewerPendingCall) @@ -1290,7 +1292,7 @@ totemPlugin::ViewerOpenStreamCallback (DBusGProxy *aProxy, if (err != NPERR_NO_ERROR) { plugin->mExpectingStream = false; - D ("GetURLNotify '%s' failed with error %d", plugin->mRequestURI, err); + g_debug ("GetURLNotify '%s' failed with error %d", plugin->mRequestURI, err); return; } @@ -1317,7 +1319,7 @@ totemPlugin::ViewerOpenURICallback (DBusGProxy *aProxy, { totemPlugin *plugin = reinterpret_cast<totemPlugin*>(aData); - D ("OpenURI reply"); + g_debug ("OpenURI reply"); // //assert (aCall == plugin->mViewerPendingCall, "OpenURI not the current call"); if (aCall != plugin->mViewerPendingCall) @@ -1865,7 +1867,7 @@ totemPlugin::Init (NPMIMEType mimetype, NPNVPluginElementNPObject, getter_Retains (mPluginElement)); if (err != NPERR_NO_ERROR || mPluginElement.IsNull ()) { - D ("Failed to get our DOM Element NPObject"); + Dm ("Failed to get our DOM Element NPObject"); return NPERR_GENERIC_ERROR; } @@ -1876,7 +1878,7 @@ totemPlugin::Init (NPMIMEType mimetype, NPN_GetStringIdentifier ("ownerDocument"), getter_Retains (mPluginOwnerDocument)) || mPluginOwnerDocument.IsNull ()) { - D ("Failed to get the plugin element's ownerDocument"); + Dm ("Failed to get the plugin element's ownerDocument"); return NPERR_GENERIC_ERROR; } #endif /* TOTEM_COMPLEX_PLUGIN */ @@ -1894,7 +1896,7 @@ totemPlugin::Init (NPMIMEType mimetype, NPN_GetStringIdentifier ("baseURI"), getter_Copies (baseURI)) || !baseURI.IsString ()) { - D ("Failed to get the base URI"); + Dm ("Failed to get the base URI"); return NPERR_GENERIC_ERROR; } @@ -1914,7 +1916,7 @@ totemPlugin::Init (NPMIMEType mimetype, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS))) { - D ("Failed to get DBUS proxy"); + Dm ("Failed to get DBUS proxy"); return NPERR_OUT_OF_MEMORY_ERROR; } @@ -2217,7 +2219,7 @@ NPError totemPlugin::SetWindow (NPWindow *window) { if (mHidden && window->window != 0) { - D("SetWindow: hidden, can't set window"); + Dm ("SetWindow: hidden, can't set window"); return NPERR_GENERIC_ERROR; } @@ -2237,7 +2239,7 @@ totemPlugin::SetWindow (NPWindow *window) ViewerSetWindow (); } else { - D ("Setting a new window != mWindow, this is unsupported!"); + Dm ("Setting a new window != mWindow, this is unsupported!"); } return NPERR_NO_ERROR; @@ -2256,7 +2258,7 @@ totemPlugin::NewStream (NPMIMEType type, /* We already have a live stream */ if (mStream) { - D ("Already have a live stream, aborting stream"); + Dm ("Already have a live stream, aborting stream"); /* We don't just return NPERR_GENERIC_ERROR (or any other error code), * since, using gecko trunk (1.9), this causes the plugin to be destroyed, @@ -2275,7 +2277,7 @@ totemPlugin::NewStream (NPMIMEType type, * doesn't catch always this. */ if (!mExpectingStream) { - D ("Not expecting a new stream; aborting stream"); + Dm ("Not expecting a new stream; aborting stream"); return NPN_DestroyStream (mNPP, stream, @@ -2294,7 +2296,7 @@ totemPlugin::NewStream (NPMIMEType type, * until the viewer is ready. */ if (!mViewerReady) { - D ("Viewer not ready, aborting stream"); + Dm ("Viewer not ready, aborting stream"); return NPN_DestroyStream (mNPP, stream, @@ -2417,7 +2419,7 @@ totemPlugin::Write (NPStream *stream, mCheckedForPlaylist = true; if (totem_pl_parser_can_parse_from_data ((const char *) buffer, len, TRUE /* FIXME */)) { - D ("Is playlist; need to wait for the file to be downloaded completely"); + Dm ("Is playlist; need to wait for the file to be downloaded completely"); mIsPlaylist = true; /* Close the viewer */ @@ -2476,7 +2478,7 @@ totemPlugin::StreamAsFile (NPStream *stream, * it finishes before we're ready. */ if (!mViewerReady) { - D ("Viewer not ready yet, deferring SetLocalFile"); + Dm ("Viewer not ready yet, deferring SetLocalFile"); return; } @@ -2569,7 +2571,7 @@ totemPlugin::URLNotify (const char *url, G_TYPE_INVALID, G_TYPE_INVALID); } else if (reason != NPRES_DONE) { - D ("Failed to get stream"); + Dm ("Failed to get stream"); /* FIXME: show error to user? */ } @@ -2636,7 +2638,7 @@ totemPlugin::GetNPObject (ObjectEnum which) mNPObjects[which] = do_CreateInstance (npclass, mNPP); if (mNPObjects[which].IsNull ()) { - D ("Creating scriptable NPObject failed!"); + Dm ("Creating scriptable NPObject failed!"); return NULL; } diff --git a/browser-plugin/totemPluginGlue.cpp b/browser-plugin/totemPluginGlue.cpp index ea681c281..fc5afc12a 100644 --- a/browser-plugin/totemPluginGlue.cpp +++ b/browser-plugin/totemPluginGlue.cpp @@ -30,9 +30,6 @@ #include "npapi.h" #include "npupp.h" -#define GNOME_ENABLE_DEBUG 1 -#include "debug.h" - #include "totemPlugin.h" NPNetscapeFuncs NPNFuncs; /* used in npn_gate.cpp */ @@ -121,7 +118,7 @@ totem_plugin_destroy_stream (NPP instance, NPError reason) { if (!instance) { - D("totem_plugin_destroy_stream instance is NULL"); + g_debug ("totem_plugin_destroy_stream instance is NULL"); /* FIXME? */ return NPERR_NO_ERROR; } @@ -199,14 +196,14 @@ static void totem_plugin_print (NPP instance, NPPrint* platformPrint) { - D ("Print"); + g_debug ("Print"); } static int16_t totem_plugin_handle_event (NPP instance, void* event) { - D ("Handle event"); + g_debug ("Handle event"); return FALSE; } @@ -247,7 +244,7 @@ totem_plugin_get_value (NPP instance, } break; default: - D ("Unhandled variable %d instance %p", variable, plugin); + g_debug ("Unhandled variable %d instance %p", variable, plugin); err = NPERR_INVALID_PARAM; break; } @@ -260,7 +257,7 @@ totem_plugin_set_value (NPP instance, NPNVariable variable, void *value) { - D ("SetValue variable %d (%x)", variable, variable); + g_debug ("SetValue variable %d (%x)", variable, variable); return NPERR_NO_ERROR; } @@ -397,7 +394,7 @@ NPError NP_Initialize (NPNetscapeFuncs *aMozillaVTable, NPPluginFuncs *aPluginVTable) { - D ("NP_Initialize"); + g_debug ("NP_Initialize"); if (aMozillaVTable == NULL || aPluginVTable == NULL) return NPERR_INVALID_FUNCTABLE_ERROR; @@ -464,7 +461,7 @@ NP_Initialize (NPNetscapeFuncs *aMozillaVTable, aPluginVTable->getvalue = NewNPP_GetValueProc (totem_plugin_get_value); aPluginVTable->setvalue = NewNPP_SetValueProc (totem_plugin_set_value); - D ("NP_Initialize succeeded"); + g_debug ("NP_Initialize succeeded"); return totemPlugin::Initialise (); } @@ -472,7 +469,7 @@ NP_Initialize (NPNetscapeFuncs *aMozillaVTable, NPError NP_Shutdown(void) { - D ("NP_Shutdown"); + g_debug ("NP_Shutdown"); g_free (mime_list); mime_list = NULL; |