bug 817772 - remove MAI logging r=surkov

This commit is contained in:
Trevor Saunders 2012-12-01 13:49:24 -05:00
parent a0adca9c14
commit 93eb2b92f1
5 changed files with 13 additions and 188 deletions

View File

@ -141,11 +141,6 @@ struct MaiAtkObjectClass
static guint mai_atk_object_signals [LAST_SIGNAL] = { 0, };
#ifdef MAI_LOGGING
int32_t sMaiAtkObjCreated = 0;
int32_t sMaiAtkObjDeleted = 0;
#endif
G_BEGIN_DECLS
/* callbacks for MaiAtkObject */
static void classInitCB(AtkObjectClass *aClass);
@ -232,33 +227,15 @@ mai_atk_object_get_type(void)
return type;
}
#ifdef MAI_LOGGING
int32_t AccessibleWrap::mAccWrapCreated = 0;
int32_t AccessibleWrap::mAccWrapDeleted = 0;
#endif
AccessibleWrap::
AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
Accessible(aContent, aDoc), mAtkObject(nullptr)
{
#ifdef MAI_LOGGING
++mAccWrapCreated;
#endif
MAI_LOG_DEBUG(("==AccessibleWrap creating: this=%p,total=%d left=%d\n",
(void*)this, mAccWrapCreated,
(mAccWrapCreated-mAccWrapDeleted)));
}
AccessibleWrap::~AccessibleWrap()
{
NS_ASSERTION(!mAtkObject, "ShutdownAtkObject() is not called");
#ifdef MAI_LOGGING
++mAccWrapDeleted;
#endif
MAI_LOG_DEBUG(("==AccessibleWrap deleting: this=%p,total=%d left=%d\n",
(void*)this, mAccWrapDeleted,
(mAccWrapCreated-mAccWrapDeleted)));
}
void
@ -482,8 +459,6 @@ GetUniqueMaiAtkTypeName(uint16_t interfacesBits)
interfacesBits);
name[MAI_ATK_TYPE_NAME_LEN] = '\0';
MAI_LOG_DEBUG(("MaiWidget::LastedTypeName=%s\n", name));
return name;
}
@ -603,13 +578,6 @@ initializeCB(AtkObject *aAtkObj, gpointer aData)
/* initialize object */
MAI_ATK_OBJECT(aAtkObj)->accWrap =
static_cast<AccessibleWrap*>(aData);
#ifdef MAI_LOGGING
++sMaiAtkObjCreated;
#endif
MAI_LOG_DEBUG(("MaiAtkObj Create obj=%p for AccWrap=%p, all=%d, left=%d\n",
(void*)aAtkObj, (void*)aData, sMaiAtkObjCreated,
(sMaiAtkObjCreated-sMaiAtkObjDeleted)));
}
void
@ -619,13 +587,6 @@ finalizeCB(GObject *aObj)
return;
NS_ASSERTION(MAI_ATK_OBJECT(aObj)->accWrap == nullptr, "AccWrap NOT null");
#ifdef MAI_LOGGING
++sMaiAtkObjDeleted;
#endif
MAI_LOG_DEBUG(("MaiAtkObj Delete obj=%p, all=%d, left=%d\n",
(void*)aObj, sMaiAtkObjCreated,
(sMaiAtkObjCreated-sMaiAtkObjDeleted)));
// call parent finalize function
// finalize of GObjectClass will unref the accessible parent if has
if (G_OBJECT_CLASS (parent_class)->finalize)
@ -992,7 +953,6 @@ AccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
case nsIAccessibleEvent::EVENT_FOCUS:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_FOCUS\n"));
a11y::RootAccessible* rootAccWrap = accWrap->RootAccessible();
if (rootAccWrap && rootAccWrap->mActivated) {
atk_focus_tracker_notify(atkObj);
@ -1015,7 +975,6 @@ AccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
}
case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_VALUE_CHANGE\n"));
nsCOMPtr<nsIAccessibleValue> value(do_QueryObject(accessible));
if (value) { // Make sure this is a numeric value
// Don't fire for MSAA string value changes (e.g. text editing)
@ -1029,7 +988,6 @@ AccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
case nsIAccessibleEvent::EVENT_SELECTION_REMOVE:
{
// XXX: dupe events may be fired
MAI_LOG_DEBUG(("\n\nReceived: EVENT_SELECTION_CHANGED\n"));
AccSelChangeEvent* selChangeEvent = downcast_accEvent(aEvent);
g_signal_emit_by_name(AccessibleWrap::GetAtkObject(selChangeEvent->Widget()),
"selection_changed");
@ -1038,128 +996,86 @@ AccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
case nsIAccessibleEvent::EVENT_SELECTION_WITHIN:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_SELECTION_CHANGED\n"));
g_signal_emit_by_name(atkObj, "selection_changed");
break;
}
case nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_SELECTION_CHANGED\n"));
g_signal_emit_by_name(atkObj, "text_selection_changed");
break;
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_CARET_MOVED\n"));
AccCaretMoveEvent* caretMoveEvent = downcast_accEvent(aEvent);
NS_ASSERTION(caretMoveEvent, "Event needs event data");
if (!caretMoveEvent)
break;
int32_t caretOffset = caretMoveEvent->GetCaretOffset();
MAI_LOG_DEBUG(("\n\nCaret postion: %d", caretOffset));
g_signal_emit_by_name(atkObj,
"text_caret_moved",
// Curent caret position
caretOffset);
g_signal_emit_by_name(atkObj, "text_caret_moved", caretOffset);
} break;
case nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_ATTRIBUTE_CHANGED\n"));
g_signal_emit_by_name(atkObj,
"text-attributes-changed");
g_signal_emit_by_name(atkObj, "text-attributes-changed");
break;
case nsIAccessibleEvent::EVENT_TABLE_MODEL_CHANGED:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_MODEL_CHANGED\n"));
g_signal_emit_by_name(atkObj, "model_changed");
break;
case nsIAccessibleEvent::EVENT_TABLE_ROW_INSERT:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_INSERT\n"));
AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
int32_t rowIndex = tableEvent->GetIndex();
int32_t numRows = tableEvent->GetCount();
g_signal_emit_by_name(atkObj,
"row_inserted",
// After which the rows are inserted
rowIndex,
// The number of the inserted
numRows);
g_signal_emit_by_name(atkObj, "row_inserted", rowIndex, numRows);
} break;
case nsIAccessibleEvent::EVENT_TABLE_ROW_DELETE:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_DELETE\n"));
AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
int32_t rowIndex = tableEvent->GetIndex();
int32_t numRows = tableEvent->GetCount();
g_signal_emit_by_name(atkObj,
"row_deleted",
// After which the rows are deleted
rowIndex,
// The number of the deleted
numRows);
g_signal_emit_by_name(atkObj, "row_deleted", rowIndex, numRows);
} break;
case nsIAccessibleEvent::EVENT_TABLE_ROW_REORDER:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_REORDER\n"));
g_signal_emit_by_name(atkObj, "row_reordered");
break;
}
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_INSERT:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_INSERT\n"));
AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
int32_t colIndex = tableEvent->GetIndex();
int32_t numCols = tableEvent->GetCount();
g_signal_emit_by_name(atkObj,
"column_inserted",
// After which the columns are inserted
colIndex,
// The number of the inserted
numCols);
g_signal_emit_by_name(atkObj, "column_inserted", colIndex, numCols);
} break;
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_DELETE:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_DELETE\n"));
AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
int32_t colIndex = tableEvent->GetIndex();
int32_t numCols = tableEvent->GetCount();
g_signal_emit_by_name(atkObj,
"column_deleted",
// After which the columns are deleted
colIndex,
// The number of the deleted
numCols);
g_signal_emit_by_name(atkObj, "column_deleted", colIndex, numCols);
} break;
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_REORDER:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_REORDER\n"));
g_signal_emit_by_name(atkObj, "column_reordered");
break;
case nsIAccessibleEvent::EVENT_SECTION_CHANGED:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_SECTION_CHANGED\n"));
g_signal_emit_by_name(atkObj, "visible_data_changed");
break;
@ -1176,16 +1092,11 @@ AccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
* Need more verification by AT test.
*/
case nsIAccessibleEvent::EVENT_MENU_START:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENU_START\n"));
break;
case nsIAccessibleEvent::EVENT_MENU_END:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENU_END\n"));
break;
case nsIAccessibleEvent::EVENT_WINDOW_ACTIVATE:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_ACTIVATED\n"));
accessible->AsRoot()->mActivated = true;
guint id = g_signal_lookup ("activate", MAI_TYPE_ATK_OBJECT);
g_signal_emit(atkObj, id, 0);
@ -1196,7 +1107,6 @@ AccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
case nsIAccessibleEvent::EVENT_WINDOW_DEACTIVATE:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_DEACTIVATED\n"));
accessible->AsRoot()->mActivated = false;
guint id = g_signal_lookup ("deactivate", MAI_TYPE_ATK_OBJECT);
g_signal_emit(atkObj, id, 0);
@ -1204,52 +1114,41 @@ AccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
case nsIAccessibleEvent::EVENT_WINDOW_MAXIMIZE:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_MAXIMIZE\n"));
guint id = g_signal_lookup ("maximize", MAI_TYPE_ATK_OBJECT);
g_signal_emit(atkObj, id, 0);
} break;
case nsIAccessibleEvent::EVENT_WINDOW_MINIMIZE:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_MINIMIZE\n"));
guint id = g_signal_lookup ("minimize", MAI_TYPE_ATK_OBJECT);
g_signal_emit(atkObj, id, 0);
} break;
case nsIAccessibleEvent::EVENT_WINDOW_RESTORE:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_RESTORE\n"));
guint id = g_signal_lookup ("restore", MAI_TYPE_ATK_OBJECT);
g_signal_emit(atkObj, id, 0);
} break;
case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_LOAD_COMPLETE\n"));
g_signal_emit_by_name (atkObj, "load_complete");
} break;
break;
case nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_RELOAD\n"));
g_signal_emit_by_name (atkObj, "reload");
} break;
break;
case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED:
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_LOAD_STOPPED\n"));
g_signal_emit_by_name (atkObj, "load_stopped");
} break;
break;
case nsIAccessibleEvent::EVENT_MENUPOPUP_START:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENUPOPUP_START\n"));
atk_focus_tracker_notify(atkObj); // fire extra focus event
atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, true);
atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, true);
break;
case nsIAccessibleEvent::EVENT_MENUPOPUP_END:
MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENUPOPUP_END\n"));
atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, false);
atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, false);
break;
@ -1262,8 +1161,6 @@ nsresult
AccessibleWrap::FireAtkStateChangeEvent(AccEvent* aEvent,
AtkObject* aObject)
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_STATE_CHANGE\n"));
AccStateChangeEvent* event = downcast_accEvent(aEvent);
NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
@ -1294,8 +1191,6 @@ nsresult
AccessibleWrap::FireAtkTextChangedEvent(AccEvent* aEvent,
AtkObject* aObject)
{
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_REMOVED/INSERTED\n"));
AccTextChangeEvent* event = downcast_accEvent(aEvent);
NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
@ -1335,12 +1230,6 @@ nsresult
AccessibleWrap::FireAtkShowHideEvent(AccEvent* aEvent,
AtkObject* aObject, bool aIsAdded)
{
if (aIsAdded) {
MAI_LOG_DEBUG(("\n\nReceived: Show event\n"));
} else {
MAI_LOG_DEBUG(("\n\nReceived: Hide event\n"));
}
int32_t indexInParent = getIndexInParentCB(aObject);
AtkObject *parentObject = getParentCB(aObject);
NS_ENSURE_STATE(parentObject);

View File

@ -9,11 +9,6 @@
#include "nsCOMPtr.h"
#include "Accessible.h"
#include "prlog.h"
#ifdef PR_LOGGING
#define MAI_LOGGING
#endif /* #ifdef PR_LOGGING */
struct _AtkObject;
typedef struct _AtkObject AtkObject;
@ -60,12 +55,6 @@ public:
// nsAccessNode
virtual void Shutdown();
#ifdef MAI_LOGGING
virtual void DumpAccessibleWrapInfo(int aDepth) {}
static int32_t mAccWrapCreated;
static int32_t mAccWrapDeleted;
#endif
// return the atk object for this AccessibleWrap
NS_IMETHOD GetNativeInterface(void **aOutAccessible);
virtual nsresult HandleAccEvent(AccEvent* aEvent);

View File

@ -52,10 +52,6 @@ struct GnomeAccessibilityModule
GnomeAccessibilityShutdown shutdown;
};
/* supporting */
PRLogModuleInfo *gMaiLog = NULL;
static GnomeAccessibilityModule sAtkBridge = {
#ifdef AIX
"libatk-bridge.a(libatk-bridge.so.0)", NULL,
@ -82,16 +78,11 @@ static gboolean toplevel_event_watcher(GSignalInvocationHint*, guint,
ApplicationAccessibleWrap::ApplicationAccessibleWrap():
ApplicationAccessible()
{
MAI_LOG_DEBUG(("======Create AppRootAcc=%p\n", (void*)this));
if (ShouldA11yBeEnabled()) {
// Load and initialize gail library.
nsresult rv = LoadGtkModule(sGail);
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv))
(*sGail.init)();
} else {
MAI_LOG_DEBUG(("Fail to load lib: %s\n", sGail.libName));
}
}
}
@ -114,8 +105,6 @@ nsAccessNodeWrap::InitAccessibility()
nsresult rv = LoadGtkModule(sAtkBridge);
if (NS_SUCCEEDED(rv)) {
(*sAtkBridge.init)();
} else {
MAI_LOG_DEBUG(("Fail to load lib: %s\n", sAtkBridge.libName));
}
if (!sToplevel_event_hook_added) {
@ -136,7 +125,6 @@ nsAccessNodeWrap::InitAccessibility()
ApplicationAccessibleWrap::~ApplicationAccessibleWrap()
{
MAI_LOG_DEBUG(("======Destory AppRootAcc=%p\n", (void*)this));
AccessibleWrap::ShutdownAtkObject();
}
@ -351,9 +339,6 @@ LoadGtkModule(GnomeAccessibilityModule& aModule)
NS_ENSURE_ARG(aModule.libName);
if (!(aModule.lib = PR_LoadLibrary(aModule.libName))) {
MAI_LOG_DEBUG(("Fail to load lib: %s in default path\n", aModule.libName));
//try to load the module with "gtk-2.0/modules" appended
char *curLibPath = PR_GetLibraryPath();
nsAutoCString libPath(curLibPath);
@ -362,7 +347,6 @@ LoadGtkModule(GnomeAccessibilityModule& aModule)
#else
libPath.Append(":/usr/lib");
#endif
MAI_LOG_DEBUG(("Current Lib path=%s\n", libPath.get()));
PR_FreeLibraryName(curLibPath);
int16_t loc1 = 0, loc2 = 0;
@ -377,16 +361,13 @@ LoadGtkModule(GnomeAccessibilityModule& aModule)
sub.Append("/gtk-2.0/modules/");
sub.Append(aModule.libName);
aModule.lib = PR_LoadLibrary(sub.get());
if (aModule.lib) {
MAI_LOG_DEBUG(("Ok, load %s from %s\n", aModule.libName, sub.get()));
if (aModule.lib)
break;
}
loc1 = loc2+1;
}
if (!aModule.lib) {
MAI_LOG_DEBUG(("Fail to load %s\n", aModule.libName));
if (!aModule.lib)
return NS_ERROR_FAILURE;
}
}
//we have loaded the library, try to get the function ptrs
@ -396,9 +377,6 @@ LoadGtkModule(GnomeAccessibilityModule& aModule)
aModule.shutdownName))) {
//fail, :(
MAI_LOG_DEBUG(("Fail to find symbol %s in %s",
aModule.init ? aModule.shutdownName : aModule.initName,
aModule.libName));
PR_UnloadLibrary(aModule.lib);
aModule.lib = NULL;
return NS_ERROR_FAILURE;

View File

@ -13,25 +13,6 @@
#include "AccessibleWrap.h"
extern PRLogModuleInfo *gMaiLog;
#ifdef MAI_LOGGING
#define MAI_LOG(level, args) \
PR_BEGIN_MACRO \
if (!gMaiLog) { \
gMaiLog = PR_NewLogModule("Mai"); \
PR_ASSERT(gMaiLog); \
} \
PR_LOG(gMaiLog, (level), args); \
PR_END_MACRO
#else
#define MAI_LOG(level, args)
#endif
#define MAI_LOG_DEBUG(args) MAI_LOG(PR_LOG_DEBUG, args)
#define MAI_LOG_WARNING(args) MAI_LOG(PR_LOG_WARNING, args)
#define MAI_LOG_ERROR(args) MAI_LOG(PR_LOG_ERROR, args)
#define MAI_TYPE_ATK_OBJECT (mai_atk_object_get_type ())
#define MAI_ATK_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
MAI_TYPE_ATK_OBJECT, MaiAtkObject))

View File

@ -26,8 +26,6 @@ setTextContentsCB(AtkEditableText *aText, const gchar *aString)
if (!text || !text->IsTextRole())
return;
MAI_LOG_DEBUG(("EditableText: setTextContentsCB, aString=%s", aString));
NS_ConvertUTF8toUTF16 strContent(aString);
text->SetTextContents(strContent);
}
@ -46,9 +44,6 @@ insertTextCB(AtkEditableText *aText,
NS_ConvertUTF8toUTF16 strContent(aString, aLength);
text->InsertText(strContent, *aPosition);
MAI_LOG_DEBUG(("EditableText: insert aString=%s, aLength=%d, aPosition=%d",
aString, aLength, *aPosition));
}
static void
@ -62,8 +57,6 @@ copyTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
if (!text || !text->IsTextRole())
return;
MAI_LOG_DEBUG(("EditableText: copyTextCB, aStartPos=%d, aEndPos=%d",
aStartPos, aEndPos));
text->CopyText(aStartPos, aEndPos);
}
@ -78,8 +71,6 @@ cutTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
if (!text || !text->IsTextRole())
return;
MAI_LOG_DEBUG(("EditableText: cutTextCB, aStartPos=%d, aEndPos=%d",
aStartPos, aEndPos));
text->CutText(aStartPos, aEndPos);
}
@ -94,8 +85,6 @@ deleteTextCB(AtkEditableText *aText, gint aStartPos, gint aEndPos)
if (!text || !text->IsTextRole())
return;
MAI_LOG_DEBUG(("EditableText: deleteTextCB, aStartPos=%d, aEndPos=%d",
aStartPos, aEndPos));
text->DeleteText(aStartPos, aEndPos);
}
@ -110,7 +99,6 @@ pasteTextCB(AtkEditableText *aText, gint aPosition)
if (!text || !text->IsTextRole())
return;
MAI_LOG_DEBUG(("EditableText: pasteTextCB, aPosition=%d", aPosition));
text->PasteText(aPosition);
}
}