summaryrefslogtreecommitdiff
path: root/comphelper/source/misc/uieventslogger.cxx
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-02-13 11:55:44 +0000
committerOliver Bolte <obo@openoffice.org>2009-02-13 11:55:44 +0000
commit6ecb6ca9ab45dbcc35463c95025ad84ab2a6bda9 (patch)
treed64ca584ad98a2c32d80987f49bde4b3e227ac78 /comphelper/source/misc/uieventslogger.cxx
parent6366f1e08bedfc1ed6fd654d5fc722a4818f619f (diff)
CWS-TOOLING: integrate CWS oooimprovement2
2009-01-28 14:35:33 +0100 b_michaelsen r267059 : #i98555# fixed help url 2009-01-27 12:47:40 +0100 b_michaelsen r266982 : #159112# fixed enabling vcl part of usage tracking in an running session 2009-01-27 12:28:58 +0100 b_michaelsen r266980 : #159129# deiniting eventlogger in vcl if it was inited, not if it was enabled (the logger can be disabled inbetween 2009-01-27 12:22:45 +0100 b_michaelsen r266978 : whitespace fixes 2009-01-27 10:32:02 +0100 b_michaelsen r266962 : #i94949# disposing of uploader thread 2009-01-23 17:00:57 +0100 b_michaelsen r266839 : #159112# enabling/disabling of usage tracking takes effect without restart 2009-01-23 16:58:59 +0100 b_michaelsen r266837 : #159112# enabling/disabling of usage tracking takes effect without restart 2009-01-23 01:08:49 +0100 b_michaelsen r266761 : #159081# fixed buildid in oooimprovement 2009-01-22 22:51:16 +0100 b_michaelsen r266759 : #i90370# including build id 2009-01-22 15:37:05 +0100 b_michaelsen r266727 : #i90370# fixing precompiled headers for win32 2009-01-22 15:34:05 +0100 b_michaelsen r266722 : #i90370# initializing startup counter 2009-01-22 15:30:52 +0100 b_michaelsen r266720 : #i90370# enabling startup counter 2009-01-21 13:52:56 +0100 b_michaelsen r266666 : #i98143# adjusted smoketest for usage tracking 2009-01-20 18:34:12 +0100 b_michaelsen r266617 : #i90370# 2009-01-20 15:08:45 +0100 is r266587 : #i90370# new improvement feature 2009-01-20 14:42:39 +0100 b_michaelsen r266583 : #i90370# changing delivered job registration location 2009-01-20 12:35:31 +0100 is r266567 : #i90370# new improvement feature 2009-01-20 12:33:51 +0100 is r266566 : #i90370# new improvement feature 2009-01-20 12:33:20 +0100 is r266565 : #i90370# new improvement feature 2009-01-20 11:47:13 +0100 b_michaelsen r266559 : #i90370# updating Usage Tracking Info Url 2009-01-20 11:28:37 +0100 b_michaelsen r266558 : #i90370# packing Usage Tracking config schema (xcs) 2009-01-20 11:19:00 +0100 b_michaelsen r266557 : #i90370# adding Usage Tracking config schema (xcs) 2009-01-19 18:16:34 +0100 b_michaelsen r266518 : #i90370# adding job registration (xcu) 2009-01-19 17:26:02 +0100 b_michaelsen r266513 : #i90370# adding liboooimprovement
Diffstat (limited to 'comphelper/source/misc/uieventslogger.cxx')
-rw-r--r--comphelper/source/misc/uieventslogger.cxx61
1 files changed, 40 insertions, 21 deletions
diff --git a/comphelper/source/misc/uieventslogger.cxx b/comphelper/source/misc/uieventslogger.cxx
index a60ecc9058de..218cea4ed9d1 100644
--- a/comphelper/source/misc/uieventslogger.cxx
+++ b/comphelper/source/misc/uieventslogger.cxx
@@ -132,7 +132,6 @@ namespace comphelper
bool m_Active;
TimeValue m_LastLogEventTime;
- Mutex m_LogMutex;
const OUString m_LogPath;
const TimeValue m_IdleTimeout;
sal_Int32 m_SessionLogEventCount;
@@ -145,6 +144,7 @@ namespace comphelper
// static methods and data
static ptr getInstance();
+ static void prepareMutex();
static bool shouldActivate();
static bool getEnabledFromCoreController();
static bool getEnabledFromCfg();
@@ -218,17 +218,19 @@ namespace comphelper
sal_Bool UiEventsLogger::isEnabled()
{
try {
- UiEventsLogger_Impl::ptr inst = UiEventsLogger_Impl::getInstance();
- if(inst==UiEventsLogger_Impl::ptr()) return false;
- return inst->m_Active;
+ UiEventsLogger_Impl::prepareMutex();
+ Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex);
+ return UiEventsLogger_Impl::getInstance()->m_Active;
} catch(...) { return false; } // never throws
}
sal_Int32 UiEventsLogger::getSessionLogEventCount()
{
- UiEventsLogger_Impl::ptr inst = UiEventsLogger_Impl::getInstance();
- if(inst==UiEventsLogger_Impl::ptr()) return 0;
- return inst->m_SessionLogEventCount;
+ try {
+ UiEventsLogger_Impl::prepareMutex();
+ Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex);
+ return UiEventsLogger_Impl::getInstance()->m_SessionLogEventCount;
+ } catch(...) { return 0; } // never throws
}
void UiEventsLogger::appendDispatchOrigin(
@@ -262,8 +264,9 @@ namespace comphelper
const Sequence<PropertyValue>& args)
{
try {
- UiEventsLogger_Impl::ptr inst = UiEventsLogger_Impl::getInstance();
- if(inst!=UiEventsLogger_Impl::ptr()) inst->logDispatch(url, args);
+ UiEventsLogger_Impl::prepareMutex();
+ Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex);
+ UiEventsLogger_Impl::getInstance()->logDispatch(url, args);
} catch(...) { } // never throws
}
@@ -275,8 +278,9 @@ namespace comphelper
const OUString& param)
{
try {
- UiEventsLogger_Impl::ptr inst = UiEventsLogger_Impl::getInstance();
- if(inst!=UiEventsLogger_Impl::ptr()) inst->logVcl(parent_id, window_type, id, method, param);
+ UiEventsLogger_Impl::prepareMutex();
+ Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex);
+ UiEventsLogger_Impl::getInstance()->logVcl(parent_id, window_type, id, method, param);
} catch(...) { } // never throws
}
@@ -303,8 +307,23 @@ namespace comphelper
void UiEventsLogger::disposing()
{
+ // we dont want to create an instance just to dispose it
+ UiEventsLogger_Impl::prepareMutex();
+ Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex);
if(UiEventsLogger_Impl::instance!=UiEventsLogger_Impl::ptr())
+ UiEventsLogger_Impl::getInstance()->disposing();
+ }
+
+ void UiEventsLogger::reinit()
+ {
+ UiEventsLogger_Impl::prepareMutex();
+ Guard<Mutex> singleton_guard(UiEventsLogger_Impl::singleton_mutex);
+ if(UiEventsLogger_Impl::instance)
+ {
UiEventsLogger_Impl::instance->disposing();
+ delete UiEventsLogger_Impl::instance;
+ UiEventsLogger_Impl::instance = NULL;
+ }
}
// private UiEventsLogger_Impl methods
@@ -325,7 +344,6 @@ namespace comphelper
const URL& url,
const Sequence<PropertyValue>& args)
{
- Guard<Mutex> log_guard(m_LogMutex);
if(!m_Active) return;
if(!url.Complete.match(URL_UNO) && !url.Complete.match(URL_FILE)) return;
checkIdleTimeout();
@@ -377,7 +395,6 @@ namespace comphelper
const OUString& method,
const OUString& param)
{
- Guard<Mutex> log_guard(m_LogMutex);
if(!m_Active) return;
checkIdleTimeout();
@@ -600,19 +617,22 @@ namespace comphelper
}
UiEventsLogger_Impl::ptr UiEventsLogger_Impl::instance = UiEventsLogger_Impl::ptr();
- Mutex * UiEventsLogger_Impl::singleton_mutex = NULL;
UiEventsLogger_Impl::ptr UiEventsLogger_Impl::getInstance()
{
- if(singleton_mutex==NULL)
+ if(instance == NULL)
+ instance = UiEventsLogger_Impl::ptr(new UiEventsLogger_Impl());
+ return instance;
+ }
+
+ Mutex * UiEventsLogger_Impl::singleton_mutex = NULL;
+ void UiEventsLogger_Impl::prepareMutex()
+ {
+ if(singleton_mutex == NULL)
{
Guard<Mutex> global_guard(Mutex::getGlobalMutex());
- if(singleton_mutex==NULL)
+ if(singleton_mutex == NULL)
singleton_mutex = new Mutex();
}
- Guard<Mutex> singleton_guard(singleton_mutex);
- if(instance == 0)
- instance = UiEventsLogger_Impl::ptr(new UiEventsLogger_Impl());
- return instance;
}
sal_Int32 UiEventsLogger_Impl::findIdx(const Sequence<PropertyValue>& args, const OUString& key)
@@ -625,7 +645,6 @@ namespace comphelper
void UiEventsLogger_Impl::disposing()
{
- Guard<Mutex> log_guard(m_LogMutex);
m_Active = false;
m_Logger.clear() ;
m_LogHandler.clear();