[4.0] Added interface to install logging function 13/192913/1
authorDavid Steele <david.steele@samsung.com>
Thu, 23 Nov 2017 21:49:12 +0000 (21:49 +0000)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 13 Nov 2018 01:33:47 +0000 (10:33 +0900)
Change-Id: Iade8933c638d18a3bb4fc8d42669cfd9892394d8

adaptors/base/environment-options.h
adaptors/common/adaptor-impl.cpp
adaptors/common/adaptor-impl.h
adaptors/common/adaptor.cpp
adaptors/integration-api/adaptor.h
adaptors/integration-api/file.list
adaptors/integration-api/log-factory-interface.h [new file with mode: 0644]

index fe05453..af04593 100644 (file)
@@ -23,6 +23,7 @@
 
 // INTERNAL INCLUDES
 #include <base/threading-mode.h>
+#include <log-factory-interface.h>
 
 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.
index 67e759f..f4a7e91 100755 (executable)
@@ -825,6 +825,11 @@ void Adaptor::RenderOnce()
   RequestUpdateOnce();
 }
 
+const LogFactoryInterface& Adaptor::GetLogFactory()
+{
+  return *mEnvironmentOptions;
+}
+
 void Adaptor::RequestUpdateOnce()
 {
   if( mThreadController )
index ae27285..045272b 100755 (executable)
@@ -364,6 +364,11 @@ public:
    */
   void RenderOnce();
 
+  /**
+   * @copydoc Dali::Adaptor::GetLogFactory
+   */
+  const LogFactoryInterface& GetLogFactory();
+
 public:  //AdaptorInternalServices
 
   /**
index c6cc3fa..6f7cf09 100644 (file)
@@ -189,6 +189,11 @@ void Adaptor::RenderOnce()
   mImpl->RenderOnce();
 }
 
+const LogFactoryInterface& Adaptor::GetLogFactory()
+{
+  return mImpl->GetLogFactory();
+}
+
 Adaptor::Adaptor()
 : mImpl( NULL )
 {
index 9e87551..0a6553d 100644 (file)
 #include <dali/public-api/adaptor-framework/application-configuration.h>
 #endif
 
+#ifdef DALI_ADAPTOR_COMPILATION
+#include <log-factory-interface.h>
+#else
+#include <dali/integration-api/adaptors/log-factory-interface.h>
+#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
 
   /**
index 32a2317..bd2996f 100644 (file)
@@ -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 (file)
index 0000000..5c6a7ea
--- /dev/null
@@ -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