X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=modules%2Fsocket%2Fsrc%2Fwaitable_input_output_execution_context_support.cpp;fp=modules_mobile%2Fsocket%2Fsrc%2Fwaitable_input_output_execution_context_support.cpp;h=fa9622231e6d08c55d29d7ff91a5dd4a5d1afd1c;hb=3a034abb4dca58ff0940687d8dd2b829ce2e226f;hp=35635b51bd70116c1973e8722cd3911c557c72e0;hpb=58be0971049907f3166ce56a6ad509769565158f;p=framework%2Fweb%2Fwrt-commons.git diff --git a/modules_mobile/socket/src/waitable_input_output_execution_context_support.cpp b/modules/socket/src/waitable_input_output_execution_context_support.cpp old mode 100644 new mode 100755 similarity index 78% rename from modules_mobile/socket/src/waitable_input_output_execution_context_support.cpp rename to modules/socket/src/waitable_input_output_execution_context_support.cpp index 35635b5..fa96222 --- a/modules_mobile/socket/src/waitable_input_output_execution_context_support.cpp +++ b/modules/socket/src/waitable_input_output_execution_context_support.cpp @@ -22,9 +22,8 @@ */ #include #include -#include #include // FIXME: Remove !!! -#include +#include #include namespace DPL { @@ -56,7 +55,7 @@ void WaitableInputOutputExecutionContextSupport::Open( Throw(Exception::AlreadyOpened); } - LogPedantic("Opening waitable input-output execution context support..."); + WrtLogD("Opening waitable input-output execution context support..."); // Save IO handle m_waitableInputOutput = inputOutput; @@ -70,7 +69,7 @@ void WaitableInputOutputExecutionContextSupport::Open( // Done m_opened = true; - LogPedantic("Waitable input-output execution context support opened"); + WrtLogD("Waitable input-output execution context support opened"); } void WaitableInputOutputExecutionContextSupport::Close() @@ -79,7 +78,7 @@ void WaitableInputOutputExecutionContextSupport::Close() return; } - LogPedantic("Closing waitable input-output execution context support..."); + WrtLogD("Closing waitable input-output execution context support..."); // Remove read and write watches CheckedRemoveReadWriteWatch(); @@ -87,43 +86,51 @@ void WaitableInputOutputExecutionContextSupport::Close() // Set proper state m_opened = false; - LogPedantic("Waitable input-output execution context support closed"); + WrtLogD("Waitable input-output execution context support closed"); } void WaitableInputOutputExecutionContextSupport::AddReadWatch() { - WaitableHandleWatchSupport::InheritedContext()->AddWaitableHandleWatch( - this, - m_waitableInputOutput - ->WaitableReadHandle(), - WaitMode - ::Read); + WaitableHandleWatchSupport* ctx = + WaitableHandleWatchSupport::InheritedContext(); + if(ctx) + ctx->AddWaitableHandleWatch( + this, + m_waitableInputOutput->WaitableReadHandle(), + WaitMode::Read); } void WaitableInputOutputExecutionContextSupport::RemoveReadWatch() { - WaitableHandleWatchSupport::InheritedContext()->RemoveWaitableHandleWatch( - this, - m_waitableInputOutput->WaitableReadHandle(), - WaitMode::Read); + WaitableHandleWatchSupport* ctx = + WaitableHandleWatchSupport::InheritedContext(); + if(ctx) + ctx->RemoveWaitableHandleWatch( + this, + m_waitableInputOutput->WaitableReadHandle(), + WaitMode::Read); } void WaitableInputOutputExecutionContextSupport::AddWriteWatch() { - WaitableHandleWatchSupport::InheritedContext()->AddWaitableHandleWatch( - this, - m_waitableInputOutput - ->WaitableWriteHandle(), - WaitMode - ::Write); + WaitableHandleWatchSupport* ctx = + WaitableHandleWatchSupport::InheritedContext(); + if(ctx) + ctx->AddWaitableHandleWatch( + this, + m_waitableInputOutput->WaitableWriteHandle(), + WaitMode::Write); } void WaitableInputOutputExecutionContextSupport::RemoveWriteWatch() { - WaitableHandleWatchSupport::InheritedContext()->RemoveWaitableHandleWatch( - this, - m_waitableInputOutput->WaitableWriteHandle(), - WaitMode::Write); + WaitableHandleWatchSupport* ctx = + WaitableHandleWatchSupport::InheritedContext(); + if(ctx) + ctx->RemoveWaitableHandleWatch( + this, + m_waitableInputOutput->WaitableWriteHandle(), + WaitMode::Write); } void WaitableInputOutputExecutionContextSupport::CheckedRemoveReadWatch() @@ -163,7 +170,7 @@ void WaitableInputOutputExecutionContextSupport::OnWaitableHandleEvent( switch (mode) { case WaitMode::Read: - LogPedantic("Read event occurred"); + WrtLogD("Read event occurred"); // Read and parse bytes ReadInput(); @@ -172,7 +179,7 @@ void WaitableInputOutputExecutionContextSupport::OnWaitableHandleEvent( break; case WaitMode::Write: - LogPedantic("Write event occurred"); + WrtLogD("Write event occurred"); // Push bytes and unregister from write event FeedOutput(); @@ -194,7 +201,7 @@ void WaitableInputOutputExecutionContextSupport::OnWaitableHandleEvent( void WaitableInputOutputExecutionContextSupport::ReadInput() { - LogPedantic("Reading input bytes"); + WrtLogD("Reading input bytes"); Try { @@ -203,7 +210,7 @@ void WaitableInputOutputExecutionContextSupport::ReadInput() if (inputBuffer.get() == NULL) { // No data, should not occur - LogPedantic("WARNING: Spontaneous ReadSocket occurred"); + WrtLogD("WARNING: Spontaneous ReadSocket occurred"); return; } @@ -222,7 +229,7 @@ void WaitableInputOutputExecutionContextSupport::ReadInput() return; } - LogPedantic("Read " << inputBuffer->Size() << " input bytes"); + WrtLogD("Read %i input bytes", inputBuffer->Size()); // Append all read data m_inputStream.AppendMoveFrom(*inputBuffer); @@ -232,7 +239,7 @@ void WaitableInputOutputExecutionContextSupport::ReadInput() //FIXME: Inproper exception abstraction!!! // Some errors occurred while feeding abstract IO // Interpret connection broken errors, and pass futher other ones - LogPedantic("Abstract IO connection was broken during read"); + WrtLogD("Abstract IO connection was broken during read"); // Signal broken connection OnInputStreamBroken(); @@ -264,7 +271,7 @@ void WaitableInputOutputExecutionContextSupport::FeedOutput() } // OK to feed output - LogPedantic("Feeding output"); + WrtLogD("Feeding output"); Try { @@ -279,7 +286,7 @@ void WaitableInputOutputExecutionContextSupport::FeedOutput() AddWriteWatch(); m_hasWriteWatch = true; - LogPedantic("Started exhaustive output feeding"); + WrtLogD("Started exhaustive output feeding"); } } @@ -292,7 +299,7 @@ void WaitableInputOutputExecutionContextSupport::FeedOutput() { // Some errors occurred while feeding abstract IO // Interpret connection broken errors, and pass futher other ones - LogPedantic("Abstract IO connection was broken during write"); + WrtLogD("Abstract IO connection was broken during write"); // Signal broken connection OnInputStreamBroken();