Hey,

2012/1/27 Stephan Bergmann <sberg...@redhat.com>:
> On 01/27/2012 12:11 AM, Markus Mohrhard wrote:
>>
>> - the problem is in
>> connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx:228-235
>> -- the loop is sleeping for 1 ms and therefore running a thousand
>> times per second without doing any real work because there are no
>> events
>>
>> Since this also affects Loading of encrypted documents do we really
>> need to initialize mozilla there? It should work now also without
>> mozilla or am I missing something( see nssinitializer.cxx:197 ).
>
>
> No idea.
>
>
>> If it is still needed, can't we stop the Mozilla_UI_Thread after we
>> opened the encrypted document/library?
>
>
> There's already code there to stop the thread (halleluja), but apparently
> only upon LO shutdown
> (connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx).
>  Hard to tell for me whether there's some easy and safe way to stop it
> earlier (with the added requirement that it can also be restarted correctly
> later, in case another document is loaded later, and that start/stop is
> race-free in the face of multiple documents being loaded simultaneously).
>
> Generally, I would not go near that code (an osl::Condition with multiple
> set/reset is already enough to make me scream, and a missing
> osl_joinWithThread does not raise my confidence, either).
>
>
>> Another easy solution to improve the situation might be to increase
>> the timeout in MNSInit.cxx:235 from 1 to 10 or even 100, but I think
>> that is more a workaround than fixing the underlying problem.
>
>
> Sounds like the best fix to me, at least for -3-5-0.
>

Find attached a simple fix that increases the timout for the Mozilla
UI Thread to 20 ms. I would call this only a workaround but at least
it makes it much better in this case. I no longer get an incredible
cpu load after opening a password protected document.

Markus
From 8eb74bc2043f414db5b38033a416feedce52aa6e Mon Sep 17 00:00:00 2001
From: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date: Thu, 2 Feb 2012 00:54:35 +0100
Subject: [PATCH] increase the sleep time of the Mozilla UI Thread

---
 .../source/drivers/mozab/bootstrap/MNSInit.cxx     |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx
index d80ac4e..e9d8222 100644
--- a/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx
+++ b/connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx
@@ -231,8 +231,8 @@ void MNS_XPCOM_EventLoop()
         if (NS_FAILED(rv))
             return ;
         if (event)
-        eventQ->HandleEvent(event);
-    }while ( PR_SUCCESS == PR_Sleep( PR_MillisecondsToInterval(1)) && aLive );
+            eventQ->HandleEvent(event);
+    }while ( PR_SUCCESS == PR_Sleep( PR_MillisecondsToInterval(20)) && aLive );
 
     eventQ->ProcessPendingEvents();
     OSL_TRACE( "OUT : MNS_XPCOM_EventLoop()" );
-- 
1.7.7

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to