2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/event/common/thread-local-storage.h>
22 #include <dali/internal/common/core-impl.h>
23 #include <dali/public-api/common/dali-common.h>
33 __thread ThreadLocalStorage* threadLocal = NULL;
36 ThreadLocalStorage::ThreadLocalStorage(Core* core)
39 DALI_ASSERT_ALWAYS( threadLocal == NULL && "Cannot create more than one ThreadLocalStorage object" );
41 // reset is used to store a new value associated with this thread
45 ThreadLocalStorage::~ThreadLocalStorage()
49 void ThreadLocalStorage::Remove()
54 ThreadLocalStorage& ThreadLocalStorage::Get()
56 DALI_ASSERT_ALWAYS(threadLocal);
61 bool ThreadLocalStorage::Created()
63 // see if the TLS has been set yet
64 return (threadLocal != NULL);
67 ThreadLocalStorage* ThreadLocalStorage::GetInternal()
72 Dali::Integration::PlatformAbstraction& ThreadLocalStorage::GetPlatformAbstraction()
74 return mCore->GetPlatform();
77 SceneGraph::UpdateManager& ThreadLocalStorage::GetUpdateManager()
79 return mCore->GetUpdateManager();
82 NotificationManager& ThreadLocalStorage::GetNotificationManager()
84 return mCore->GetNotificationManager();
87 ResourceManager& ThreadLocalStorage::GetResourceManager()
89 return mCore->GetResourceManager();
92 ResourceClient& ThreadLocalStorage::GetResourceClient()
94 return mCore->GetResourceClient();
97 ImageFactory& ThreadLocalStorage::GetImageFactory()
99 return mCore->GetImageFactory();
102 ModelFactory& ThreadLocalStorage::GetModelFactory()
104 return mCore->GetModelFactory();
107 FontFactory& ThreadLocalStorage::GetFontFactory()
109 return mCore->GetFontFactory();
112 ShaderFactory& ThreadLocalStorage::GetShaderFactory()
114 return mCore->GetShaderFactory();
117 StagePtr ThreadLocalStorage::GetCurrentStage()
119 return mCore->GetCurrentStage();
122 EventToUpdate& ThreadLocalStorage::GetEventToUpdate()
124 return GetUpdateManager().GetEventToUpdate();
127 GestureEventProcessor& ThreadLocalStorage::GetGestureEventProcessor()
129 return mCore->GetGestureEventProcessor();
132 EmojiFactory& ThreadLocalStorage::GetEmojiFactory()
134 return mCore->GetEmojiFactory();
137 } // namespace Internal