From: David Steele Date: Thu, 23 Nov 2017 21:49:12 +0000 (+0000) Subject: [4.0] Added interface to install logging function X-Git-Tag: accepted/tizen/4.0/unified/20190104.230754~8 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=3576318977e39ac22cd30ae82e9f3b52fe255b7f [4.0] Added interface to install logging function Change-Id: Iade8933c638d18a3bb4fc8d42669cfd9892394d8 --- diff --git a/adaptors/base/environment-options.h b/adaptors/base/environment-options.h index fe05453..af04593 100644 --- a/adaptors/base/environment-options.h +++ b/adaptors/base/environment-options.h @@ -23,6 +23,7 @@ // INTERNAL INCLUDES #include +#include namespace Dali { @@ -36,7 +37,7 @@ namespace Adaptor * the ability to install a log function. * */ -class EnvironmentOptions +class EnvironmentOptions : public Dali::LogFactoryInterface { public: @@ -46,9 +47,9 @@ public: EnvironmentOptions(); /** - * non-virtual destructor, not intended as a base class + * Virtual Destructor for interface cleanup */ - ~EnvironmentOptions(); + virtual ~EnvironmentOptions(); /** * @param logFunction logging function @@ -58,7 +59,7 @@ public: /** * Install the log function for the current thread. */ - void InstallLogFunction() const; + virtual void InstallLogFunction() const; /** * Un-install the log function for the current thread. diff --git a/adaptors/common/adaptor-impl.cpp b/adaptors/common/adaptor-impl.cpp index 67e759f..f4a7e91 100755 --- a/adaptors/common/adaptor-impl.cpp +++ b/adaptors/common/adaptor-impl.cpp @@ -825,6 +825,11 @@ void Adaptor::RenderOnce() RequestUpdateOnce(); } +const LogFactoryInterface& Adaptor::GetLogFactory() +{ + return *mEnvironmentOptions; +} + void Adaptor::RequestUpdateOnce() { if( mThreadController ) diff --git a/adaptors/common/adaptor-impl.h b/adaptors/common/adaptor-impl.h index ae27285..045272b 100755 --- a/adaptors/common/adaptor-impl.h +++ b/adaptors/common/adaptor-impl.h @@ -364,6 +364,11 @@ public: */ void RenderOnce(); + /** + * @copydoc Dali::Adaptor::GetLogFactory + */ + const LogFactoryInterface& GetLogFactory(); + public: //AdaptorInternalServices /** diff --git a/adaptors/common/adaptor.cpp b/adaptors/common/adaptor.cpp index c6cc3fa..6f7cf09 100644 --- a/adaptors/common/adaptor.cpp +++ b/adaptors/common/adaptor.cpp @@ -189,6 +189,11 @@ void Adaptor::RenderOnce() mImpl->RenderOnce(); } +const LogFactoryInterface& Adaptor::GetLogFactory() +{ + return mImpl->GetLogFactory(); +} + Adaptor::Adaptor() : mImpl( NULL ) { diff --git a/adaptors/integration-api/adaptor.h b/adaptors/integration-api/adaptor.h index 9e87551..0a6553d 100644 --- a/adaptors/integration-api/adaptor.h +++ b/adaptors/integration-api/adaptor.h @@ -36,6 +36,12 @@ #include #endif +#ifdef DALI_ADAPTOR_COMPILATION +#include +#else +#include +#endif + namespace Dali { @@ -342,6 +348,12 @@ public: */ void RenderOnce(); + /** + * @brief The log factory allows installation of a logger function in worker threads. + * @return An interface to a logging factory + */ + const LogFactoryInterface& GetLogFactory(); + public: // Signals /** diff --git a/adaptors/integration-api/file.list b/adaptors/integration-api/file.list index 32a2317..bd2996f 100644 --- a/adaptors/integration-api/file.list +++ b/adaptors/integration-api/file.list @@ -1,6 +1,7 @@ adaptor_integration_api_header_files = \ $(adaptor_integration_api_dir)/adaptor.h \ $(adaptor_integration_api_dir)/egl-interface.h \ + $(adaptor_integration_api_dir)/log-factory-interface.h \ $(adaptor_integration_api_dir)/thread-synchronization-interface.h \ $(adaptor_integration_api_dir)/trigger-event-interface.h \ $(adaptor_integration_api_dir)/trigger-event-factory-interface.h \ diff --git a/adaptors/integration-api/log-factory-interface.h b/adaptors/integration-api/log-factory-interface.h new file mode 100644 index 0000000..5c6a7ea --- /dev/null +++ b/adaptors/integration-api/log-factory-interface.h @@ -0,0 +1,37 @@ +#ifndef DALI_ADAPTOR_LOG_FACTORY_INTERFACE_H +#define DALI_ADAPTOR_LOG_FACTORY_INTERFACE_H + +/* + * 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. + * 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. + */ + +namespace Dali +{ + +class LogFactoryInterface +{ +public: + /** + * @brief Install a log function for this thread. + * + * Only need to use once per thread, before any processing occurs. + */ + virtual void InstallLogFunction() const = 0; +}; + +} // namespace Dali + + +#endif //DALI_ADAPTOR_LOG_FACTORY_INTERFACE_H