X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fupdate%2Fqueue%2Fupdate-message-queue.cpp;h=330234de1c26187e00e0b20f857d84119acf1d5e;hb=refs%2Fchanges%2F45%2F152145%2F7;hp=6722aa9ff02a9b3c849f777701845c3eb3039fd7;hpb=5c66381841dd4dfd82c5a118d34104a00a2e0e1c;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/update/queue/update-message-queue.cpp b/dali/internal/update/queue/update-message-queue.cpp index 6722aa9..330234d 100644 --- a/dali/internal/update/queue/update-message-queue.cpp +++ b/dali/internal/update/queue/update-message-queue.cpp @@ -1,35 +1,28 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // CLASS HEADER #include -// EXTERNAL INCLUDES -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wall" -#include -#pragma clang diagnostic pop -#else -#include -#endif // ifdef __clang - // INTERNAL INCLUDES #include +#include #include +#include #include #include @@ -57,7 +50,7 @@ static const std::size_t MAX_FREE_BUFFER_COUNT = 3; // Allow this number of buff typedef vector< MessageBuffer* > MessageBufferQueue; typedef MessageBufferQueue::iterator MessageBufferIter; -typedef boost::mutex MessageQueueMutex; +typedef Dali::Mutex MessageQueueMutex; } // unnamed namespace @@ -83,7 +76,11 @@ struct MessageQueue::Impl ~Impl() { // Delete the current buffer - delete currentMessageBuffer; + if( currentMessageBuffer ) + { + DeleteBufferContents( currentMessageBuffer ); + delete currentMessageBuffer; + } // Delete the unprocessed buffers const MessageBufferIter processQueueEndIter = processQueue.end(); @@ -139,7 +136,7 @@ struct MessageQueue::Impl MessageBufferQueue freeQueue; ///< buffers from the recycleQueue; can be used without locking }; -MessageQueue::MessageQueue( RenderController& controller, const SceneGraphBuffers& buffers ) +MessageQueue::MessageQueue( Integration::RenderController& controller, const SceneGraph::SceneGraphBuffers& buffers ) : mImpl(NULL) { mImpl = new Impl( controller, buffers ); @@ -152,10 +149,11 @@ MessageQueue::~MessageQueue() void MessageQueue::EventProcessingStarted() { - mImpl->processingEvents = true; + mImpl->processingEvents = true; // called from event thread } -unsigned int* MessageQueue::ReserveMessageSlot( std::size_t requestedSize, bool updateScene ) +// Called from event thread +unsigned int* MessageQueue::ReserveMessageSlot( unsigned int requestedSize, bool updateScene ) { DALI_ASSERT_DEBUG( 0 != requestedSize ); @@ -195,17 +193,13 @@ unsigned int* MessageQueue::ReserveMessageSlot( std::size_t requestedSize, bool // If we are outside, then we have to request a call to Core::ProcessEvents() on idle. if ( false == mImpl->processingEvents ) { - mImpl->renderController.RequestProcessEventsOnIdle(); + mImpl->renderController.RequestProcessEventsOnIdle( false ); } return mImpl->currentMessageBuffer->ReserveMessageSlot( requestedSize ); } -BufferIndex MessageQueue::GetEventBufferIndex() const -{ - return mImpl->sceneGraphBuffers.GetEventBufferIndex(); -} - +// Called from event thread bool MessageQueue::FlushQueue() { const bool messagesToProcess = ( NULL != mImpl->currentMessageBuffer ); @@ -214,7 +208,7 @@ bool MessageQueue::FlushQueue() if ( messagesToProcess ) { // queueMutex must be locked whilst accessing processQueue or recycleQueue - MessageQueueMutex::scoped_lock lock( mImpl->queueMutex ); + MessageQueueMutex::ScopedLock lock( mImpl->queueMutex ); mImpl->processQueue.push_back( mImpl->currentMessageBuffer ); mImpl->currentMessageBuffer = NULL; @@ -249,12 +243,12 @@ bool MessageQueue::FlushQueue() return messagesToProcess; } -void MessageQueue::ProcessMessages() +bool MessageQueue::ProcessMessages( BufferIndex updateBufferIndex ) { PERF_MONITOR_START(PerformanceMonitor::PROCESS_MESSAGES); // queueMutex must be locked whilst accessing queue - MessageQueueMutex::scoped_lock lock( mImpl->queueMutex ); + MessageQueueMutex::ScopedLock lock( mImpl->queueMutex ); const MessageBufferIter processQueueEndIter = mImpl->processQueue.end(); for ( MessageBufferIter iter = mImpl->processQueue.begin(); iter != processQueueEndIter ; ++iter ) @@ -265,7 +259,7 @@ void MessageQueue::ProcessMessages() { MessageBase* message = reinterpret_cast< MessageBase* >( iter.Get() ); - message->Process( mImpl->sceneGraphBuffers.GetUpdateBufferIndex() ); + message->Process( updateBufferIndex ); // Call virtual destructor explictly; since delete will not be called after placement new message->~MessageBase(); @@ -283,6 +277,8 @@ void MessageQueue::ProcessMessages() mImpl->processQueue.clear(); PERF_MONITOR_END(PerformanceMonitor::PROCESS_MESSAGES); + + return ( mImpl->sceneUpdate & 0x01 ); // if it was previously 2, scene graph was updated. } bool MessageQueue::WasEmpty() const