Removed redundant resource loading code 08/113008/8
authorFrancisco Santos <f1.santos@samsung.com>
Tue, 21 Feb 2017 18:31:53 +0000 (18:31 +0000)
committerFrancisco Santos <f1.santos@samsung.com>
Fri, 24 Feb 2017 14:14:15 +0000 (14:14 +0000)
Change-Id: Ib378615988f107271e9d570fe320b1e636900ba5

34 files changed:
adaptors/base/update-status-logger.cpp
adaptors/common/style-monitor-impl.cpp
adaptors/common/style-monitor-impl.h
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-platform-abstraction.cpp
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-platform-abstraction.h
automated-tests/src/dali-platform-abstraction/CMakeLists.txt
automated-tests/src/dali-platform-abstraction/resource-collector.cpp [deleted file]
automated-tests/src/dali-platform-abstraction/resource-collector.h [deleted file]
automated-tests/src/dali-platform-abstraction/utc-image-fitting-modes.cpp
automated-tests/src/dali-platform-abstraction/utc-image-loading-cancel-all-loads.cpp [deleted file]
automated-tests/src/dali-platform-abstraction/utc-image-loading-cancel-some-loads.cpp [deleted file]
automated-tests/src/dali-platform-abstraction/utc-image-loading-common.h
automated-tests/src/dali-platform-abstraction/utc-image-loading-load-completion.cpp [deleted file]
platform-abstractions/emscripten/emscripten-callbacks.h
platform-abstractions/emscripten/emscripten-platform-abstraction.cpp
platform-abstractions/emscripten/emscripten-platform-abstraction.h
platform-abstractions/tizen/file.list
platform-abstractions/tizen/image-loaders/image-loader.h
platform-abstractions/tizen/resource-loader/debug/resource-loader-debug.h
platform-abstractions/tizen/resource-loader/resource-bitmap-requester.cpp
platform-abstractions/tizen/resource-loader/resource-bitmap-requester.h
platform-abstractions/tizen/resource-loader/resource-loader.cpp
platform-abstractions/tizen/resource-loader/resource-loader.h
platform-abstractions/tizen/resource-loader/resource-requester-base.h
platform-abstractions/tizen/resource-loader/resource-thread-base.cpp [deleted file]
platform-abstractions/tizen/resource-loader/resource-thread-base.h [deleted file]
platform-abstractions/tizen/resource-loader/resource-thread-image.cpp [deleted file]
platform-abstractions/tizen/resource-loader/resource-thread-image.h [deleted file]
platform-abstractions/tizen/tizen-platform-abstraction.cpp
platform-abstractions/tizen/tizen-platform-abstraction.h
text/dali/devel-api/text-abstraction/font-client.cpp
text/dali/devel-api/text-abstraction/font-client.h
text/dali/internal/text-abstraction/font-client-impl.cpp
text/dali/internal/text-abstraction/font-client-impl.h

index 8bf946998ebf4cc18550fc2aea6c1166a850df82..b7defb08e4178946f825cb8615be08bc8132df50 100644 (file)
@@ -70,11 +70,6 @@ void UpdateStatusLogger::Log( unsigned int keepUpdatingStatus )
         oss  +=  "<Animations running> ";
       }
 
-      if ( keepUpdatingStatus & Integration::KeepUpdating::LOADING_RESOURCES )
-      {
-        oss  +=  "<Resources loading> ";
-      }
-
       if ( keepUpdatingStatus & Integration::KeepUpdating::MONITORING_PERFORMANCE )
       {
         oss += "<Monitoring performance> ";
index ca9ec8fa9019d1b5eac95b2704e6d44ca9b0ccd4..f85e0b145fff71a3b81375651b4230ef51f87099 100644 (file)
@@ -77,8 +77,7 @@ Dali::StyleMonitor StyleMonitor::Get()
     }
     else
     {
-      Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );
-      styleMonitor = Dali::StyleMonitor( new StyleMonitor( adaptorImpl.GetPlatformAbstraction() ) );
+      styleMonitor = Dali::StyleMonitor( new StyleMonitor() );
       service.Register( typeid( styleMonitor ), styleMonitor );
     }
   }
@@ -86,14 +85,13 @@ Dali::StyleMonitor StyleMonitor::Get()
   return styleMonitor;
 }
 
-StyleMonitor::StyleMonitor(Integration::PlatformAbstraction& platformAbstraction)
-: mPlatformAbstraction(platformAbstraction),
-  mDefaultFontSize(-1)
+StyleMonitor::StyleMonitor()
+: mDefaultFontSize(-1)
 {
   mFontClient = TextAbstraction::FontClient::Get();
   GetSystemDefaultFontFamily( mFontClient, mDefaultFontFamily );
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "StyleMonitor::StyleMonitor::DefaultFontFamily(%s)\n", mDefaultFontFamily.c_str() );
-  mDefaultFontSize = mPlatformAbstraction.GetDefaultFontSize();
+  mDefaultFontSize = mFontClient.GetDefaultFontSize();
 }
 
 StyleMonitor::~StyleMonitor()
@@ -117,7 +115,7 @@ void StyleMonitor::StyleChanged( StyleChange::Type styleChange )
 
     case StyleChange::DEFAULT_FONT_SIZE_CHANGE:
     {
-      mDefaultFontSize = mPlatformAbstraction.GetDefaultFontSize();
+      mDefaultFontSize = mFontClient.GetDefaultFontSize();
       break;
     }
 
index e279a3102b3c2b8f382b27662b2c70db52000c1d..5fffbbed86167eeb0179d79f7c42437f52d62b71 100644 (file)
@@ -21,7 +21,6 @@
 // EXTERNAL INCLUDES
 #include <dali/public-api/object/ref-object.h>
 #include <dali/public-api/object/base-object.h>
-#include <dali/integration-api/platform-abstraction.h>
 #include <dali/devel-api/text-abstraction/font-client.h>
 
 // INTERNAL INCLUDES
@@ -48,9 +47,8 @@ public:
 
   /**
    * Constructor.
-   * @param[in]  platformAbstraction  The platform abstraction.
    */
-  StyleMonitor(Integration::PlatformAbstraction& platformAbstraction);
+  StyleMonitor();
 
   /**
    * Retrieve the initialized instance of the StyleMonitor.
@@ -124,8 +122,6 @@ private:
 
   Dali::StyleMonitor::StyleChangeSignalType mStyleChangeSignal; ///< Emitted when the style changes
 
-  Integration::PlatformAbstraction& mPlatformAbstraction; ///< Reference to the PlatformAbstraction (for retrieving defaults)
-
   TextAbstraction::FontClient mFontClient;
   std::string mDefaultFontFamily;        ///< The system default font family
   std::string mDefaultFontStyle;         ///< The default font style
index 86b5430eca4dc58d7f888cba66d445260705a01e..b177e4a8b3c8bd5a65179cc5d4c5bd390b7c7a4d 100644 (file)
@@ -25,10 +25,6 @@ namespace Dali
 TestPlatformAbstraction::TestPlatformAbstraction()
 : mTrace(),
   mIsLoadingResult( false ),
-  mGetDefaultFontSizeResult( 0 ),
-  mLoadedResourcesQueue(),
-  mFailedLoadQueue(),
-  mResourceRequests(),
   mSize(),
   mClosestSize(),
   mLoadFileResult(),
@@ -40,17 +36,6 @@ TestPlatformAbstraction::TestPlatformAbstraction()
 
 TestPlatformAbstraction::~TestPlatformAbstraction()
 {
-  DiscardRequest();
-}
-
-void TestPlatformAbstraction::Suspend()
-{
-  mTrace.PushCall("Suspend", "");
-}
-
-void TestPlatformAbstraction::Resume()
-{
-  mTrace.PushCall("Resume", "");
 }
 
 ImageDimensions TestPlatformAbstraction::GetClosestImageSize( const std::string& filename,
@@ -75,16 +60,6 @@ ImageDimensions TestPlatformAbstraction::GetClosestImageSize( Integration::Resou
   return closestSize;
 }
 
-void TestPlatformAbstraction::LoadResource(const Integration::ResourceRequest& request)
-{
-  std::ostringstream out;
-  out << "Type:" << request.GetType()->id << ", Path: " << request.GetPath() << std::endl ;
-
-  mTrace.PushCall("LoadResource", out.str());
-
-  mResourceRequests.PushBack( new Integration::ResourceRequest(request) );
-}
-
 Integration::ResourcePointer TestPlatformAbstraction::LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath )
 {
   mTrace.PushCall("LoadResourceSynchronously", "");
@@ -97,59 +72,6 @@ Integration::BitmapPtr TestPlatformAbstraction::DecodeBuffer( const Integration:
   return mDecodedBitmap;
 }
 
-void TestPlatformAbstraction::CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId)
-{
-  mTrace.PushCall("CancelLoad", "");
-}
-
-void TestPlatformAbstraction::GetResources(Integration::ResourceCache& cache)
-{
-  mTrace.PushCall("GetResources", "");
-
-  while( !mLoadedResourcesQueue.empty() )
-  {
-    LoadedResource loaded( *mLoadedResourcesQueue.begin() );
-    mLoadedResourcesQueue.erase( mLoadedResourcesQueue.begin() );
-    cache.LoadResponse( loaded.id, loaded.type, loaded.resource, Integration::RESOURCE_COMPLETELY_LOADED );
-  }
-
-  // iterate through the resources which failed to load
-  while( !mFailedLoadQueue.empty() )
-  {
-    FailedLoad failed( *mFailedLoadQueue.begin() );
-    mFailedLoadQueue.erase( mFailedLoadQueue.begin() );
-    cache.LoadFailed( failed.id, failed.failure );
-  }
-}
-
-bool TestPlatformAbstraction::IsLoading()
-{
-  mTrace.PushCall("IsLoading", "");
-  return mIsLoadingResult;
-}
-
-int TestPlatformAbstraction::GetDefaultFontSize() const
-{
-  mTrace.PushCall("GetDefaultFontSize", "");
-  return mGetDefaultFontSizeResult;
-}
-
-void TestPlatformAbstraction::SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical)
-{
-  mTrace.PushCall("SetDpi", "");
-}
-
-bool TestPlatformAbstraction::LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const
-{
-  mTrace.PushCall("LoadFile", "");
-  if( mLoadFileResult.loadResult )
-  {
-    buffer = mLoadFileResult.buffer;
-  }
-
-  return mLoadFileResult.loadResult;
-}
-
 bool TestPlatformAbstraction::LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const
 {
   mTrace.PushCall("LoadShaderBinaryFile", "");
@@ -161,25 +83,12 @@ bool TestPlatformAbstraction::LoadShaderBinaryFile( const std::string& filename,
   return mLoadFileResult.loadResult;
 }
 
-bool TestPlatformAbstraction::SaveFile(const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const
-{
-  mTrace.PushCall("SaveFile", "");
-  return false;
-}
-
-void TestPlatformAbstraction::JoinLoaderThreads()
-{
-  mTrace.PushCall("JoinLoaderThreads", "");
-}
 
 /** Call this every test */
 void TestPlatformAbstraction::Initialize()
 {
   mTrace.Reset();
   mTrace.Enable(true);
-  mLoadedResourcesQueue.clear();
-  mFailedLoadQueue.clear();
-  mResourceRequests.Clear();
   mIsLoadingResult=false;
   mSynchronouslyLoadedResource.Reset();
   mDecodedBitmap.Reset();
@@ -189,19 +98,9 @@ bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
 {
   switch(func)
   {
-    case SuspendFunc:                         return mTrace.FindMethod("Suspend");
-    case ResumeFunc:                          return mTrace.FindMethod("Resume");
-    case LoadResourceFunc:                    return mTrace.FindMethod("LoadResource");
     case LoadResourceSynchronouslyFunc:       return mTrace.FindMethod("LoadResourceSynchronously");
-    case LoadFileFunc:                        return mTrace.FindMethod("LoadFile");
     case LoadShaderBinaryFileFunc:            return mTrace.FindMethod("LoadShaderBinaryFile");
     case SaveShaderBinaryFileFunc:            return mTrace.FindMethod("SaveShaderBinaryFile");
-    case SaveFileFunc:                        return mTrace.FindMethod("SaveFile");
-    case CancelLoadFunc:                      return mTrace.FindMethod("CancelLoad");
-    case GetResourcesFunc:                    return mTrace.FindMethod("GetResources");
-    case IsLoadingFunc:                       return mTrace.FindMethod("IsLoading");
-    case SetDpiFunc:                          return mTrace.FindMethod("SetDpi");
-    case JoinLoaderThreadsFunc:               return mTrace.FindMethod("JoinLoaderThreads");
   }
   return false;
 }
@@ -213,88 +112,10 @@ void TestPlatformAbstraction::SetIsLoadingResult(bool result)
 
 void TestPlatformAbstraction::ClearReadyResources()
 {
-  mLoadedResourcesQueue.clear();
-  mFailedLoadQueue.clear();
   mSynchronouslyLoadedResource.Reset();
   mDecodedBitmap.Reset();
 }
 
-void TestPlatformAbstraction::SetResourceLoaded(Integration::ResourceId  loadedId,
-                                                Integration::ResourceTypeId  loadedType,
-                                                Integration::ResourcePointer loadedResource)
-{
-  LoadedResource loadedInfo;
-  loadedInfo.id = loadedId;
-  loadedInfo.type = loadedType;
-  loadedInfo.resource = loadedResource;
-  mLoadedResourcesQueue.push_back( loadedInfo );
-}
-
-void TestPlatformAbstraction::SetResourceLoadFailed(Integration::ResourceId  id,
-                                                    Integration::ResourceFailure failure)
-{
-  FailedLoad failedInfo;
-  failedInfo.id = id;
-  failedInfo.failure = failure;
-  mFailedLoadQueue.push_back( failedInfo );
-}
-
-Integration::ResourceRequest* TestPlatformAbstraction::GetRequest()
-{
-  Integration::ResourceRequest* request = NULL;
-
-  // Return last request
-  if( ! mResourceRequests.Empty() )
-  {
-    request = *( mResourceRequests.End() - 1 );
-  }
-
-  return request;
-}
-
-const TestPlatformAbstraction::ResourceRequestContainer& TestPlatformAbstraction::GetAllRequests() const
-{
-  return mResourceRequests;
-}
-
-void TestPlatformAbstraction::SetAllResourceRequestsAsLoaded()
-{
-  for( ResourceRequestContainer::Iterator iter = mResourceRequests.Begin(), endIter = mResourceRequests.End();
-       iter != endIter; ++iter )
-  {
-    Integration::ResourceRequest* request = *iter;
-    Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_DISCARD );
-    Integration::ResourcePointer resource(bitmap);
-    bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
-    SetResourceLoaded( request->GetId(), request->GetType()->id, resource );
-    delete request;
-  }
-  mResourceRequests.Clear();
-}
-
-void TestPlatformAbstraction::SetAllResourceRequestsAsFailed( Integration::ResourceFailure failure )
-{
-  for( ResourceRequestContainer::Iterator iter = mResourceRequests.Begin(), endIter = mResourceRequests.End();
-       iter != endIter; ++iter )
-  {
-    Integration::ResourceRequest* request = *iter;
-    SetResourceLoadFailed( (*iter)->GetId(), failure);
-    delete request;
-  }
-  mResourceRequests.Clear();
-}
-
-void TestPlatformAbstraction::DiscardRequest()
-{
-  for( ResourceRequestContainer::Iterator iter = mResourceRequests.Begin(), endIter = mResourceRequests.End();
-       iter != endIter; ++iter )
-  {
-    Integration::ResourceRequest* request = *iter;
-    delete request;
-  }
-  mResourceRequests.Clear();
-}
-
 void TestPlatformAbstraction::SetClosestImageSize(const Vector2& size)
 {
   mClosestSize = size;
index 42e2d9890614dcee0f4d3cad3489dac52f5f676c..230ed0227bbbb7a74d7416a6bd6e8206e6ac591d 100644 (file)
@@ -40,8 +40,6 @@ class DALI_IMPORT_API TestPlatformAbstraction : public Dali::Integration::Platfo
 
 public:
 
-  typedef Vector< Integration::ResourceRequest* > ResourceRequestContainer;
-
   /**
    * Constructor
    */
@@ -52,16 +50,6 @@ public:
    */
   virtual ~TestPlatformAbstraction();
 
-  /**
-   * @copydoc PlatformAbstraction::Suspend()
-   */
-  virtual void Suspend();
-
-  /**
-   * @copydoc PlatformAbstraction::Resume()
-   */
-  virtual void Resume();
-
   /**
    * @copydoc PlatformAbstraction::GetClosestImageSize()
    */
@@ -80,11 +68,6 @@ public:
                                                SamplingMode::Type samplingMode,
                                                bool orientationCorrection );
 
-  /**
-   * @copydoc PlatformAbstraction::LoadResource()
-   */
-  virtual void LoadResource(const Integration::ResourceRequest& request);
-
   /**
    * @copydoc PlatformAbstraction::LoadResourceSynchronously()
    */
@@ -95,71 +78,25 @@ public:
    */
   virtual Integration::BitmapPtr DecodeBuffer( const Dali::Integration::ResourceType& resourceType, uint8_t * buffer, size_t size );
 
-  /**
-   * @copydoc PlatformAbstraction::CancelLoad()
-   */
-  virtual void CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId);
-
-  /**
-   * @copydoc PlatformAbstraction::GetResources()
-   */
-  virtual void GetResources(Integration::ResourceCache& cache);
-
-  /**
-   * @copydoc PlatformAbstraction::IsLoading()
-   */
-  virtual bool IsLoading();
-
-  /**
-   * @copydoc PlatformAbstraction::GetDefaultFontSize()
-   */
-  virtual int GetDefaultFontSize() const;
-
-  /**
-   * @copydoc PlatformAbstraction::SetDpi()
-   */
-  virtual void SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical);
-
-  /**
-   * @copydoc PlatformAbstraction::LoadFile()
-   */
-  virtual bool LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
-
   /**
    * @copydoc PlatformAbstraction::LoadShaderBinaryFile()
    */
   virtual bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
 
   /**
-   * @copydoc PlatformAbstraction::SaveFile()
+   * @copydoc PlatformAbstraction::SaveShaderBinaryFile()
    */
-  virtual bool SaveFile(const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const;
-
- /**
-  * @copydoc PlatformAbstraction::SaveShaderBinaryFile()
-  */
   virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const { return true; }
 
-  virtual void JoinLoaderThreads();
 
 public: // TEST FUNCTIONS
 
   // Enumeration of Platform Abstraction methods
   typedef enum
   {
-    SuspendFunc,
-    ResumeFunc,
-    LoadResourceFunc,
     LoadResourceSynchronouslyFunc,
-    SaveFileFunc,
-    LoadFileFunc,
     LoadShaderBinaryFileFunc,
-    SaveShaderBinaryFileFunc,
-    CancelLoadFunc,
-    GetResourcesFunc,
-    IsLoadingFunc,
-    SetDpiFunc,
-    JoinLoaderThreadsFunc,
+    SaveShaderBinaryFileFunc
   } TestFuncEnum;
 
   /** Call this every test */
@@ -182,63 +119,11 @@ public: // TEST FUNCTIONS
    */
   void SetIsLoadingResult(bool result);
 
-  /**
-   * @brief Sets the value returned by GetDefaultFontSize
-   * @param[in] result The value to return
-   */
-  void SetGetDefaultFontSizeResult(float result);
-
   /**
    * @brief Clears all resource queues
    */
   void ClearReadyResources();
 
-  /**
-   * @brief Sets a particular resource request as loaded.
-   * @param[in] loadedId The ResourceID of the resource that has been loaded.
-   * @param[in] loadedType The type of resource that has been loaded.
-   * @param[in] loadedResource A pointer to the resource that has been loaded.
-   */
-  void SetResourceLoaded(Integration::ResourceId  loadedId,
-                         Integration::ResourceTypeId  loadedType,
-                         Integration::ResourcePointer loadedResource);
-
-  /**
-   * @brief Sets a particular resource request as load failure.
-   * @param[in] id The ID of the failed resource request.
-   * @param[in] failure The type of failure.
-   */
-  void SetResourceLoadFailed(Integration::ResourceId  id,
-                             Integration::ResourceFailure failure);
-
-  /**
-   * @brief Retrieves the latest resource request
-   * @return A pointer to the latest resource request.
-   */
-  Integration::ResourceRequest* GetRequest();
-
-  /**
-   * @brief Retrieves a reference to a container of all the resource requests.
-   * @return A reference to a container of all the resource requests.
-   */
-  const ResourceRequestContainer& GetAllRequests() const;
-
-  /**
-   * @brief Sets all resource requests as loaded.
-   */
-  void SetAllResourceRequestsAsLoaded();
-
-  /**
-   * @brief Sets all resource requests as loaded.
-   * @param[in] failure The failure type
-   */
-  void SetAllResourceRequestsAsFailed( Integration::ResourceFailure failure );
-
-  /**
-   * @brief Discards all current resource requests.
-   */
-  void DiscardRequest();
-
   /**
    * @brief Sets the value returned by GetClosestImageSize.
    * @param[in] size The size that should be returned.
@@ -277,19 +162,6 @@ private:
 
 private:
 
-  struct LoadedResource
-  {
-    Integration::ResourceId      id;
-    Integration::ResourceTypeId  type;
-    Integration::ResourcePointer resource;
-  };
-
-  struct FailedLoad
-  {
-    Integration::ResourceId      id;
-    Integration::ResourceFailure failure;
-  };
-
   struct LoadFileResult
   {
     inline LoadFileResult()
@@ -302,15 +174,8 @@ private:
     Dali::Vector< unsigned char> buffer;
   };
 
-  typedef std::vector< LoadedResource > LoadedResourceContainer;
-  typedef std::vector< FailedLoad > FailedLoadContainer;
-
   mutable TraceCallStack        mTrace;
   bool                          mIsLoadingResult;
-  int                           mGetDefaultFontSizeResult;
-  LoadedResourceContainer       mLoadedResourcesQueue;
-  FailedLoadContainer           mFailedLoadQueue;
-  ResourceRequestContainer      mResourceRequests;
   Vector2                       mSize;
   Vector2                       mClosestSize;
 
index c7542c1b51cab00e7043882fc47faddd36bed42f..94b7bc3d5e68de496fe283f3308646b3e4dab7ae 100644 (file)
@@ -7,13 +7,9 @@ SET(CAPI_LIB "dali-platform-abstraction")
 
 SET(TC_SOURCES
     utc-image-fitting-modes.cpp
-    utc-image-loading-cancel-all-loads.cpp
-    utc-image-loading-cancel-some-loads.cpp
-    utc-image-loading-load-completion.cpp
 )
 
 LIST(APPEND TC_SOURCES
-    resource-collector.cpp
     ../dali-adaptor/dali-test-suite-utils/mesh-builder.cpp
     ../dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.cpp
     ../dali-adaptor/dali-test-suite-utils/test-actor-utils.cpp
diff --git a/automated-tests/src/dali-platform-abstraction/resource-collector.cpp b/automated-tests/src/dali-platform-abstraction/resource-collector.cpp
deleted file mode 100644 (file)
index 799d4c6..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include "resource-collector.h"
-#include "tizen-platform-abstraction.h"
-#include <dali/integration-api/debug.h>
-#include <unistd.h>
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Platform
-{
-using namespace Dali::Integration;
-
-ResourceCollector::ResourceCollector() :
-  mGrandTotalCompletions(0),
-  mGrandTotalNotifications(0)
-{
-}
-
-ResourceCollector::~ResourceCollector() {}
-
-void ResourceCollector::LoadResponse( Dali::Integration::ResourceId id, Dali::Integration::ResourceTypeId type, Dali::Integration::ResourcePointer resource, Dali::Integration::LoadStatus status )
-{
-  ++mGrandTotalNotifications;
-  if( status == RESOURCE_COMPLETELY_LOADED )
-  {
-    DALI_ASSERT_DEBUG( mCompletionCounts.find(id) == mCompletionCounts.end() && "A resource can only complete once." );
-    mCompletionStatuses[id] = true;
-    ++mCompletionCounts[id];
-    ++mSuccessCounts[id];
-    mCompletionSequence.push_back( id );
-    ++mGrandTotalCompletions;
-  }
-}
-
-void ResourceCollector::LoadFailed( Dali::Integration::ResourceId id, Dali::Integration::ResourceFailure failure )
-{
-  mCompletionStatuses[id] = false;
-  ++mFailureCounts[id];
-  mCompletionSequence.push_back( id );
-  ++mGrandTotalCompletions;
-  ++mGrandTotalNotifications;
-}
-
-void PollForNotification( ResourceCollector& collector, Integration::PlatformAbstraction&  abstraction, const unsigned maxPolls )
-{
-  // Poll for at least one completed or partially completed load:
-  const unsigned outstandingNotifications = collector.mGrandTotalNotifications;
-  for( unsigned poll = 0; poll < maxPolls; ++poll )
-  {
-    abstraction.GetResources( collector );
-    if( collector.mGrandTotalNotifications > outstandingNotifications )
-    {
-      break;
-    }
-    usleep( 3 ); //< Wait 3 microseconds each time around.
-  }
-}
-
-} /* namespace Platform */
-} /* namespace Internal */
-} /* namespace Dali */
diff --git a/automated-tests/src/dali-platform-abstraction/resource-collector.h b/automated-tests/src/dali-platform-abstraction/resource-collector.h
deleted file mode 100644 (file)
index 7a4b2dd..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-#ifndef __DALI_ADAPTOR_TCT_RESOURCE_COLLECTOR_H_
-#define __DALI_ADAPTOR_TCT_RESOURCE_COLLECTOR_H_
-/*
- * 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.
- *
- */
-#include <dali/dali.h>
-#include <dali/integration-api/resource-cache.h>
-
-#include <map>
-
-namespace Dali
-{
-
-namespace Integration
-{
-class PlatformAbstraction;
-}
-
-namespace Internal
-{
-namespace Platform
-{
-  /** Stores true for success and false for a failure for each completed
-   *  resource id.*/
-  typedef std::map<Integration::ResourceId, bool> ResourceStatusMap;
-  /** Stores an integer counter for a resource ID, e.g., to count the number of
-   *  times a load or a fail is reported.*/
-  typedef std::map<Integration::ResourceId, unsigned> ResourceCounterMap;
-  /** Used to track the order in which a sequence of requests is completed.*/
-  typedef std::vector<Integration::ResourceId> ResourceSequence;
-
-/**
- * @brief Used for platform testing to record the result of resource requests
- * initiated by tests.
- */
-class ResourceCollector : public Integration::ResourceCache
-{
-public:
-
-  ResourceCollector();
-  virtual ~ResourceCollector();
-
-  virtual void LoadResponse(Dali::Integration::ResourceId id, Dali::Integration::ResourceTypeId type, Dali::Integration::ResourcePointer resource, Dali::Integration::LoadStatus status);
-
-  virtual void LoadFailed(Dali::Integration::ResourceId id, Dali::Integration::ResourceFailure failure);
-
-  // Data:
-  /** Record of the status of each completed resource. */
-  ResourceStatusMap mCompletionStatuses;
-  /** Record of how many times each resource completed (every value should be 1,
-   *  else we are broken). */
-  ResourceCounterMap mCompletionCounts;
-  /** Record of how many times each resource succeeded (every value should be 0 or
-   *  1, else we are broken). */
-  ResourceCounterMap mSuccessCounts;
-  /** Record of how many times each resource failed (every value should be 0 or 1,
-   * else we are broken).
-   * Only resource IDs that correspond to deliberately unloadable resources
-   * should have counts other than 0. */
-  ResourceCounterMap mFailureCounts;
-  /** Remember the order of request completions so request priority can be tested. */
-  ResourceSequence mCompletionSequence;
-  /** Count of all successes and failures.*/
-  unsigned mGrandTotalCompletions;
-  /** Count of all successes, failures, loading notifications and partially loaded notifications.*/
-  unsigned mGrandTotalNotifications;
-
-};
-
-/**
- * Helper to poll the abstraction for notifications assuming loads have been
- * issued to it previously and are in-flight.
- */
-void PollForNotification( ResourceCollector& collector, Integration::PlatformAbstraction&  abstraction, const unsigned maxPolls = 100 );
-
-} /* namespace Platform */
-} /* namespace Internal */
-} /* namespace Dali */
-
-#endif /* __DALI_ADAPTOR_TCT_RESOURCE_COLLECTOR_H_ */
index 9da0cbe5df17317cae3ecd32f21d48c0da24fcad..477c1d44c38243bd9b22ae299a513a42a4dc9e86 100644 (file)
@@ -19,6 +19,8 @@
 
 #include "platform-abstractions/portable/image-operations.h"
 
+using Dali::Internal::Platform::ApplyAttributesToBitmap;
+
 #define ANSI_BLACK   "\x1B[0m"
 #define ANSI_RED     "\x1B[31m"
 #define ANSI_GREEN   "\x1B[32m"
diff --git a/automated-tests/src/dali-platform-abstraction/utc-image-loading-cancel-all-loads.cpp b/automated-tests/src/dali-platform-abstraction/utc-image-loading-cancel-all-loads.cpp
deleted file mode 100644 (file)
index aa4d8b5..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include "utc-image-loading-common.h"
-
-void utc_image_loading_cancel_all_loads_startup(void)
-{
-  utc_dali_loading_startup();
-}
-
-void utc_image_loading_cancel_all_loads_cleanup(void)
-{
-  utc_dali_loading_cleanup();
-}
-
-/**
- * @brief Test case for load cancellation.
- *
- * Load lots of images in batches, cancelling all in a batch after a small delay to
- * allow the first of a batch to be launched before cancellation starts.
- * Assert that all loads issued are either completed or cancelled.
- *
- * @note Many loads will succeed despite our cancellations due to the coarse
- * granularity of the waits we introduce after loading each batch. That is
- * expected.
- */
-int UtcDaliCancelAllLoads(void)
-{
-  tet_printf( "Running load cancel-all test.\n" );
-
-  DALI_ASSERT_ALWAYS( gAbstraction != 0 );
-
-  // Start a bunch of loads that should work:
-
-  Dali::Integration::LoadResourcePriority priority = LoadPriorityNormal;
-  unsigned loadsLaunched = 0;
-  Dali::Internal::Platform::ResourceCollector resourceSink;
-
-  for( unsigned loadGroup = 0; loadGroup < NUM_CANCELLED_LOAD_GROUPS_TO_ISSUE; ++loadGroup )
-  {
-    // Issue load requests for a batch of images:
-    for( unsigned validImage = 0; validImage < NUM_VALID_IMAGES; ++validImage )
-    {
-      const ImageParameters & loadParams = gCancelAttributes[ loadsLaunched % gCancelAttributes.size() ];
-      const BitmapResourceType bitmapResourceType( loadParams.first, loadParams.second.first, loadParams.second.second.first, loadParams.second.second.second );
-      const ResourceId resourceId = loadGroup * NUM_VALID_IMAGES + validImage + 1;
-      gAbstraction->LoadResource( ResourceRequest( resourceId, bitmapResourceType, VALID_IMAGES[validImage], priority ) );
-      loadsLaunched += 1;
-    }
-
-    // Poll for at least one completed load so we have a good chance of catching an
-    // in-flight load as we run through the cancellations further below:
-    PollForNotification( resourceSink, *gAbstraction, 100 );
-
-    // Cancel all the launched loads in the batch from oldest to newest:
-    for( unsigned validImage = 0; validImage < NUM_VALID_IMAGES; ++validImage )
-    {
-      const ResourceId resourceId = loadGroup * NUM_VALID_IMAGES + validImage + 1;
-      gAbstraction->CancelLoad( resourceId, ResourceBitmap );
-    }
-  }
-
-  // Drain the completed loads:
-
-  unsigned lastNotifications = -1;
-  for( unsigned i = 0; resourceSink.mGrandTotalCompletions < loadsLaunched && resourceSink.mGrandTotalNotifications != lastNotifications; )
-  {
-    lastNotifications = resourceSink.mGrandTotalNotifications;
-    gAbstraction->GetResources( resourceSink );
-
-    ++i;
-    if( i < MAX_NUM_RESOURCE_TRIES && resourceSink.mGrandTotalCompletions < loadsLaunched )
-    {
-      usleep( 1000 * 10 );
-    }
-    else
-    {
-      break;
-    }
-  }
-
-  // Check the loads completed as expected:
-
-  tet_printf( "Issued Loads: %u, Completed Loads: %u, Successful Loads: %u, Failed Loads: %u \n", loadsLaunched, resourceSink.mGrandTotalCompletions, unsigned(resourceSink.mSuccessCounts.size()), unsigned(resourceSink.mFailureCounts.size()) );
-  DALI_TEST_CHECK( loadsLaunched > resourceSink.mGrandTotalCompletions );
-  DALI_TEST_CHECK( loadsLaunched > resourceSink.mSuccessCounts.size() );
-  DALI_TEST_CHECK( 0 == resourceSink.mFailureCounts.size() );
-
-  // Check that each success was reported exactly once:
-  for( ResourceCounterMap::const_iterator it = resourceSink.mSuccessCounts.begin(), end = resourceSink.mSuccessCounts.end(); it != end; ++it )
-  {
-    DALI_TEST_CHECK( it->second == 1u );
-  }
-
-  END_TEST;
-}
diff --git a/automated-tests/src/dali-platform-abstraction/utc-image-loading-cancel-some-loads.cpp b/automated-tests/src/dali-platform-abstraction/utc-image-loading-cancel-some-loads.cpp
deleted file mode 100644 (file)
index 3d6ba94..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <set>
-
-// INTERNAL INCLUDES
-#include "utc-image-loading-common.h"
-
-void utc_image_loading_cancel_some_loads_startup(void)
-{
-  utc_dali_loading_startup();
-}
-
-void utc_image_loading_cancel_some_loads_cleanup(void)
-{
-  utc_dali_loading_cleanup();
-}
-
-/**
- * @brief Test case for load cancellation.
- *
- * Load lots, cancel a subset and be sure the wrong loads are never cancelled
- * and that all loads issued are either completed or cancelled.
- */
-int UtcDaliCancelSomeLoads(void)
-{
-  tet_printf( "Running load cancel load subset test.\n" );
-
-  DALI_ASSERT_ALWAYS( gAbstraction != 0 );
-
-  // Start a bunch of loads that should work:
-
-  Dali::Integration::LoadResourcePriority priority = LoadPriorityNormal;
-  unsigned loadsLaunched = 0;
-
-  std::set<Integration::ResourceId> cancelledLoadSet;
-  Dali::Internal::Platform::ResourceCollector resourceSink;
-
-  for( unsigned loadGroup = 0; loadGroup < NUM_LOAD_GROUPS_TO_ISSUE; ++loadGroup )
-  {
-    const unsigned preIterationCompletions = resourceSink.mGrandTotalCompletions;
-
-    // Issue load requests for a batch of images:
-    for( unsigned validImage = 0; validImage < NUM_VALID_IMAGES; ++validImage )
-    {
-      const ImageParameters & loadParams = gCancelAttributes[ loadsLaunched % gCancelAttributes.size() ];
-      const BitmapResourceType bitmapResourceType( loadParams.first, loadParams.second.first, loadParams.second.second.first, loadParams.second.second.second );
-      const ResourceId resourceId = loadGroup * NUM_VALID_IMAGES + validImage + 1;
-      gAbstraction->LoadResource( ResourceRequest( resourceId, bitmapResourceType, VALID_IMAGES[validImage], priority ) );
-      loadsLaunched += 1;
-    }
-
-    // Let the first image in the batch start to load so we can try to cancel it in-flight:
-    usleep( 1 * 1000 ); //< 1 ms is enough to let an image start to load.
-    ///@Note: The log should show cancellations of many in-flight loads in desktop builds with info-level logging enabled (e.g., "INFO: DALI: : CheckForCancellation: Cancelled in-flight resource (21)."). If it doesn't, the above delay may need to be adjusted.
-
-    // Cancel just two loads (hopefully one in-flight and one queued):
-
-    // Cancel first load, hopefully while it is in-flight:
-    const ResourceId cancelledInFlight = loadGroup * NUM_VALID_IMAGES + 1;
-    gAbstraction->CancelLoad( cancelledInFlight, ResourceBitmap );
-    cancelledLoadSet.insert( cancelledInFlight );
-
-    // Cancel second load, that is still queued:
-    const ResourceId cancelledFromQueue = loadGroup * NUM_VALID_IMAGES + NUM_VALID_IMAGES;
-    gAbstraction->CancelLoad( cancelledFromQueue, ResourceBitmap );
-    cancelledLoadSet.insert( cancelledFromQueue );
-
-    // Drain a group worth of images so the cancellations hit in-flight loads on the next iteration:
-    for( unsigned i = 0; i < NUM_VALID_IMAGES * 1000 * 1000 * 10 / (5 * 1000)  && resourceSink.mGrandTotalCompletions < preIterationCompletions + NUM_VALID_IMAGES - 2; ++i )
-    {
-      gAbstraction->GetResources( resourceSink );
-      usleep( 5 * 1000 );
-    }
-  }
-
-  // Drain any spare completed loads until no new loads complete on an iteration:
-  unsigned lastNotifications = -1;
-  for( unsigned i = 0; i < MAX_NUM_RESOURCE_TRIES && resourceSink.mGrandTotalCompletions < loadsLaunched && resourceSink.mGrandTotalNotifications != lastNotifications; ++i )
-  {
-    lastNotifications = resourceSink.mGrandTotalNotifications;
-    gAbstraction->GetResources( resourceSink );
-    usleep( 70 * 1000 ); //< 70 ms should allow at least one medium image to load. You  might to increase this to run on a slow device.
-    gAbstraction->GetResources( resourceSink );
-    usleep( 70 * 1000 );
-    gAbstraction->GetResources( resourceSink );
-    usleep( 70 * 1000 );
-    gAbstraction->GetResources( resourceSink );
-  }
-
-  // Check the loads completed as expected:
-
-  tet_printf( "Issued Loads: %u, Completed Loads: %u, Successful Loads: %u, Failed Loads: %u \n", loadsLaunched, resourceSink.mGrandTotalCompletions, unsigned(resourceSink.mSuccessCounts.size()), unsigned(resourceSink.mFailureCounts.size()) );
-  DALI_TEST_CHECK( loadsLaunched >= resourceSink.mGrandTotalCompletions );
-  DALI_TEST_CHECK( loadsLaunched >= resourceSink.mSuccessCounts.size() );
-  DALI_TEST_CHECK( 0 == resourceSink.mFailureCounts.size() );
-
-  // Check that if an image was not loaded, it is one of the ones that was cancelled:
-  // This is the main point of this test case.
-  std::vector<Integration::ResourceId> missingLoads;
-  for( unsigned resourceId = 1; resourceId <= NUM_LOAD_GROUPS_TO_ISSUE * NUM_VALID_IMAGES; ++resourceId )
-  {
-    // Was the load (not) completed?
-    if( resourceSink.mCompletionStatuses.find( resourceId ) == resourceSink.mCompletionStatuses.end() )
-    {
-      // Was the load (not) cancelled?
-      if( cancelledLoadSet.find( resourceId ) == cancelledLoadSet.end() )
-      {
-        // Whoa, the load was not completed and not cancelled either... so where did it go then?
-        missingLoads.push_back( resourceId );
-        tet_printf( "Missing load. ResourceId %u was not completed but was also not cancelled.\n", resourceId );
-        ///@note If this fires, you are probably not waiting long enough in the draining loop above (usleep( 70 * 1000 );).
-      }
-    }
-  }
-  DALI_TEST_CHECK( missingLoads.size() == 0U );
-
-  // Check that each success was reported exactly once:
-  for(ResourceCounterMap::const_iterator it = resourceSink.mSuccessCounts.begin(), end = resourceSink.mSuccessCounts.end(); it != end; ++it )
-  {
-    DALI_TEST_CHECK( it->second == 1u );
-  }
-
-  END_TEST;
-}
index cc6f7135499652aedc0ba7e6c632de128bc53900..3cb9cd0e87eae807f6fa4d9f12cc49530c0057b3 100644 (file)
 #include <dali/dali.h>
 #include <dali-test-suite-utils.h>
 #include "tizen-platform-abstraction.h"
-#include "resource-collector.h"
 
 using namespace Dali;
 using namespace Dali::Integration;
-using namespace Dali::Internal::Platform;
 
 namespace
 {
diff --git a/automated-tests/src/dali-platform-abstraction/utc-image-loading-load-completion.cpp b/automated-tests/src/dali-platform-abstraction/utc-image-loading-load-completion.cpp
deleted file mode 100644 (file)
index dc5ecf0..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include "utc-image-loading-common.h"
-
-void utc_image_loading_load_completion_startup(void)
-{
-  utc_dali_loading_startup();
-}
-
-void utc_image_loading_load_completion_cleanup(void)
-{
-  utc_dali_loading_cleanup();
-}
-
-// Positive test case for loading. Load lots and be sure it has succeeded.
-int UtcDaliLoadCompletion(void)
-{
-  tet_printf("Running load completion test \n");
-
-  DALI_ASSERT_ALWAYS( gAbstraction != 0 );
-
-  // Start a bunch of loads that should work:
-
-  Dali::Integration::BitmapResourceType bitmapResourceType;
-  Dali::Integration::LoadResourcePriority priority = Dali::Integration::LoadPriorityNormal;
-  unsigned loadsLaunched = 0;
-
-  for( unsigned loadGroup = 0; loadGroup < NUM_LOAD_GROUPS_TO_ISSUE; ++loadGroup )
-  {
-    for( unsigned validImage = 0; validImage < NUM_VALID_IMAGES; ++validImage )
-    {
-      Dali::Integration::ResourceRequest request( loadGroup * NUM_VALID_IMAGES + validImage + 1, bitmapResourceType, VALID_IMAGES[validImage], priority );
-      gAbstraction->LoadResource( request );
-    }
-    loadsLaunched += NUM_VALID_IMAGES;
-  }
-
-  // Drain the completed loads:
-  Dali::Internal::Platform::ResourceCollector resourceSink;
-  gAbstraction->GetResources( resourceSink );
-  usleep( 500 * 1000 );
-  gAbstraction->GetResources( resourceSink );
-
-  const double startDrainTime = GetTimeMilliseconds( *gAbstraction );
-  while( resourceSink.mGrandTotalCompletions < loadsLaunched && GetTimeMilliseconds( *gAbstraction ) - startDrainTime < MAX_MILLIS_TO_WAIT_FOR_KNOWN_LOADS )
-  {
-    usleep( 100 * 40 );
-    gAbstraction->GetResources( resourceSink );
-  }
-
-  // Check the loads completed as expected:
-
-  tet_printf( "Issued Loads: %u, Completed Loads: %u, Successful Loads: %u, Failed Loads: %u \n", loadsLaunched, resourceSink.mGrandTotalCompletions, unsigned(resourceSink.mSuccessCounts.size()), unsigned(resourceSink.mFailureCounts.size()) );
-  DALI_TEST_CHECK( loadsLaunched == resourceSink.mGrandTotalCompletions );
-  DALI_TEST_CHECK( loadsLaunched == resourceSink.mSuccessCounts.size() );
-  DALI_TEST_CHECK( 0 == resourceSink.mFailureCounts.size() );
-
-  // Check that each success was reported exactly once:
-  for( ResourceCounterMap::const_iterator it = resourceSink.mSuccessCounts.begin(), end = resourceSink.mSuccessCounts.end(); it != end; ++it )
-  {
-    DALI_TEST_CHECK( it->second == 1u );
-  }
-
-  END_TEST;
-}
index 87bb428bd1191d313e9347268b0e70ce4f65a4f5..43a04578077fae0d56040b856ff261d2a3834640 100644 (file)
@@ -20,7 +20,6 @@
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/platform-abstraction.h>
-#include <dali/integration-api/resource-cache.h>
 #include <dali/public-api/common/dali-common.h>
 
 // INTERNAL INCLUDES
index 00cec12ac77b1faa68c782b16e47c1584f2dfd82..d744308e8eb3303b4cc2e84b0400f4d19c85b881 100644 (file)
@@ -192,16 +192,6 @@ void EmscriptenPlatformAbstraction::GetTimeMicroseconds(unsigned int &seconds, u
   microSeconds    = (static_cast<unsigned int>(current) - seconds*1000.0) * 1000;
 }
 
-void EmscriptenPlatformAbstraction::Suspend()
-{
-  DALI_ASSERT_ALWAYS("!Not Implemented");
-}
-
-void EmscriptenPlatformAbstraction::Resume()
-{
-  DALI_ASSERT_ALWAYS("!Not Implemented");
-}
-
 ImageDimensions EmscriptenPlatformAbstraction::GetClosestImageSize( const std::string& filename,
                                                              ImageDimensions size,
                                                              FittingMode::Type fittingMode,
@@ -240,148 +230,16 @@ Integration::ResourcePointer EmscriptenPlatformAbstraction::LoadResourceSynchron
       ret = bitmapPtr;
     }
     break;
-    case Integration::ResourceNativeImage:
-    {
-    }
-    break;
-    case Integration::ResourceTargetImage:
-    {
-    }
-    break;
   } // switch(resourceType->id)
 
   return ret;
 }
 
-void EmscriptenPlatformAbstraction::LoadResource(const Integration::ResourceRequest& request)
-{
-  std::string path = request.GetPath();
-
-  Integration::ResourceType *type            = request.GetType();
-  Integration::ResourceId   resourceId       = request.GetId();
-  Integration::ResourcePointer resourcePtr   = request.GetResource();
-
-  if( type )
-  {
-    switch(type->id)
-    {
-      case Integration::ResourceBitmap:
-      {
-        Integration::BitmapPtr bitmapPtr = NULL;
-
-        if( NULL == request.GetResource().Get()  )
-        {
-          const Integration::BitmapResourceType& bitmapResource( static_cast<const Integration::BitmapResourceType&>(*type) );
-
-          Integration::BitmapPtr bitmapPtr = Dali::Internal::Emscripten::GetImage( bitmapResource.size,
-                                                                                   bitmapResource.scalingMode,
-                                                                                   bitmapResource.samplingMode,
-                                                                                   bitmapResource.orientationCorrection,
-                                                                                   path );
-
-
-
-        }
-        else
-        {
-          // 2) load it (usually on worker thread)
-          // DALI_LOG_TRACE_METHOD( mLogFilter );
-          // DALI_LOG_INFO(mLogFilter, Debug::Verbose, "%s(%s)\n", __FUNCTION__, request.GetPath().c_str());
-
-          bitmapPtr = LoadResourceEncodedImage( reinterpret_cast<Dali::RefCountedVector<uint8_t>*>( request.GetResource().Get() ) );
-        }
-
-        if( bitmapPtr )
-        {
-          mResourceQueue.push( ResourceIdBitmapPair( resourceId, bitmapPtr ) );
-        }
-
-      }
-      break;
-      case Integration::ResourceNativeImage:
-      {
-        printf("EmscriptenPlatformAbstraction::LoadResource ResourceNativeImage\n");
-      }
-      break;
-      case Integration::ResourceTargetImage:
-      {
-        printf("EmscriptenPlatformAbstraction::LoadResource ResourceTargetImage\n");
-      }
-      break;
-    } // switch(id)
-
-  } // if(type)
-
-}
-
-void EmscriptenPlatformAbstraction::SaveResource(const Integration::ResourceRequest& request)
-{
-  DALI_ASSERT_ALWAYS("!Not Implemented");
-}
-
 Integration::BitmapPtr EmscriptenPlatformAbstraction::DecodeBuffer( const Integration::ResourceType& resourceType, uint8_t * buffer, size_t bufferSize )
 {
   return Integration::BitmapPtr();
 }
 
-void EmscriptenPlatformAbstraction::CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId)
-{
-  DALI_ASSERT_ALWAYS("!Not Implemented");
-}
-
-void EmscriptenPlatformAbstraction::GetResources(Integration::ResourceCache& cache)
-{
-  while( !mResourceQueue.empty() )
-  {
-    Integration::ResourceId    resourceId  = mResourceQueue.front().first;
-    Integration::BitmapPtr     bitmapPtr   = mResourceQueue.front().second;
-
-    cache.LoadResponse( resourceId,
-                        Integration::ResourceBitmap,
-                        bitmapPtr,
-                        Integration::RESOURCE_COMPLETELY_LOADED );
-    mResourceQueue.pop();
-  }
-}
-
-bool EmscriptenPlatformAbstraction::IsLoading()
-{
-  EM_LOG("EmscriptenPlatformAbstraction::IsLoading");
-  return false;
-}
-
-const std::string& EmscriptenPlatformAbstraction::GetDefaultFontFamily() const
-{
-  EM_LOG("EmscriptenPlatformAbstraction::GetDefaultFontFamily");
-  DALI_ASSERT_ALWAYS("!Not Implemented");
-  return mGetDefaultFontFamilyResult;
-}
-
-int EmscriptenPlatformAbstraction::GetDefaultFontSize() const
-{
-  EM_LOG("EmscriptenPlatformAbstraction::GetDefaultFontSize");
-  return 12;
-}
-
-void EmscriptenPlatformAbstraction::SetDpi (unsigned int /* dpiHorizontal*/, unsigned int /* dpiVertical */)
-{
-
-}
-
-
-bool EmscriptenPlatformAbstraction::LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer )  const
-{
-  EM_LOG("EmscriptenPlatformAbstraction::LoadFile");
-  return false;
-}
-
-bool EmscriptenPlatformAbstraction::SaveFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const
-{
-  EM_LOG("EmscriptenPlatformAbstraction::SaveFile");
-
-  DALI_ASSERT_ALWAYS("!Unimplemented");
-  return false;
-}
 
 bool EmscriptenPlatformAbstraction::LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const
 {
@@ -389,19 +247,6 @@ bool EmscriptenPlatformAbstraction::LoadShaderBinaryFile( const std::string& fil
   return false;
 }
 
-bool EmscriptenPlatformAbstraction::SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const
-{
-  EM_LOG("EmscriptenPlatformAbstraction::SaveShaderBinaryFile");
-
-  DALI_ASSERT_ALWAYS("!Unimplemented");
-  return false;
-}
-
-void EmscriptenPlatformAbstraction::JoinLoaderThreads()
-{
-  DALI_ASSERT_ALWAYS("!Unimplemented");
-}
-
 void EmscriptenPlatformAbstraction::UpdateDefaultsFromDevice()
 {
   DALI_ASSERT_ALWAYS("!Unimplemented");
index 2d67e4726e594e12c88a5caca7ce769167fb0534..97e9a515d01f5d43d547fac14e22b080e0555b62 100644 (file)
 namespace Dali
 {
 
+namespace Integration
+{
+
+typedef IntrusivePtr<Dali::RefObject> ResourcePointer;
+} // namespace Integration
+
 /**
  * An Dali Platform abstraction using libSDL for Emscripten.
  *
@@ -42,26 +48,6 @@ class DALI_IMPORT_API EmscriptenPlatformAbstraction : public Dali::Integration::
 
 public:
 
-  struct Resources
-  {
-    bool                         loaded;
-    Integration::ResourceId      loadedId;
-    Integration::ResourceTypeId  loadedType;
-    Integration::ResourcePointer loadedResource;
-
-    bool                         loadFailed;
-    Integration::ResourceId      loadFailedId;
-    Integration::ResourceFailure loadFailure;
-
-    bool                         saved;
-    Integration::ResourceId      savedId;
-    Integration::ResourceTypeId  savedType;
-
-    bool                         saveFailed;
-    Integration::ResourceId      saveFailedId;
-    Integration::ResourceFailure saveFailure;
-  };
-
   struct LoadFileResult
   {
     LoadFileResult()
@@ -93,16 +79,6 @@ public:
 
   void IncrementGetTimeResult(size_t milliseconds);
 
-  /**
-   * @copydoc PlatformAbstraction::Suspend()
-   */
-  virtual void Suspend();
-
-  /**
-   * @copydoc PlatformAbstraction::Resume()
-   */
-  virtual void Resume();
-
   /**
    * @copydoc PlatformAbstraction::GetClosestImageSize()
    */
@@ -121,69 +97,15 @@ public:
                                                bool orientationCorrection );
 
   /**
-   * @copydoc PlatformAbstraction::LoadResource()
+   * @copydoc PlatformAbstraction::LoadResourceSynchronously()
    */
-  virtual void LoadResource(const Integration::ResourceRequest& request);
-
   virtual Integration::ResourcePointer LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath );
 
-  /**
-   * @copydoc PlatformAbstraction::SaveResource()
-   */
-  virtual void SaveResource(const Integration::ResourceRequest& request);
-
   /**
    * @copydoc PlatformAbstraction::DecodeBuffer()
    */
   virtual Integration::BitmapPtr DecodeBuffer( const Integration::ResourceType& resourceType, uint8_t * buffer, size_t bufferSize );
 
-  /**
-   * @copydoc PlatformAbstraction::CancelLoad()
-   */
-  virtual void CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId);
-
-  /**
-   * @copydoc PlatformAbstraction::GetResources()
-   */
-  virtual void GetResources(Integration::ResourceCache& cache);
-
-  /**
-   * @copydoc PlatformAbstraction::IsLoading()
-   */
-  virtual bool IsLoading();
-
-  /**
-   * @copydoc PlatformAbstraction::GetDefaultFontFamily()
-   */
-  virtual const std::string& GetDefaultFontFamily() const;
-
-  /**
-   * @copydoc PlatformAbstraction::GetDefaultFontSize()
-   */
-  virtual int GetDefaultFontSize() const;
-
-  /**
-   * Sets horizontal and vertical pixels per inch value that is used by the display
-   * @param[in] dpiHorizontal horizontal dpi value
-   * @param[in] dpiVertical   vertical dpi value
-   */
-  virtual void SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical);
-
-  /**
-   * @copydoc PlatformAbstraction::LoadFile()
-   */
-  virtual bool LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
-
-  /**
-   * @copydoc PlatformAbstraction::SaveFile()
-   */
-  virtual bool SaveFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const;
-
-  /**
-   * @copydoc PlatformAbstraction::JoinLoaderThreads()
-   */
-  virtual void JoinLoaderThreads();
-
   /**
    * @copydoc PlatformAbstraction::LoadShaderBinaryFile()
    */
@@ -201,7 +123,6 @@ public:
 
 private:
   std::string                   mGetDefaultFontFamilyResult;
-  Resources                     mResources;
   Vector2                       mSize;
 
   LoadFileResult                mLoadFileResult;
index c76bcfda2dacd601d9c38aef622b4834b0f26853..5bb1e1a38bf43ceade82b093e404aa67b5b9a4cd 100755 (executable)
@@ -8,9 +8,6 @@ tizen_platform_abstraction_src_files = \
   $(tizen_platform_abstraction_src_dir)/resource-loader/resource-requester-base.cpp \
   $(tizen_platform_abstraction_src_dir)/resource-loader/resource-bitmap-requester.cpp \
   \
-  $(tizen_platform_abstraction_src_dir)/resource-loader/resource-thread-base.cpp \
-  $(tizen_platform_abstraction_src_dir)/resource-loader/resource-thread-image.cpp \
-  \
   $(tizen_platform_abstraction_src_dir)/resource-loader/network/file-download.cpp \
   $(tizen_platform_abstraction_src_dir)/resource-loader/network/http-utils.cpp \
   \
index 15e3318ba071c085d0dc65b814f356fc43925bba..02317b564de91867d5f7bab1e064b476cf0bd5cc 100644 (file)
@@ -19,7 +19,6 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/images/image-operations.h>
-#include <dali/integration-api/resource-cache.h>
 #include <dali/integration-api/resource-types.h>
 #include <dali/integration-api/bitmap.h>
 
 
 namespace Dali
 {
+namespace Integration
+{
+typedef IntrusivePtr<Dali::RefObject> ResourcePointer;
+} // Integration
+
 namespace TizenPlatform
 {
 namespace ImageLoader
index e8ebb96fa793303cd82714368aa9b9d26a2c6cb7..cc6f77430ebfbbdc2c7b53005afd28089514798a 100644 (file)
@@ -22,7 +22,6 @@
 #if defined(DEBUG_ENABLED)
 
 #include <platform-abstractions/tizen/resource-loader/resource-loader.h>
-#include <dali/integration-api/resource-cache.h>
 
 
 namespace Dali
index 67da90198893ed0c80f8616ab6b7f9f890c2f62a..ab3e3201b3920603a9a95f3280aabbae149ca22f 100644 (file)
@@ -19,7 +19,6 @@
 #include "resource-bitmap-requester.h"
 
 // EXTERNAL INCLUDES
-#include <dali/integration-api/resource-cache.h>
 
 // INTERNAL INCLUDES
 #include "network/file-download.h"
@@ -41,113 +40,15 @@ enum ResourceScheme
 }// unnamed namespace
 
 ResourceBitmapRequester::ResourceBitmapRequester( ResourceLoader& resourceLoader )
-: ResourceRequesterBase( resourceLoader ),
-  mThreadImageLocal( NULL ),
-  mThreadImageRemote( NULL )
+: ResourceRequesterBase( resourceLoader )
 {
 }
 
 ResourceBitmapRequester::~ResourceBitmapRequester()
 {
-  delete mThreadImageLocal;
-  delete mThreadImageRemote;
 }
 
-void ResourceBitmapRequester::Pause()
-{
-  if( mThreadImageLocal )
-  {
-    mThreadImageLocal->Pause();
-  }
-  if( mThreadImageRemote )
-  {
-    mThreadImageRemote->Pause();
-  }
-}
-
-void ResourceBitmapRequester::Resume()
-{
-  if( mThreadImageLocal )
-  {
-    mThreadImageLocal->Resume();
-  }
-  if( mThreadImageRemote )
-  {
-    mThreadImageRemote->Resume();
-  }
-}
-
-void ResourceBitmapRequester::LoadResource( Integration::ResourceRequest& request )
-{
-  DALI_ASSERT_DEBUG( (0 != dynamic_cast<BitmapResourceType*>(request.GetType())) && "Only requsts for bitmap resources can ever be routed to ResourceBitmapRequester.\n");
-  BitmapResourceType* resType = static_cast<BitmapResourceType*>(request.GetType());
-  if( !resType )
-  {
-    return;
-  }
-
-  // Work out what thread to decode / load the image on:
-  ResourceScheme scheme( FILE_SYSTEM_RESOURCE );
-
-  // Work out if the resource is in memory, a file, or in a remote server:
-  ResourceThreadBase::RequestType requestType;
 
-  // if resource exists already, then it just needs decoding
-  if( request.GetResource().Get() )
-  {
-    requestType = ResourceThreadBase::RequestDecode;
-  }
-  else
-  {
-    const std::string& resourcePath = request.GetPath();
-    if( Network::IsHttpUrl( resourcePath) )
-    {
-      requestType = ResourceThreadBase::RequestDownload;
-      scheme = NETWORK_RESOURCE;
-    }
-    else
-    {
-      requestType = ResourceThreadBase::RequestLoad;
-    }
-  }
-
-  // Dispatch the job to the right thread
-  // lazily create the thread
-  if( scheme ==  FILE_SYSTEM_RESOURCE )
-  {
-    if( !mThreadImageLocal )
-    {
-      mThreadImageLocal = new ResourceThreadImage( mResourceLoader );
-    }
-    mThreadImageLocal->AddRequest( request, requestType );
-  }
-  else
-  {
-    if( !mThreadImageRemote )
-    {
-      mThreadImageRemote = new ResourceThreadImage( mResourceLoader );
-    }
-    mThreadImageRemote->AddRequest( request, requestType );
-  }
-}
-
-Integration::LoadStatus ResourceBitmapRequester::LoadFurtherResources( Integration::ResourceRequest& request, LoadedResource partialResource )
-{
-  // Nothing to do
-  return RESOURCE_COMPLETELY_LOADED;
-}
-
-void ResourceBitmapRequester::CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId)
-{
-  if( mThreadImageLocal )
-  {
-    mThreadImageLocal->CancelRequest(id);
-  }
-  if( mThreadImageRemote )
-  {
-    mThreadImageRemote->CancelRequest(id);
-  }
-}
 
 } // TizenPlatform
 } // Dali
index 7f59e6ba118e7c226eae86ee2dde2fce973b31a3..71f87ed226987e3ebbd589ddd9c20b884884af8a 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 #include "resource-requester-base.h"
-#include "resource-thread-image.h"
 
 namespace Dali
 {
@@ -43,34 +42,7 @@ public:
    */
   virtual ~ResourceBitmapRequester();
 
-  /**
-   * @copydoc ResourceRequester::Pause()
-   */
-  virtual void Pause();
-
-  /**
-   * @copydoc ResourceRequester::Resume()
-   */
-  virtual void Resume();
-
-  /**
-   * @copydoc ResourceRequester::LoadResource()
-   */
-  virtual void LoadResource( Integration::ResourceRequest& request );
-
-  /**
-   * @copydoc ResourceRequester::LoadFurtherResources()
-   */
-  virtual Integration::LoadStatus LoadFurtherResources( Integration::ResourceRequest& request, LoadedResource partialResource );
-
-  /**
-   * @copydoc ResourceRequester::CancelLoad()
-   */
-  virtual void CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId);
-
 private:
-  ResourceThreadImage*          mThreadImageLocal;      ///< Image loader thread object to load images in local machine
-  ResourceThreadImage*          mThreadImageRemote;     ///< Image loader thread object to download images in remote http server
 };
 
 } // TizenPlatform
index 967d2d9946ae224fb17e4dbffae06a249a5ac752..c9ad3cc128dcd126ec569a48e6c1c615f3c30d80 100755 (executable)
@@ -29,7 +29,6 @@
 // INTERNAL HEADERS
 #include <dali/integration-api/bitmap.h>
 #include <dali/integration-api/debug.h>
-#include <dali/integration-api/resource-cache.h>
 #include <dali/public-api/common/dali-common.h>
 #include <dali/devel-api/common/set-wrapper.h>
 #include <dali/public-api/math/vector2.h>
@@ -47,10 +46,6 @@ namespace TizenPlatform
 
 struct ResourceLoader::ResourceLoaderImpl
 {
-  typedef std::pair<ResourceId, ResourceRequest>  RequestStorePair;
-  typedef std::map<ResourceId, ResourceRequest>   RequestStore;
-  typedef RequestStore::iterator                  RequestStoreIter;
-
   typedef std::queue<LoadedResource> LoadedQueue;
   typedef std::queue<FailedResource> FailedQueue;
 
@@ -63,7 +58,6 @@ struct ResourceLoader::ResourceLoaderImpl
   FailedQueue  mFailedLoads;            ///< Failed load request notifications are stored here until fetched by core
 
   RequestHandlers mRequestHandlers;
-  RequestStore mStoredRequests;         ///< Used to store load requests until loading is completed
 
   ResourceLoaderImpl( ResourceLoader* loader )
   {
@@ -80,32 +74,6 @@ struct ResourceLoader::ResourceLoaderImpl
     }
   }
 
-  void Pause()
-  {
-    // Pause all the request handlers:
-    for( RequestHandlersIter it = mRequestHandlers.begin(), end = mRequestHandlers.end(); it != end;  ++it )
-    {
-      ResourceRequesterBase * const requester = it->second;
-      if( requester )
-      {
-        requester->Pause();
-      }
-    }
-  }
-
-  void Resume()
-  {
-    // Wake up all the request handlers:
-    for( RequestHandlersIter it = mRequestHandlers.begin(), end = mRequestHandlers.end(); it != end;  ++it )
-    {
-      ResourceRequesterBase * const requester = it->second;
-      if( requester )
-      {
-        requester->Resume();
-      }
-    }
-  }
-
   ResourceRequesterBase* GetRequester(ResourceTypeId typeId)
   {
     ResourceRequesterBase* requestHandler = NULL;
@@ -118,87 +86,6 @@ struct ResourceLoader::ResourceLoaderImpl
     return requestHandler;
   }
 
-  void LoadResource(const ResourceRequest& request)
-  {
-    // Store resource request for partial loaders. Will get cleaned up after load complete has finished
-    StoreRequest(request);
-
-    ResourceRequesterBase* requester = GetRequester(request.GetType()->id);
-    if( requester )
-    {
-      ResourceRequest* storedRequest = GetRequest(request.GetId());
-      if( storedRequest != NULL )
-      {
-        requester->LoadResource(*storedRequest); // Pass in stored request
-      }
-    }
-    else
-    {
-      DALI_LOG_ERROR( "Unknown resource type (%u) with path \"%s\" in load request.\n", request.GetType()->id, request.GetPath().c_str() );
-      DALI_ASSERT_DEBUG( 0 == "Unknown resource type in load request at " __FILE__ ".\n" );
-    }
-  }
-
-  void CancelLoad(ResourceId id, ResourceTypeId typeId)
-  {
-    ResourceRequesterBase* requester = GetRequester(typeId);
-    if( requester )
-    {
-      requester->CancelLoad( id, typeId );
-    }
-    ClearRequest( id );
-  }
-
-  LoadStatus LoadFurtherResources( LoadedResource partialResource )
-  {
-    LoadStatus loadStatus = RESOURCE_LOADING;
-    RequestStoreIter iter = mStoredRequests.find(partialResource.id);
-
-    if( mStoredRequests.end() != iter ) // else cancelled. Ignore response
-    {
-      ResourceRequest& request = iter->second;
-      ResourceRequesterBase* requester = GetRequester(request.GetType()->id);
-      if( requester )
-      {
-        loadStatus = requester->LoadFurtherResources( request, partialResource );
-      }
-
-      DALI_LOG_INFO(gLoaderFilter, Debug::General, "ResourceLoader::LoadFurtherResources( ID:%u complete: %s)\n",  request.GetId(), loadStatus==RESOURCE_LOADING?"Loading":loadStatus==RESOURCE_PARTIALLY_LOADED?"PARTIAL":"COMPLETE" );
-    }
-
-    if( loadStatus == RESOURCE_COMPLETELY_LOADED )
-    {
-      ClearRequest( partialResource.id );
-    }
-
-    return loadStatus;
-  }
-
-  void GetResources(ResourceCache& cache)
-  {
-    // Fill the resource cache
-
-    Mutex::ScopedLock lock( mQueueMutex );
-
-    // iterate through the successfully loaded resources
-    while (!mLoadedQueue.empty())
-    {
-      LoadedResource loaded( mLoadedQueue.front() );
-      mLoadedQueue.pop();
-      ClearRequest( loaded.id );
-      cache.LoadResponse( loaded.id, loaded.type, loaded.resource, RESOURCE_COMPLETELY_LOADED );
-    }
-
-    // iterate through the resources which failed to load
-    while (!mFailedLoads.empty())
-    {
-      FailedResource failed(mFailedLoads.front());
-      mFailedLoads.pop();
-      ClearRequest(failed.id);
-      cache.LoadFailed(failed.id, failed.failureType);
-    }
-  }
-
   void AddLoadedResource(LoadedResource& resource)
   {
     // Lock the LoadedQueue to store the loaded resource
@@ -215,33 +102,6 @@ struct ResourceLoader::ResourceLoaderImpl
     mFailedLoads.push(resource);
   }
 
-  void StoreRequest( const ResourceRequest& request )
-  {
-    DALI_LOG_INFO(gLoaderFilter, Debug::Verbose, "ResourceLoader: StoreRequest(id:%u)\n", request.GetId());
-    mStoredRequests.insert( RequestStorePair( request.GetId(), request ) ); // copy request as value type
-  }
-
-  ResourceRequest* GetRequest( ResourceId id )
-  {
-    ResourceRequest* found(NULL);
-    DALI_LOG_INFO(gLoaderFilter, Debug::Verbose, "ResourceLoader: GetRequest(id:%u)\n", id);
-    RequestStoreIter iter = mStoredRequests.find( id );
-    if( mStoredRequests.end() != iter )
-    {
-      found = &iter->second;
-    }
-    return found;
-  }
-
-  void ClearRequest( ResourceId resourceId )
-  {
-    DALI_LOG_INFO(gLoaderFilter, Debug::Verbose, "ResourceLoader: ClearRequest(id:%u)\n", resourceId);
-    RequestStoreIter iter = mStoredRequests.find( resourceId );
-    if( mStoredRequests.end() != iter ) // Can't assert here - cancel load may cross with load failed
-    {
-      mStoredRequests.erase( iter );
-    }
-  }
 
 private:
 
@@ -266,26 +126,11 @@ ResourceLoader::~ResourceLoader()
   delete mImpl;
 }
 
-void ResourceLoader::Pause()
-{
-  mImpl->Pause();
-}
-
-void ResourceLoader::Resume()
-{
-  mImpl->Resume();
-}
-
 bool ResourceLoader::IsTerminating()
 {
   return __sync_fetch_and_or( &mTerminateThread, 0 );
 }
 
-void ResourceLoader::GetResources(ResourceCache& cache)
-{
-  mImpl->GetResources( cache );
-}
-
 /********************************************************************************/
 /**************************   CALLED FROM LOADER THREADS   **********************/
 /********************************************************************************/
@@ -304,15 +149,6 @@ void ResourceLoader::AddFailedLoad(FailedResource& resource)
 /*********************   CALLED FROM PLATFORM ABSTRACTION  **********************/
 /********************************************************************************/
 
-void ResourceLoader::LoadResource(const ResourceRequest& request)
-{
-  mImpl->LoadResource(request);
-}
-
-void ResourceLoader::CancelLoad(ResourceId id, ResourceTypeId typeId)
-{
-  mImpl->CancelLoad(id, typeId);
-}
 
 bool ResourceLoader::LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const
 {
index 27028ee487ec659b5b85db4cdbb1df0648447233..41b28be4e61152cf3c47b59898dd59bc4196dbc0 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 #include <dali/integration-api/platform-abstraction.h>
-#include <dali/integration-api/resource-cache.h>
 #include <dali/public-api/common/dali-vector.h>
 
 #include <string>
@@ -88,32 +87,6 @@ struct LoadedResource
  */
 struct FailedResource
 {
-  FailedResource(Integration::ResourceId resourceId, Integration::ResourceFailure failure):
-    id(resourceId),
-    failureType(failure)
-  {
-  }
-
-  /// Copy constructor
-  FailedResource(const FailedResource& failed)
-  : id(failed.id),
-    failureType(failed.failureType)
-  {
-  }
-
-  /// Assignment operator
-  FailedResource& operator=(const FailedResource& rhs)
-  {
-    if( this != &rhs )
-    {
-      id = rhs.id;
-      failureType = rhs.failureType;
-    }
-    return *this;
-  }
-
-  Integration::ResourceId      id;
-  Integration::ResourceFailure failureType;
 };
 
 /**
@@ -138,16 +111,6 @@ public:
    */
   ~ResourceLoader();
 
-  /**
-   * Pause processing of already-queued resource requests.
-   */
-  void Pause();
-
-  /**
-   * Continue processing resource requests.
-   */
-  void Resume();
-
   /**
    * Check if the ResourceLoader is terminating
    * @return true if terminating else false
@@ -168,21 +131,6 @@ public:
 
   // From PlatformAbstraction
 
-  /**
-   * @copydoc PlatformAbstraction::LoadResource()
-   */
-  void LoadResource(const Integration::ResourceRequest& request);
-
-  /**
-   * @copydoc PlatformAbstraction::CancelLoad()
-   */
-  void CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId);
-
-  /**
-   * @copydoc PlatformAbstraction::GetResources()
-   */
-  void GetResources(Integration::ResourceCache& cache);
-
   /**
    * @copydoc SlpPlatformAbstraction::LoadFile()
    */
index 71ba1d6836613334dd151d6ef36de0ac5365fee3..713a21750dd009c496cff5e54eb4735e6fb94e3e 100644 (file)
  */
 
 #include <platform-abstractions/tizen/resource-loader/resource-loader.h>
-#include <dali/integration-api/resource-request.h>
-#include <dali/integration-api/resource-cache.h>
 
 namespace Dali
 {
-namespace Integration
-{
-class ResourceRequest;
-}
-
 namespace TizenPlatform
 {
 
@@ -49,36 +42,6 @@ public:
    */
   virtual ~ResourceRequesterBase();
 
-  /**
-   * Pause starting new work on background threads, but keep that work queued.
-   */
-  virtual void Pause() = 0;
-
-  /**
-   * Resume processing tasks on background threads.
-   */
-  virtual void Resume() = 0;
-
-  /**
-   * Load a resource.
-   * @param[in] request The resource request
-   */
-  virtual void LoadResource( Integration::ResourceRequest& request ) = 0;
-
-  /**
-   * Load more resources (for partial loading)
-   * @param[in] request The initial load request
-   * @param[in] partialResource The resources loaded by the last request
-   * @return LOADING or PARTIALLY_LOADED if more resources to come, COMPLETELY_LOADED if complete
-   */
-  virtual Integration::LoadStatus LoadFurtherResources( Integration::ResourceRequest& request, LoadedResource partialResource ) = 0;
-
-  /**
-   * Cancal load requests
-   * @param[in] id The request id of the loading request
-   * @param[in] typeId The resource type id of the loading request
-   */
-  virtual void CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId) = 0;
 
 protected:
   ResourceLoader& mResourceLoader; ///< The resource loader to which to send results
diff --git a/platform-abstractions/tizen/resource-loader/resource-thread-base.cpp b/platform-abstractions/tizen/resource-loader/resource-thread-base.cpp
deleted file mode 100644 (file)
index e5c930e..0000000
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <memory>
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include "resource-thread-base.h"
-#include "tizen-logging.h"
-#include "atomics.h"
-
-using namespace Dali::Integration;
-
-namespace Dali
-{
-
-// Initial values for the members tracking which resources have been cancelled.
-// They start out with different values so that if the first load executed is
-// synchronous, it won't be erroneously cancelled.
-const Integration::ResourceId NO_REQUEST_IN_FLIGHT = Integration::ResourceId(0) - 1;
-const Integration::ResourceId NO_REQUEST_CANCELLED = Integration::ResourceId(0) - 2;
-
-namespace TizenPlatform
-{
-
-namespace
-{
-const char * const IDLE_PRIORITY_ENVIRONMENT_VARIABLE_NAME = "DALI_RESOURCE_THREAD_IDLE_PRIORITY";
-} // unnamed namespace
-
-/** Thrown by InterruptionPoint() to abort a request early. */
-class CancelRequestException {};
-
-ResourceThreadBase::ResourceThreadBase( ResourceLoader& resourceLoader ) :
-  mResourceLoader( resourceLoader ),
-  mThread( 0 ),
-  mCurrentRequestId( NO_REQUEST_IN_FLIGHT ),
-  mCancelRequestId( NO_REQUEST_CANCELLED ),
-  mPaused( false )
-{
-#if defined(DEBUG_ENABLED)
-  mLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_RESOURCE_THREAD_BASE");
-#endif
-
-  int error = pthread_create( &mThread, NULL, InternalThreadEntryFunc, this );
-  DALI_ASSERT_ALWAYS( !error && "Error in pthread_create()" );
-}
-
-ResourceThreadBase::~ResourceThreadBase()
-{
-  TerminateThread();
-
-#if defined(DEBUG_ENABLED)
-  delete mLogFilter;
-#endif
-}
-
-void ResourceThreadBase::TerminateThread()
-{
-  if (mThread)
-  {
-    // wake thread
-    mCondition.Notify();
-
-    // wait for thread to exit
-    pthread_join( mThread, NULL );
-
-    mThread = 0;
-  }
-}
-
-void ResourceThreadBase::AddRequest(const ResourceRequest& request, const RequestType type)
-{
-  bool wasEmpty = false;
-  bool wasPaused = false;
-
-  {
-    // Lock while adding to the request queue
-    ConditionalWait::ScopedLock lock( mCondition );
-
-    wasEmpty = mQueue.empty();
-    wasPaused = mPaused;
-
-    mQueue.push_back( std::make_pair(request, type) );
-  }
-
-  if( wasEmpty && !wasPaused )
-  {
-    // Wake-up the thread
-    mCondition.Notify();
-  }
-}
-
-// Called from outer thread.
-void ResourceThreadBase::CancelRequest( const Integration::ResourceId resourceId )
-{
-  bool found = false;
-  DALI_LOG_INFO( mLogFilter, Debug::Verbose, "%s: %u.\n", __FUNCTION__, unsigned(resourceId) );
-
-  // Eliminate the cancelled request from the request queue if it is in there:
-  {
-    // Lock while searching and removing from the request queue:
-    ConditionalWait::ScopedLock lock( mCondition );
-
-    for( RequestQueueIter iterator = mQueue.begin();
-         iterator != mQueue.end();
-         ++iterator )
-    {
-      if( ((*iterator).first).GetId() == resourceId )
-      {
-        iterator = mQueue.erase( iterator );
-        found = true;
-        break;
-      }
-    }
-  }
-
-  // Remember the cancelled id for the worker thread to poll at one of its points
-  // of interruption:
-  if( !found )
-  {
-    Dali::Internal::AtomicWriteToCacheableAlignedAddress( &mCancelRequestId, resourceId );
-    DALI_LOG_INFO( mLogFilter, Debug::Concise, "%s: Cancelling in-flight resource (%u).\n", __FUNCTION__, unsigned(resourceId) );
-  }
-}
-
-// Called from worker thread.
-void ResourceThreadBase::InterruptionPoint() const
-{
-  const Integration::ResourceId cancelled = Dali::Internal::AtomicReadFromCacheableAlignedAddress( &mCancelRequestId );
-  const Integration::ResourceId current = mCurrentRequestId;
-
-  if( current == cancelled )
-  {
-    DALI_LOG_INFO( mLogFilter, Debug::Concise, "%s: Cancelled in-flight resource (%u).\n", __FUNCTION__, unsigned(cancelled) );
-    throw CancelRequestException();
-  }
-}
-
-void* ResourceThreadBase::InternalThreadEntryFunc( void* This )
-{
-    ( static_cast<ResourceThreadBase*>( This ) )->ThreadLoop();
-    return NULL;
-}
-
-void ResourceThreadBase::Pause()
-{
-  ConditionalWait::ScopedLock lock( mCondition );
-  mPaused = true;
-}
-
-void ResourceThreadBase::Resume()
-{
-  // Clear the paused flag and if we weren't running already, also wake up the background thread:
-  bool wasPaused = false;
-  {
-    ConditionalWait::ScopedLock lock( mCondition );
-    wasPaused = mPaused;
-    mPaused = false;
-  }
-
-  // If we were paused, wake up the background thread and give it a
-  // chance to do some work:
-  if( wasPaused )
-  {
-    mCondition.Notify();
-  }
-}
-
-//----------------- Called from separate thread (mThread) -----------------
-
-void ResourceThreadBase::ThreadLoop()
-{
-  // TODO: Use Environment Options
-  const char* threadPriorityIdleRequired = std::getenv( IDLE_PRIORITY_ENVIRONMENT_VARIABLE_NAME );
-  if( threadPriorityIdleRequired )
-  {
-    // if the parameter exists then set up an idle priority for this thread
-    struct sched_param sp;
-    sp.sched_priority = 0;
-    sched_setscheduler(0, SCHED_IDLE, &sp);
-    ///@ToDo: change to the corresponding Pthreads call, not this POSIX.1-2001 one with a Linux-specific argument (SCHED_IDLE): int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param);, as specified in the docs for sched_setscheduler(): http://man7.org/linux/man-pages/man2/sched_setscheduler.2.html
-  }
-
-  InstallLogging();
-
-  while( !mResourceLoader.IsTerminating() )
-  {
-    try
-    {
-      WaitForRequests();
-
-      if ( !mResourceLoader.IsTerminating() )
-      {
-        ProcessNextRequest();
-      }
-    }
-
-    catch( CancelRequestException& ex )
-    {
-      // No problem: a derived class deliberately threw to abort an in-flight request
-      // that was cancelled.
-      DALI_LOG_INFO( mLogFilter, Debug::Concise, "%s: Caught cancellation exception for resource (%u).\n", __FUNCTION__, unsigned(mCurrentRequestId) );
-      CancelRequestException* disableUnusedVarWarning = &ex;
-      ex = *disableUnusedVarWarning;
-    }
-
-    // Catch all exceptions to avoid killing the process, and log the error:
-    catch( std::exception& ex )
-    {
-      const char * const what = ex.what();
-      DALI_LOG_ERROR( "std::exception caught in resource thread. Aborting request with id %u because of std::exception with reason, \"%s\".\n", unsigned(mCurrentRequestId), what ? what : "null" );
-    }
-    catch( Dali::DaliException& ex )
-    {
-      // Probably a failed assert-always:
-      DALI_LOG_ERROR( "DaliException caught in resource thread. Aborting request with id %u. Location: \"%s\". Condition: \"%s\".\n", unsigned(mCurrentRequestId), ex.location, ex.condition );
-    }
-    catch( ... )
-    {
-      DALI_LOG_ERROR( "Unknown exception caught in resource thread. Aborting request with id %u.\n", unsigned(mCurrentRequestId) );
-    }
-  }
-}
-
-void ResourceThreadBase::WaitForRequests()
-{
-  ConditionalWait::ScopedLock lock( mCondition );
-
-  if( mQueue.empty() || mPaused == true )
-  {
-    // Waiting for a wake up from resource loader control thread
-    // This will be to process a new request or terminate
-    mCondition.Wait( lock );
-  }
-}
-
-void ResourceThreadBase::ProcessNextRequest()
-{
-  ResourceRequest* request(NULL);
-  RequestType type(RequestLoad);
-
-  {
-    // lock the queue and extract the next request
-    ConditionalWait::ScopedLock lock( mCondition );
-
-    if (!mQueue.empty())
-    {
-      const RequestInfo & front = mQueue.front();
-      request = new ResourceRequest( front.first );
-      type = front.second;
-      mCurrentRequestId = front.first.GetId();
-      mQueue.pop_front();
-    }
-  } // unlock the queue
-
-  // process request outside of lock
-  if ( NULL != request )
-  {
-#ifdef _CPP11
-    std::unique_ptr< ResourceRequest > deleter( request );
-#else
-    std::auto_ptr< ResourceRequest > deleter( request );
-#endif
-    switch( type )
-    {
-      case RequestLoad:
-      {
-        Load(*request);
-      }
-      break;
-
-      case RequestDownload:
-      {
-        Download(*request);
-      }
-      break;
-
-      case RequestDecode:
-      {
-        Decode(*request);
-      }
-      break;
-    }
-  }
-}
-
-void ResourceThreadBase::InstallLogging()
-{
-  // resource loading thread will send its logs to TIZEN Platform's LogMessage handler.
-  Dali::Integration::Log::InstallLogFunction(Dali::TizenPlatform::LogMessage);
-}
-
-void ResourceThreadBase::UninstallLogging()
-{
-  // uninstall it on resource loading thread.
-  Dali::Integration::Log::UninstallLogFunction();
-}
-
-void ResourceThreadBase::Download(const Integration::ResourceRequest& request)
-{
-  DALI_LOG_TRACE_METHOD(mLogFilter);
-  DALI_LOG_WARNING("Resource Downloading from a remote server not supported for this type.\n");
-  ///! If you need this for a subclassed thread, look to ResourceThreadImage::Download() for an example implementation.
-}
-
-void ResourceThreadBase::Decode(const Integration::ResourceRequest& request)
-{
-  DALI_LOG_TRACE_METHOD(mLogFilter);
-  DALI_LOG_WARNING("Resource Decoding from a memory buffer not supported for this type.\n");
-  ///! If you need this for a subclassed thread, look to ResourceThreadImage::Decode() for an example implementation.
-}
-
-} // namespace TizenPlatform
-
-} // namespace Dali
diff --git a/platform-abstractions/tizen/resource-loader/resource-thread-base.h b/platform-abstractions/tizen/resource-loader/resource-thread-base.h
deleted file mode 100644 (file)
index 280785d..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-#ifndef __DALI_TIZEN_PLATFORM_RESOURCE_THREAD_BASE_H__
-#define __DALI_TIZEN_PLATFORM_RESOURCE_THREAD_BASE_H__
-
-/*
- * Copyright (c) 2015 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <deque>
-#include <dali/devel-api/threading/conditional-wait.h>
-
-// INTERNAL INCLUDES
-#include "resource-loader.h"
-#include "resource-loading-client.h"
-
-namespace Dali
-{
-
-namespace TizenPlatform
-{
-
-/**
- * Resource loader worker thread
- */
-class ResourceThreadBase : public ResourceLoadingClient
-{
-public:
-  // typedefs and enums
-
-  /** Client threads send work to resource threads through Requests, for which
-   *  this type identifies the action to be taken on the resource thread. */
-  enum RequestType
-  {
-    /** Pull a resource out of the platform's file system. */
-    RequestLoad,
-    /** Pull a resource from the network. */
-    RequestDownload,
-    /** Pull a resource out of a memory buffer. */
-    RequestDecode
-  };
-
-  typedef std::pair<Integration::ResourceRequest, RequestType>  RequestInfo;
-  typedef std::deque<RequestInfo>                               RequestQueue;
-  typedef RequestQueue::iterator                                RequestQueueIter;
-
-public:
-  // Constructor
-  ResourceThreadBase(ResourceLoader& resourceLoader);
-
-  // Destructor
-  virtual ~ResourceThreadBase();
-
-protected:
-  void TerminateThread();
-
-public:
-  /**
-   * Add a resource request to the back of the queue
-   * @param[in] request The requested resource/file url and attributes
-   * @param[in] type    Load or save flag
-   */
-  void AddRequest(const Integration::ResourceRequest& request, const RequestType type);
-
-  /**
-   * Cancel a resource request. Removes the request from the queue.
-   * @param[in] resourceId ID of the resource to be canceled
-   */
-  void CancelRequest(Integration::ResourceId  resourceId);
-
-  /**
-   * Pause starting new work in the background, but keep that work queued.
-   */
-  void Pause();
-
-  /**
-   * Resume processing tasks on background thread.
-   */
-  void Resume();
-
-
-protected:
-  /**
-   * Main control loop for the thread.
-   * The thread is terminated when this function exits
-   */
-  void ThreadLoop();
-
-  /**
-   * Wait for an incoming resource request or termination
-   */
-  void WaitForRequests();
-
-  /**
-   * Process the resource request at the head of the queue
-   */
-  void ProcessNextRequest();
-
-  /**
-   * Install a logging function in to core for this thread.
-   */
-  void InstallLogging();
-
-  /**
-   * Uninstall a logging function.
-   */
-  void UninstallLogging();
-
-  /**
-   * Load a resource
-   * @param[in] request  The requested resource/file url and attributes
-   */
-  virtual void Load(const Integration::ResourceRequest& request) = 0;
-
-  /**
-   * Download a resource
-   * @param[in] request  The requested resource/file url and attributes
-   */
-  virtual void Download(const Integration::ResourceRequest& request);
-
-  /**
-   * Decode a resource exactly as if it were being loaded but source its data
-   * from a memory buffer attached directly to the request object.
-   * @param[in] request  The requested resource data and attributes
-   */
-  virtual void Decode(const Integration::ResourceRequest& request);
-
-  /**
-   * @brief Cancels current resource request if it matches the one latched to be cancelled.
-   *
-   * @copydoc ResourceLoadingClient::InterruptionPoint
-   */
-  virtual void InterruptionPoint() const;
-
-private:
-  /**
-   * Helper for the thread calling the entry function
-   * @param[in] This A pointer to the current UpdateThread object
-   */
-  static void* InternalThreadEntryFunc( void* This );
-
-protected:
-  ResourceLoader&                    mResourceLoader;
-  pthread_t                          mThread;    ///< thread instance
-  ConditionalWait                    mCondition; ///< condition variable
-  RequestQueue                       mQueue;     ///< Request queue
-private:
-  Integration::ResourceId          mCurrentRequestId; ///< Current request, set by worker thread
-  volatile Integration::ResourceId mCancelRequestId;  ///< Request to be cancelled on thread: written by external thread and read by worker.
-  bool                             mPaused;           ///< Whether to process work in mQueue
-
-private:
-
-  // Undefined
-  ResourceThreadBase( const ResourceThreadBase& resourceThreadBase );
-
-  // Undefined
-  ResourceThreadBase& operator=( const ResourceThreadBase& resourceThreadBase );
-
-#if defined(DEBUG_ENABLED)
-public:
-  Integration::Log::Filter* mLogFilter;
-#endif
-}; // class ResourceThreadBase
-
-} // namespace TizenPlatform
-
-} // namespace Dali
-
-#endif // __DALI_TIZEN_PLATFORM_RESOURCE_THREAD_BASE_H__
diff --git a/platform-abstractions/tizen/resource-loader/resource-thread-image.cpp b/platform-abstractions/tizen/resource-loader/resource-thread-image.cpp
deleted file mode 100755 (executable)
index 02886c0..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (c) 2015 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 "resource-thread-image.h"
-
-// EXTERNAL INCLUDES
-#include <dali/devel-api/common/ref-counted-dali-vector.h>
-#include <dali/integration-api/bitmap.h>
-#include <dali/integration-api/debug.h>
-#include <dali/integration-api/resource-cache.h>
-#include <dali/integration-api/resource-types.h>
-
-// INTERNAL INCLUDES
-#include "portable/file-closer.h"
-#include "image-loaders/image-loader.h"
-#include "network/file-download.h"
-
-using namespace Dali::Integration;
-
-namespace Dali
-{
-
-namespace TizenPlatform
-{
-
-namespace
-{
-
-// limit maximum image down load size to 50 MB
-const size_t MAXIMUM_DOWNLOAD_IMAGE_SIZE  = 50 * 1024 * 1024 ;
-}
-
-ResourceThreadImage::ResourceThreadImage(ResourceLoader& resourceLoader)
-: ResourceThreadBase(resourceLoader)
-{
-}
-
-ResourceThreadImage::~ResourceThreadImage()
-{
-}
-
-void ResourceThreadImage::Load(const ResourceRequest& request)
-{
-  DALI_LOG_TRACE_METHOD( mLogFilter );
-  DALI_LOG_INFO( mLogFilter, Debug::Verbose, "%s(%s)\n", __FUNCTION__, request.GetPath().c_str() );
-
-  LoadImageFromLocalFile(request);
-}
-
-void ResourceThreadImage::Download(const ResourceRequest& request)
-{
-  bool succeeded;
-
-  DALI_LOG_TRACE_METHOD( mLogFilter );
-  DALI_LOG_INFO( mLogFilter, Debug::Verbose, "%s(%s)\n", __FUNCTION__, request.GetPath().c_str() );
-
-  Dali::Vector<uint8_t> dataBuffer;
-  size_t dataSize;
-  succeeded = DownloadRemoteImageIntoMemory( request, dataBuffer, dataSize );
-  if( succeeded )
-  {
-    DecodeImageFromMemory(static_cast<void*>(&dataBuffer[0]), dataBuffer.Size(), request);
-  }
-}
-
-void ResourceThreadImage::Decode(const ResourceRequest& request)
-{
-  DALI_LOG_TRACE_METHOD( mLogFilter );
-  DALI_LOG_INFO(mLogFilter, Debug::Verbose, "%s(%s)\n", __FUNCTION__, request.GetPath().c_str());
-
-  // Get the blob of binary data that we need to decode:
-  DALI_ASSERT_DEBUG( request.GetResource() );
-
-  DALI_ASSERT_DEBUG( 0 != dynamic_cast<Dali::RefCountedVector<uint8_t>*>( request.GetResource().Get() ) && "Only blobs of binary data can be decoded." );
-  Dali::RefCountedVector<uint8_t>* const encodedBlob = reinterpret_cast<Dali::RefCountedVector<uint8_t>*>( request.GetResource().Get() );
-
-  if( 0 != encodedBlob )
-  {
-    const size_t blobSize     = encodedBlob->GetVector().Size();
-    uint8_t * const blobBytes = &(encodedBlob->GetVector()[0]);
-    DecodeImageFromMemory(blobBytes, blobSize, request);
-  }
-  else
-  {
-    FailedResource resource(request.GetId(), FailureUnknown);
-    mResourceLoader.AddFailedLoad(resource);
-  }
-}
-
-bool ResourceThreadImage::DownloadRemoteImageIntoMemory(const Integration::ResourceRequest& request, Dali::Vector<uint8_t>& dataBuffer, size_t& dataSize)
-{
-  bool ok = Network::DownloadRemoteFileIntoMemory( request.GetPath(), dataBuffer,  dataSize, MAXIMUM_DOWNLOAD_IMAGE_SIZE );
-  if( !ok )
-  {
-    FailedResource resource(request.GetId(), FailureUnknown);
-    mResourceLoader.AddFailedLoad(resource);
-  }
-  return ok;
-}
-
-void ResourceThreadImage::LoadImageFromLocalFile(const Integration::ResourceRequest& request)
-{
-  bool fileNotFound = false;
-  BitmapPtr bitmap = 0;
-  bool result = false;
-
-  Dali::Internal::Platform::FileCloser fileCloser( request.GetPath().c_str(), "rb" );
-  FILE * const fp = fileCloser.GetFile();
-
-  if( NULL != fp )
-  {
-    result = ImageLoader::ConvertStreamToBitmap( *request.GetType(), request.GetPath(), fp, *this, bitmap );
-    // Last chance to interrupt a cancelled load before it is reported back to clients
-    // which have already stopped tracking it:
-    InterruptionPoint(); // Note: This can throw an exception.
-    if( result && bitmap )
-    {
-      // Construct LoadedResource and ResourcePointer for image data
-      LoadedResource resource( request.GetId(), request.GetType()->id, ResourcePointer( bitmap.Get() ) );
-      // Queue the loaded resource
-      mResourceLoader.AddLoadedResource( resource );
-    }
-    else
-    {
-      DALI_LOG_WARNING( "Unable to decode %s\n", request.GetPath().c_str() );
-    }
-  }
-  else
-  {
-    DALI_LOG_WARNING( "Failed to open file to load \"%s\"\n", request.GetPath().c_str() );
-    fileNotFound = true;
-  }
-
-  if ( !bitmap )
-  {
-    if( fileNotFound )
-    {
-      FailedResource resource(request.GetId(), FailureFileNotFound  );
-      mResourceLoader.AddFailedLoad(resource);
-    }
-    else
-    {
-      FailedResource resource(request.GetId(), FailureUnknown);
-      mResourceLoader.AddFailedLoad(resource);
-    }
-  }
-}
-
-void ResourceThreadImage::DecodeImageFromMemory(void* blobBytes, size_t blobSize, const Integration::ResourceRequest& request)
-{
-  BitmapPtr bitmap = 0;
-
-  DALI_ASSERT_DEBUG( blobSize > 0U );
-  DALI_ASSERT_DEBUG( blobBytes != 0U );
-
-  if( blobBytes != 0 && blobSize > 0U )
-  {
-    // Open a file handle on the memory buffer:
-    Dali::Internal::Platform::FileCloser fileCloser( blobBytes, blobSize, "rb" );
-    FILE * const fp = fileCloser.GetFile();
-    if ( NULL != fp )
-    {
-      bool result = ImageLoader::ConvertStreamToBitmap( *request.GetType(), request.GetPath(), fp, StubbedResourceLoadingClient(), bitmap );
-      if ( result && bitmap )
-      {
-        // Construct LoadedResource and ResourcePointer for image data
-        LoadedResource resource( request.GetId(), request.GetType()->id, ResourcePointer( bitmap.Get() ) );
-        // Queue the loaded resource
-        mResourceLoader.AddLoadedResource( resource );
-      }
-      else
-      {
-        DALI_LOG_WARNING( "Unable to decode bitmap supplied as in-memory blob.\n" );
-      }
-    }
-  }
-
-  if (!bitmap)
-  {
-    FailedResource resource(request.GetId(), FailureUnknown);
-    mResourceLoader.AddFailedLoad(resource);
-  }
-}
-
-} // namespace TizenPlatform
-
-} // namespace Dali
diff --git a/platform-abstractions/tizen/resource-loader/resource-thread-image.h b/platform-abstractions/tizen/resource-loader/resource-thread-image.h
deleted file mode 100644 (file)
index 6d9a009..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-#ifndef __DALI_TIZEN_PLATFORM_RESOURCE_THREAD_IMAGE_H__
-#define __DALI_TIZEN_PLATFORM_RESOURCE_THREAD_IMAGE_H__
-
-/*
- * Copyright (c) 2015 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.
- *
- */
-// EXTERNAL INCLUDES
-#include <dali/integration-api/resource-cache.h>
-#include <dali/integration-api/resource-types.h>
-
-// INTERNAL INCLUDES
-#include "resource-thread-base.h"
-
-namespace Dali
-{
-
-namespace TizenPlatform
-{
-
-class ResourceThreadImage : public ResourceThreadBase
-{
-public:
-  /**
-   * Constructor
-   * @param[in] resourceLoader A reference to the ResourceLoader
-   */
-  ResourceThreadImage( ResourceLoader& resourceLoader );
-
-  /**
-   * Destructor
-   */
-  virtual ~ResourceThreadImage();
-
-
-private:
-  /**
-   * @copydoc ResourceThreadBase::Load
-   */
-  virtual void Load(const Integration::ResourceRequest& request);
-
-  /**
-   * @copydoc ResourceThreadBase::Download
-   */
-  virtual void Download(const Integration::ResourceRequest& request);
-
-  /**
-   * @copydoc ResourceThreadBase::Decode
-   */
-  virtual void Decode(const Integration::ResourceRequest& request);
-
-  /**
-   * Download a requested image into a memory buffer.
-   * @param[in] request  The requested resource/file url and attributes
-   * @param[out] dataBuffer  A memory buffer object to be written with downloaded image data.
-   * @param[out] dataSize  The size of the memory buffer.
-   */
-  bool DownloadRemoteImageIntoMemory(const Integration::ResourceRequest& request, Dali::Vector<uint8_t>& dataBuffer, size_t& dataSize);
-
-  /**
-   * Load a requested image from a local file.
-   * @param[in] request  The requested resource/file url and attributes
-   */
-  void LoadImageFromLocalFile(const Integration::ResourceRequest& request);
-
-  /**
-   * Decode a requested image from a memory buffer.
-   * @param[in] blobBytes  A pointer to the memory buffer containig the requested image data.
-   * @param[in] blobSize  The size of the memory buffer containing the requested image data.
-   * @param[in] request  The requested resource/file url and attributes
-   */
-  void DecodeImageFromMemory(void* blobBytes, size_t blobSize, const Integration::ResourceRequest& request);
-}; // class ResourceThreadImage
-
-} // namespace TizenPlatform
-
-} // namespace Dali
-
-#endif // __DALI_TIZEN_PLATFORM_RESOURCE_THREAD_IMAGE_H__
index 338f5da2a6e7a261b411a30c32070687e7eb338c..0ca22e4ddcf6edd75bc786c3db2568c1f240b27a 100644 (file)
@@ -54,22 +54,6 @@ TizenPlatformAbstraction::~TizenPlatformAbstraction()
   delete mResourceLoader;
 }
 
-void TizenPlatformAbstraction::Suspend()
-{
-  if (mResourceLoader)
-  {
-    mResourceLoader->Pause();
-  }
-}
-
-void TizenPlatformAbstraction::Resume()
-{
-  if (mResourceLoader)
-  {
-    mResourceLoader->Resume();
-  }
-}
-
 int TizenPlatformAbstraction::GetDefaultFontSize() const
 {
   int fontSize( -1 );
@@ -99,14 +83,6 @@ ImageDimensions TizenPlatformAbstraction::GetClosestImageSize( Integration::Reso
   return ImageLoader::GetClosestImageSize( resourceBuffer, size, fittingMode, samplingMode, orientationCorrection );
 }
 
-void TizenPlatformAbstraction::LoadResource(const Integration::ResourceRequest& request)
-{
-  if (mResourceLoader)
-  {
-    mResourceLoader->LoadResource(request);
-  }
-}
-
 Integration::ResourcePointer TizenPlatformAbstraction::LoadResourceSynchronously(const Integration::ResourceType& resourceType, const std::string& resourcePath)
 {
   return ImageLoader::LoadResourceSynchronously( resourceType, resourcePath );
@@ -131,51 +107,6 @@ Integration::BitmapPtr TizenPlatformAbstraction::DecodeBuffer( const Integration
   return bitmap;
 }
 
-void TizenPlatformAbstraction::CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId)
-{
-  if (mResourceLoader)
-  {
-    mResourceLoader->CancelLoad(id, typeId);
-  }
-}
-
-void TizenPlatformAbstraction::GetResources(Integration::ResourceCache& cache)
-{
-  if (mResourceLoader)
-  {
-    mResourceLoader->GetResources(cache);
-  }
-}
-
-bool TizenPlatformAbstraction::LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const
-{
-  bool result = false;
-
-  if( mResourceLoader )
-  {
-    result = mResourceLoader->LoadFile( filename, buffer );
-  }
-
-  return result;
-}
-
-std::string TizenPlatformAbstraction::LoadFile( const std::string& filename )
-{
-  std::string result;
-  if (mResourceLoader)
-  {
-    result = mResourceLoader->LoadFile(filename);
-  }
-
-  return result;
-}
-
-void TizenPlatformAbstraction::JoinLoaderThreads()
-{
-  delete mResourceLoader;
-  mResourceLoader = NULL;
-}
-
 bool TizenPlatformAbstraction::LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const
 {
   bool result = false;
index 949c77fdccf56534d495f2bce567cbd8d899677b..3e619667b422cf18ec4adf749e11c4215f897641 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 #include <dali/integration-api/platform-abstraction.h>
-#include <dali/integration-api/resource-cache.h>
 #include <dali/public-api/common/dali-common.h>
 
 #include <string>
@@ -57,16 +56,6 @@ public: // Construction & Destruction
 
 public: // PlatformAbstraction overrides
 
-  /**
-   * @copydoc PlatformAbstraction::Suspend()
-   */
-  virtual void Suspend();
-
-  /**
-   * @copydoc PlatformAbstraction::Resume()
-   */
-  virtual void Resume();
-
   /**
    * @copydoc PlatformAbstraction::GetClosestImageSize()
    */
@@ -85,11 +74,6 @@ public: // PlatformAbstraction overrides
                                                SamplingMode::Type samplingMode,
                                                bool orientationCorrection );
 
-  /**
-   * @copydoc PlatformAbstraction::LoadResource()
-   */
-  virtual void LoadResource(const Integration::ResourceRequest& request);
-
   /**
    * @copydoc PlatformAbstraction::LoadResourceSynchronously()
    */
@@ -100,36 +84,11 @@ public: // PlatformAbstraction overrides
    */
   virtual Integration::BitmapPtr DecodeBuffer( const Integration::ResourceType& resourceType, uint8_t * buffer, size_t size );
 
-  /**
-   * @copydoc PlatformAbstraction::CancelLoad()
-   */
-  virtual void CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId);
-
-  /**
-   * @copydoc PlatformAbstraction::GetResources()
-   */
-  virtual void GetResources(Integration::ResourceCache& cache);
-
-  /**
-   * @copydoc PlatformAbstraction::JoinLoaderThreads()
-   */
-  virtual void JoinLoaderThreads();
-
   /**
    * @copydoc PlatformAbstraction::GetDefaultFontSize()
    */
   virtual int GetDefaultFontSize() const;
 
-  /**
-   * @copydoc PlatformAbstraction::LoadFile()
-   */
-  virtual bool LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
-
-  /**
-   * @copydoc PlatformAbstraction::LoadFile()
-   */
-  virtual std::string LoadFile( const std::string& filename );
-
   /**
    * @copydoc PlatformAbstraction::LoadShaderBinaryFile()
    */
index cc00057103ce668a4d5d8b71536f207b10d649c9..3006d4770fd167e07d6a2e5bffaf3e06ae538ba0 100644 (file)
@@ -75,6 +75,11 @@ void FontClient::GetDpi( unsigned int& horizontalDpi, unsigned int& verticalDpi
   GetImplementation(*this).GetDpi( horizontalDpi, verticalDpi );
 }
 
+int FontClient::GetDefaultFontSize()
+{
+  return GetImplementation(*this).GetDefaultFontSize();
+}
+
 void FontClient::ResetSystemDefaults()
 {
   GetImplementation(*this).ResetSystemDefaults();
index 4fa85cadb2f216744c25b1750bd6b4c275c72b1f..8b0164e43e2c30428d2eef7bad728eeeed9d7636 100644 (file)
@@ -145,6 +145,15 @@ public:
    */
   void GetDpi( unsigned int& horizontalDpi, unsigned int& verticalDpi );
 
+  /**
+   * @brief Called by Dali to retrieve the default font size for the platform.
+   *
+   * This is an accessibility size, which is mapped to a UI Control specific point-size in stylesheets.
+   * For example if zero the smallest size, this could potentially map to TextLabel point-size 8.
+   * @return The default font size.
+   */
+  int GetDefaultFontSize();
+
   /**
    * @brief Called when the user changes the system defaults.
    *
index 833dfdc1139bf5cdcf02ca7d08c40adda282b989..b850b7f7e5f2048841bd0f4ebfe139a7653909c8 100644 (file)
 // CLASS HEADER
 #include <dali/internal/text-abstraction/font-client-impl.h>
 
+// EXTERNAL INCLUDES
+#ifndef DALI_PROFILE_UBUNTU
+#include <vconf.h>
+#endif
+
 // INTERNAL INCLUDES
 #include <singleton-service.h>
 #include <dali/internal/text-abstraction/font-client-plugin-impl.h>
@@ -86,6 +91,17 @@ void FontClient::GetDpi( unsigned int& horizontalDpi, unsigned int& verticalDpi
   verticalDpi = mDpiVertical;
 }
 
+int FontClient::GetDefaultFontSize()
+{
+  int fontSize( -1 );
+
+#ifndef DALI_PROFILE_UBUNTU
+  vconf_get_int( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &fontSize );
+#endif // DALI_PROFILE_UBUNTU
+
+  return fontSize;
+}
+
 void FontClient::ResetSystemDefaults()
 {
   CreatePlugin();
index f5afa982f5831b9044c2ad00daabe9eb541f6e33..32225260f19a885d33c04d2c3465b3baf3257134 100644 (file)
@@ -65,6 +65,11 @@ public:
    */
   void GetDpi( unsigned int& horizontalDpi, unsigned int& verticalDpi );
 
+  /**
+   * @copydoc Dali::TextAbstraction::FontClient::GetDefaultFontSize()
+   */
+  int GetDefaultFontSize();
+
   /**
    * @copydoc Dali::TextAbstraction::FontClient::ResetSystemDefaults()
    */