[Libreoffice-commits] .: Branch 'feature/remote' - sd/source
Andrzej J.R. Hunt
ajrhunt at kemper.freedesktop.org
Wed Jul 18 13:07:19 PDT 2012
sd/source/ui/inc/Server.hxx | 3 ++-
sd/source/ui/remotecontrol/Listener.cxx | 2 +-
sd/source/ui/remotecontrol/Receiver.cxx | 1 +
sd/source/ui/remotecontrol/Server.cxx | 11 ++++++-----
sd/source/ui/remotecontrol/Transmitter.cxx | 16 ++++++++++++----
5 files changed, 22 insertions(+), 11 deletions(-)
New commits:
commit 2fc2fc14f8278d5f956a88a4d8e2b42e1a06d38a
Author: Andrzej J. R. Hunt <andrzej at ahunt.org>
Date: Wed Jul 18 22:04:09 2012 +0200
Further minor improvements, attempt to fix the Transmitter bug.
Change-Id: I558b7aca1c592efb5b83b56df42da4a97a655e88
diff --git a/sd/source/ui/inc/Server.hxx b/sd/source/ui/inc/Server.hxx
index 9abb24e..8447292 100644
--- a/sd/source/ui/inc/Server.hxx
+++ b/sd/source/ui/inc/Server.hxx
@@ -16,6 +16,7 @@
#include <sys/types.h>
#include <osl/socket.hxx>
+#include <rtl/ref.hxx>
#include <salhelper/thread.hxx>
#include <com/sun/star/presentation/XSlideShowController.hpp>
@@ -50,7 +51,7 @@ namespace sd
void listenThread();
void execute();
static Transmitter *pTransmitter;
- static css::uno::Reference<Listener> mListener;
+ static rtl::Reference<Listener> mListener;
};
}
diff --git a/sd/source/ui/remotecontrol/Listener.cxx b/sd/source/ui/remotecontrol/Listener.cxx
index 959b076..a21977e 100644
--- a/sd/source/ui/remotecontrol/Listener.cxx
+++ b/sd/source/ui/remotecontrol/Listener.cxx
@@ -91,7 +91,7 @@ void SAL_CALL Listener::slideEnded (sal_Bool bReverse)
if ( pTransmitter )
{
fprintf( stderr, "Transmitter is, transmitting.\n" );
- pTransmitter->addMessage( aBuilder.makeStringAndClear() ,
+ pTransmitter->addMessage( aBuilder.makeStringAndClear(),
Transmitter::Priority::HIGH );
}
fprintf( stderr, "Transmitted\n" );
diff --git a/sd/source/ui/remotecontrol/Receiver.cxx b/sd/source/ui/remotecontrol/Receiver.cxx
index f69c98e..86a1a03 100644
--- a/sd/source/ui/remotecontrol/Receiver.cxx
+++ b/sd/source/ui/remotecontrol/Receiver.cxx
@@ -59,6 +59,7 @@ void Receiver::parseCommand( std::vector<OString> aCommand )
}
catch ( com::sun::star::uno::RuntimeException &e )
{
+ fprintf( stderr, "Error in retrieving Controller\n" );
//return;
}
diff --git a/sd/source/ui/remotecontrol/Server.cxx b/sd/source/ui/remotecontrol/Server.cxx
index 2531047..8ed3b70 100644
--- a/sd/source/ui/remotecontrol/Server.cxx
+++ b/sd/source/ui/remotecontrol/Server.cxx
@@ -17,6 +17,7 @@
#include "Receiver.hxx"
#include "Listener.hxx"
+
using namespace std;
using namespace sd;
using namespace ::com::sun::star;
@@ -34,8 +35,6 @@ Server::~Server()
// Run as a thread
void Server::listenThread()
{
-// Transmitter aTransmitter( mStreamSocket );
-// Transmitter aTransmitter( mStreamSocket);
pTransmitter = new Transmitter( mStreamSocket );
pTransmitter->launch();
Receiver aReceiver( pTransmitter );
@@ -100,7 +99,7 @@ void Server::listenThread()
// TODO: deal with transmision errors gracefully.
}
- mListener->disposing();
+ mListener->dispose();
mListener = NULL;
delete pTransmitter;
pTransmitter = NULL;
@@ -137,7 +136,9 @@ void Server::presentationStarted( const css::uno::Reference<
{
Listener *aListener = new Listener( pTransmitter );
aListener->init( rController );
- mListener = css::uno::Reference<Listener>( aListener );
+ fprintf( stderr, "presentationStarted:init--done\n");
+ mListener = rtl::Reference<Listener>( aListener );
+ fprintf( stderr, "presentationStarted:mListener--done\n");
}
}
@@ -145,7 +146,7 @@ void Server::presentationStarted( const css::uno::Reference<
Server *sd::Server::spServer = NULL;
Transmitter *sd::Server::pTransmitter = NULL;
-css::uno::Reference<Listener> sd::Server::mListener = NULL;
+rtl::Reference<Listener> sd::Server::mListener = NULL;
void Server::setup()
{
diff --git a/sd/source/ui/remotecontrol/Transmitter.cxx b/sd/source/ui/remotecontrol/Transmitter.cxx
index 341438b..d7cfda0 100644
--- a/sd/source/ui/remotecontrol/Transmitter.cxx
+++ b/sd/source/ui/remotecontrol/Transmitter.cxx
@@ -23,8 +23,7 @@ Transmitter::Transmitter( StreamSocket &aSocket )
{
}
-void
-Transmitter::execute()
+void Transmitter::execute()
{
fprintf( stderr, "Waiting\n" );
while( mQueuesNotEmpty.wait() )
@@ -32,7 +31,9 @@ Transmitter::execute()
fprintf( stderr, "Continuing after condition\n" );
while ( true )
{
+ fprintf( stderr, "Trying to acquire mutex in Transmitter Thread\n" );
::osl::MutexGuard aQueueGuard( mQueueMutex );
+ fprintf( stderr, "Acquired mutex in Transmitter Thread\n" );
while ( mHighPriority.size() )
{
OString aMessage( mHighPriority.front() );
@@ -77,15 +78,22 @@ void Transmitter::addMessage( const OString& aMessage, const Priority aPriority
mLowPriority.push( aMessage );
break;
case Priority::HIGH:
- fprintf(stderr, "PushingHigh\n%s\n", aMessage.getStr() );
+ fprintf(stderr, "PushingHigh\n<<<%s>>>\n", aMessage.getStr() );
mHighPriority.push( aMessage );
break;
}
fprintf( stderr, "Setting\n" );
if ( !mQueuesNotEmpty.check() )
+ {
mQueuesNotEmpty.set();
+ fprintf( stderr, "Condition has now been set\n" );
+ }
+ else
+ {
+ fprintf( stderr, "Condition was already set\n" );
+ }
fprintf( stderr, "Added\n" );
-
+ fprintf( stderr, "Front:\n<<<%s>>>\n", mHighPriority.front().getStr() );
}
More information about the Libreoffice-commits
mailing list