From: David Steele Date: Thu, 23 Nov 2017 21:49:47 +0000 (+0000) Subject: Added logging function to image loader threads X-Git-Tag: dali_1.3.11~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=5ad4aa759c6ad7194d95100eb2e5472343ba74f0 Added logging function to image loader threads Change-Id: I766605855228ad86fd35e09774e0b82e5f7d1f90 --- diff --git a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt index 64f876b..8b2160f 100755 --- a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt @@ -32,6 +32,7 @@ SET(TC_SOURCES # Append list of test harness files (Won't get parsed for test cases) LIST(APPEND TC_SOURCES + ../dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp ../dali-toolkit/dali-toolkit-test-utils/toolkit-clipboard.cpp diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp index 4b25c5d..3ff177c 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -21,6 +21,8 @@ #include #include +#include +#include namespace Dali { @@ -210,6 +212,34 @@ void Adaptor::SetStereoBase( float stereoBase ) { } + +class LogFactory : public LogFactoryInterface +{ +public: + virtual void InstallLogFunction() const + { + Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage); + Dali::Integration::Log::InstallLogFunction(logFunction); + } + + LogFactory() + { + } + virtual ~LogFactory() + { + } +}; + +LogFactory* gLogFactory = NULL; +const LogFactoryInterface& Adaptor::GetLogFactory() +{ + if( gLogFactory == NULL ) + { + gLogFactory = new LogFactory; + } + return *gLogFactory; +} + Adaptor::Adaptor() : mImpl( NULL ) { diff --git a/dali-toolkit/internal/image-loader/image-load-thread.cpp b/dali-toolkit/internal/image-loader/image-load-thread.cpp index 7e0a181..857a55b 100644 --- a/dali-toolkit/internal/image-loader/image-load-thread.cpp +++ b/dali-toolkit/internal/image-loader/image-load-thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include namespace Dali { @@ -56,7 +57,8 @@ void LoadingTask::Load() ImageLoadThread::ImageLoadThread( EventThreadCallback* trigger ) -: mTrigger( trigger ) +: mTrigger( trigger ), + mLogFactory( Dali::Adaptor::Get().GetLogFactory() ) { } @@ -72,6 +74,8 @@ ImageLoadThread::~ImageLoadThread() void ImageLoadThread::Run() { + mLogFactory.InstallLogFunction(); + while( LoadingTask* task = NextTaskToProcess() ) { task->Load(); diff --git a/dali-toolkit/internal/image-loader/image-load-thread.h b/dali-toolkit/internal/image-loader/image-load-thread.h index 3d0ad24..c3f230c 100644 --- a/dali-toolkit/internal/image-loader/image-load-thread.h +++ b/dali-toolkit/internal/image-loader/image-load-thread.h @@ -2,7 +2,7 @@ #define __DALI_TOOLKIT_IMAGE_LOAD_THREAD_H__ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -26,6 +26,7 @@ #include #include #include +#include #include namespace Dali @@ -162,10 +163,11 @@ private: Vector< LoadingTask* > mLoadQueue; /// mCompleteQueue; ///