Added interface to install logging function 11/161511/3
authorDavid Steele <david.steele@samsung.com>
Thu, 23 Nov 2017 21:49:12 +0000 (21:49 +0000)
committerDavid Steele <david.steele@samsung.com>
Tue, 6 Feb 2018 20:55:16 +0000 (20:55 +0000)
Change-Id: Iade8933c638d18a3bb4fc8d42669cfd9892394d8

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

index 0a8a650..3a9e690 100644 (file)
 #include <dali/public-api/adaptor-framework/window.h>
 #include <dali/public-api/adaptor-framework/application-configuration.h>
 
+#ifdef DALI_ADAPTOR_COMPILATION
+#include <dali/integration-api/log-factory-interface.h>
+#else
+#include <dali/integration-api/adaptors/log-factory-interface.h>
+#endif
+
 
 namespace Dali
 {
@@ -335,6 +341,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 60deaf8..9100a28 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/dali/integration-api/log-factory-interface.h b/dali/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
index 2e64c48..fcf9724 100644 (file)
@@ -810,6 +810,11 @@ void Adaptor::RenderOnce()
   RequestUpdateOnce();
 }
 
+const LogFactoryInterface& Adaptor::GetLogFactory()
+{
+  return *mEnvironmentOptions;
+}
+
 void Adaptor::RequestUpdateOnce()
 {
   if( mThreadController )
index 8d70b83..c544383 100644 (file)
@@ -359,6 +359,11 @@ public:
    */
   void RenderOnce();
 
+  /**
+   * @copydoc Dali::Adaptor::GetLogFactory
+   */
+  const LogFactoryInterface& GetLogFactory();
+
 public:  //AdaptorInternalServices
 
   /**
index b8cf1b1..789fc70 100644 (file)
@@ -189,6 +189,11 @@ void Adaptor::RenderOnce()
   mImpl->RenderOnce();
 }
 
+const LogFactoryInterface& Adaptor::GetLogFactory()
+{
+  return mImpl->GetLogFactory();
+}
+
 Adaptor::Adaptor()
 : mImpl( NULL )
 {
index 13ba3ff..3daf7d1 100644 (file)
@@ -23,6 +23,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/internal/adaptor/common/threading-mode.h>
+#include <dali/integration-api/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.