From 770372b0e04c8feede67bfd63e7833a760ee8dfa Mon Sep 17 00:00:00 2001 From: Francisco Santos Date: Tue, 28 Feb 2017 14:15:46 +0000 Subject: [PATCH] Remove unused files. Change-Id: Ic9d291aae2563ad626c6055edc132a240401c3e5 --- platform-abstractions/tizen/file.list | 2 - .../resource-loader/resource-bitmap-requester.cpp | 54 ------- .../resource-loader/resource-bitmap-requester.h | 51 ------ .../tizen/resource-loader/resource-loader.cpp | 177 --------------------- .../tizen/resource-loader/resource-loader.h | 34 ---- .../resource-loader/resource-requester-base.cpp | 35 ---- .../resource-loader/resource-requester-base.h | 69 -------- 7 files changed, 422 deletions(-) delete mode 100644 platform-abstractions/tizen/resource-loader/resource-bitmap-requester.cpp delete mode 100644 platform-abstractions/tizen/resource-loader/resource-bitmap-requester.h delete mode 100644 platform-abstractions/tizen/resource-loader/resource-requester-base.cpp delete mode 100644 platform-abstractions/tizen/resource-loader/resource-requester-base.h diff --git a/platform-abstractions/tizen/file.list b/platform-abstractions/tizen/file.list index 5bb1e1a..fab51bc 100755 --- a/platform-abstractions/tizen/file.list +++ b/platform-abstractions/tizen/file.list @@ -5,8 +5,6 @@ tizen_platform_abstraction_src_files = \ $(tizen_platform_abstraction_src_dir)/tizen-logging.cpp \ \ $(tizen_platform_abstraction_src_dir)/resource-loader/resource-loader.cpp \ - $(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/network/file-download.cpp \ $(tizen_platform_abstraction_src_dir)/resource-loader/network/http-utils.cpp \ diff --git a/platform-abstractions/tizen/resource-loader/resource-bitmap-requester.cpp b/platform-abstractions/tizen/resource-loader/resource-bitmap-requester.cpp deleted file mode 100644 index ab3e320..0000000 --- a/platform-abstractions/tizen/resource-loader/resource-bitmap-requester.cpp +++ /dev/null @@ -1,54 +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. - * - */ - -// CLASS HEADER -#include "resource-bitmap-requester.h" - -// EXTERNAL INCLUDES - -// INTERNAL INCLUDES -#include "network/file-download.h" -#include "network/http-utils.h" - -using namespace Dali::Integration; - -namespace Dali -{ -namespace TizenPlatform -{ -namespace -{ -enum ResourceScheme -{ - FILE_SYSTEM_RESOURCE, - NETWORK_RESOURCE -}; -}// unnamed namespace - -ResourceBitmapRequester::ResourceBitmapRequester( ResourceLoader& resourceLoader ) -: ResourceRequesterBase( resourceLoader ) -{ -} - -ResourceBitmapRequester::~ResourceBitmapRequester() -{ -} - - - -} // TizenPlatform -} // Dali diff --git a/platform-abstractions/tizen/resource-loader/resource-bitmap-requester.h b/platform-abstractions/tizen/resource-loader/resource-bitmap-requester.h deleted file mode 100644 index 71f87ed..0000000 --- a/platform-abstractions/tizen/resource-loader/resource-bitmap-requester.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef __DALI_TIZEN_PLATFORM_RESOURCE_BITMAP_REQUESTER_H__ -#define __DALI_TIZEN_PLATFORM_RESOURCE_BITMAP_REQUESTER_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 "resource-requester-base.h" - -namespace Dali -{ -namespace TizenPlatform -{ - -/** - * Class to own request threads and manage resource requests for bitmaps - */ -class ResourceBitmapRequester : public ResourceRequesterBase -{ -public: - /** - * Constructor - * @param[in] resourceLoader The resource loader with which to communicate results - */ - ResourceBitmapRequester( ResourceLoader& resourceLoader ); - - /** - * Destructor - */ - virtual ~ResourceBitmapRequester(); - -private: -}; - -} // TizenPlatform -} // Dali - -#endif // __DALI_TIZEN_PLATFORM_RESOURCE_BITMAP_REQUESTER_H__ diff --git a/platform-abstractions/tizen/resource-loader/resource-loader.cpp b/platform-abstractions/tizen/resource-loader/resource-loader.cpp index c9ad3cc..38222b8 100755 --- a/platform-abstractions/tizen/resource-loader/resource-loader.cpp +++ b/platform-abstractions/tizen/resource-loader/resource-loader.cpp @@ -32,8 +32,6 @@ #include #include #include -#include "resource-requester-base.h" -#include "resource-bitmap-requester.h" #include "debug/resource-loader-debug.h" using namespace Dali::Integration; @@ -44,190 +42,15 @@ namespace Dali namespace TizenPlatform { -struct ResourceLoader::ResourceLoaderImpl -{ - typedef std::queue LoadedQueue; - typedef std::queue FailedQueue; - - typedef std::pair RequestHandlerPair; - typedef std::map RequestHandlers; - typedef RequestHandlers::iterator RequestHandlersIter; - - Dali::Mutex mQueueMutex; ///< used to synchronize access to mLoadedQueue and mFailedQueue - LoadedQueue mLoadedQueue; ///< Completed load requests notifications are stored here until fetched by core - FailedQueue mFailedLoads; ///< Failed load request notifications are stored here until fetched by core - - RequestHandlers mRequestHandlers; - - ResourceLoaderImpl( ResourceLoader* loader ) - { - mRequestHandlers.insert(std::make_pair(ResourceBitmap, new ResourceBitmapRequester(*loader))); - } - - ~ResourceLoaderImpl() - { - // Delete resource handlers - for( RequestHandlersIter it = mRequestHandlers.begin(); it != mRequestHandlers.end(); ++it ) - { - ResourceRequesterBase* requestBase = it->second; - delete requestBase; - } - } - - ResourceRequesterBase* GetRequester(ResourceTypeId typeId) - { - ResourceRequesterBase* requestHandler = NULL; - RequestHandlersIter iter = mRequestHandlers.find(typeId); - if(iter != mRequestHandlers.end()) - { - requestHandler = iter->second; - } - DALI_ASSERT_DEBUG(requestHandler && "All resource types should have a requester defined for them."); - return requestHandler; - } - - void AddLoadedResource(LoadedResource& resource) - { - // Lock the LoadedQueue to store the loaded resource - Mutex::ScopedLock lock( mQueueMutex ); - - mLoadedQueue.push( resource ); - } - - void AddFailedLoad(FailedResource& resource) - { - // Lock the FailedQueue to store the failed resource information - Mutex::ScopedLock lock( mQueueMutex ); - - mFailedLoads.push(resource); - } - - -private: - - ResourceLoaderImpl( const ResourceLoaderImpl& ); ///< Undefined - ResourceLoaderImpl& operator=( const ResourceLoaderImpl& ); ///< Undefined -}; - /********************************************************************************/ /**************************** RESOURCE LOADER METHODS ************************/ /********************************************************************************/ ResourceLoader::ResourceLoader() -: mTerminateThread(0) { - mImpl = new ResourceLoaderImpl( this ); } ResourceLoader::~ResourceLoader() { - // Flag that the ResourceLoader is exiting - (void)__sync_or_and_fetch( &mTerminateThread, -1 ); - - delete mImpl; -} - -bool ResourceLoader::IsTerminating() -{ - return __sync_fetch_and_or( &mTerminateThread, 0 ); -} - -/********************************************************************************/ -/************************** CALLED FROM LOADER THREADS **********************/ -/********************************************************************************/ - -void ResourceLoader::AddLoadedResource(LoadedResource& resource) -{ - mImpl->AddLoadedResource( resource ); -} - -void ResourceLoader::AddFailedLoad(FailedResource& resource) -{ - mImpl->AddFailedLoad( resource ); -} - -/********************************************************************************/ -/********************* CALLED FROM PLATFORM ABSTRACTION **********************/ -/********************************************************************************/ - - -bool ResourceLoader::LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const -{ - Dali::Vector daliVec; - const bool result = LoadFile( filename, daliVec ); - buffer.resize( daliVec.Size() ); - memcpy( &buffer[0], &daliVec[0], daliVec.Size() ); - return result; -} - -bool ResourceLoader::LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const -{ - DALI_LOG_TRACE_METHOD(gLoaderFilter); - - DALI_ASSERT_DEBUG( 0 != filename.length()); - - bool result; - - std::filebuf buf; - buf.open(filename.c_str(), std::ios::in | std::ios::binary); - if( buf.is_open() ) - { - std::istream stream(&buf); - - // determine data length - stream.seekg(0, std::ios_base::end); - unsigned int length = static_cast( stream.tellg() ); - stream.seekg(0, std::ios_base::beg); - - // allocate a buffer - buffer.Resize(length); - // read data into buffer - stream.read(reinterpret_cast(buffer.Begin()), length); - - DALI_LOG_INFO(gLoaderFilter, Debug::Verbose, "ResourceLoader::LoadFile(%s) - loaded %d bytes\n", filename.c_str(), length); - - result = true; - } - else - { - DALI_LOG_INFO(gLoaderFilter, Debug::Verbose, "ResourceLoader::LoadFile(%s) - failed to load\n", filename.c_str()); - result = false; - } - - return result; -} - -std::string ResourceLoader::LoadFile(const std::string& filename) const -{ - DALI_LOG_TRACE_METHOD(gLoaderFilter); - - DALI_ASSERT_DEBUG( 0 != filename.length()); - - std::string contents; - - std::filebuf buf; - buf.open(filename.c_str(), std::ios::in); - if( buf.is_open() ) - { - std::istream stream(&buf); - - // determine data length - stream.seekg(0, std::ios_base::end); - unsigned int length = static_cast( stream.tellg() ); - stream.seekg(0, std::ios_base::beg); - - // allocate a buffer - contents.resize(length); - // read data into buffer - stream.read(&contents[0], length); - - DALI_LOG_INFO(gLoaderFilter, Debug::Verbose, "ResourceLoader::LoadFile(%s) - loaded %d bytes\n", filename.c_str(), length); - } - else - { - DALI_LOG_INFO(gLoaderFilter, Debug::Verbose, "ResourceLoader::LoadFile(%s) - failed to load\n", filename.c_str()); - } - - return contents; } bool ResourceLoader::SaveFile(const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) diff --git a/platform-abstractions/tizen/resource-loader/resource-loader.h b/platform-abstractions/tizen/resource-loader/resource-loader.h index 41b28be..c595539 100644 --- a/platform-abstractions/tizen/resource-loader/resource-loader.h +++ b/platform-abstractions/tizen/resource-loader/resource-loader.h @@ -111,44 +111,14 @@ public: */ ~ResourceLoader(); - /** - * Check if the ResourceLoader is terminating - * @return true if terminating else false - */ - bool IsTerminating(); - - /** - * Add a completely loaded resource to the LoadedResource queue - * @param[in] resource The resource's information and data - */ - void AddLoadedResource(LoadedResource& resource); - - /** - * Add information about a failed resource load to the FailedLoads queue - * @param[in] resource The failed resource's information - */ - void AddFailedLoad(FailedResource& resource); - // From PlatformAbstraction /** - * @copydoc SlpPlatformAbstraction::LoadFile() - */ - bool LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const; - bool LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const; - - /** - * @copydoc TizenPlatformAbstraction::LoadFile() - */ - std::string LoadFile(const std::string& filename) const; - - /** * @copydoc TizenPlatformAbstraction::SaveFile() */ static bool SaveFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ); private: - // Undefined ResourceLoader( const ResourceLoader& resourceLoader ); @@ -156,10 +126,6 @@ private: ResourceLoader& operator=( const ResourceLoader& resourceLoader ); private: - struct ResourceLoaderImpl; - ResourceLoaderImpl* mImpl; - - volatile int mTerminateThread; ///< Set to <> 0 in destructor, signals threads to exit their controlling loops }; diff --git a/platform-abstractions/tizen/resource-loader/resource-requester-base.cpp b/platform-abstractions/tizen/resource-loader/resource-requester-base.cpp deleted file mode 100644 index 8714d76..0000000 --- a/platform-abstractions/tizen/resource-loader/resource-requester-base.cpp +++ /dev/null @@ -1,35 +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-requester-base.h" - -namespace Dali -{ -namespace TizenPlatform -{ - -ResourceRequesterBase::ResourceRequesterBase( ResourceLoader& resourceLoader ) -: mResourceLoader(resourceLoader) -{ -} - -ResourceRequesterBase::~ResourceRequesterBase() -{ -} - -} // Namespace TizenPlatform -} // Namespace Dali diff --git a/platform-abstractions/tizen/resource-loader/resource-requester-base.h b/platform-abstractions/tizen/resource-loader/resource-requester-base.h deleted file mode 100644 index 713a217..0000000 --- a/platform-abstractions/tizen/resource-loader/resource-requester-base.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __DALI_TIZEN_PLATFORM_RESOURCE_REQUESTER_BASE_H__ -#define __DALI_TIZEN_PLATFORM_RESOURCE_REQUESTER_BASE_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 - -namespace Dali -{ -namespace TizenPlatform -{ - -/** - * Base class to handle resource requests - */ -class ResourceRequesterBase -{ -public: - /** - * Constructor - * @param[in] resourceLoader The resource loader with which to communicate results - */ - ResourceRequesterBase( ResourceLoader& resourceLoader ); - - /** - * Destructor - */ - virtual ~ResourceRequesterBase(); - - -protected: - ResourceLoader& mResourceLoader; ///< The resource loader to which to send results - -private: - /** - * Undefined default constructor - */ - ResourceRequesterBase(); - - /** - * Undefined Copy constructor - */ - ResourceRequesterBase(const ResourceRequesterBase& rhs ); - - /** - * Undefined Assignment operator - */ - ResourceRequesterBase& operator=(const ResourceRequesterBase& rhs ); -}; - -} // TizenPlatform -} // Dali - -#endif // __DALI_TIZEN_PLATFORM_RESOURCE_REQUESTER_BASE_H__ -- 2.7.4