Dali 3D User Interface Engine
resource-thread-base.h
Go to the documentation of this file.
1 #ifndef __DALI_TIZEN_PLATFORM_RESOURCE_THREAD_BASE_H__
2 #define __DALI_TIZEN_PLATFORM_RESOURCE_THREAD_BASE_H__
3 
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20 
21 // EXTERNAL INCLUDES
22 #include <deque>
24 
25 // INTERNAL INCLUDES
26 #include "resource-loader.h"
28 
29 namespace Dali
30 {
31 
32 namespace TizenPlatform
33 {
34 
39 {
40 public:
41  // typedefs and enums
42 
46  {
53  };
54 
55  typedef std::pair<Integration::ResourceRequest, RequestType> RequestInfo;
56  typedef std::deque<RequestInfo> RequestQueue;
57  typedef RequestQueue::iterator RequestQueueIter;
58 
59 public:
60  // Constructor
61  ResourceThreadBase(ResourceLoader& resourceLoader);
62 
63  // Destructor
64  virtual ~ResourceThreadBase();
65 
66 protected:
67  void TerminateThread();
68 
69 public:
75  void AddRequest(const Integration::ResourceRequest& request, const RequestType type);
76 
81  void CancelRequest(Integration::ResourceId resourceId);
82 
86  void Pause();
87 
91  void Resume();
92 
93 
94 protected:
99  void ThreadLoop();
100 
104  void WaitForRequests();
105 
109  void ProcessNextRequest();
110 
114  void InstallLogging();
115 
119  void UninstallLogging();
120 
125  virtual void Load(const Integration::ResourceRequest& request) = 0;
126 
131  virtual void Download(const Integration::ResourceRequest& request);
132 
138  virtual void Decode(const Integration::ResourceRequest& request);
139 
145  virtual void InterruptionPoint() const;
146 
147 private:
152  static void* InternalThreadEntryFunc( void* This );
153 
154 protected:
156  pthread_t mThread;
159 private:
162  bool mPaused;
163 
164 private:
165 
166  // Undefined
167  ResourceThreadBase( const ResourceThreadBase& resourceThreadBase );
168 
169  // Undefined
170  ResourceThreadBase& operator=( const ResourceThreadBase& resourceThreadBase );
171 
172 #if defined(DEBUG_ENABLED)
173 public:
174  Integration::Log::Filter* mLogFilter;
175 #endif
176 }; // class ResourceThreadBase
177 
178 } // namespace TizenPlatform
179 
180 } // namespace Dali
181 
182 #endif // __DALI_TIZEN_PLATFORM_RESOURCE_THREAD_BASE_H__
Dali Docs Home
Read more about Dali