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" );
44 ThreadLocalStorage::~ThreadLocalStorage()
48 void ThreadLocalStorage::Remove()
53 ThreadLocalStorage& ThreadLocalStorage::Get()
55 DALI_ASSERT_ALWAYS(threadLocal);
60 bool ThreadLocalStorage::Created()
62 // see if the TLS has been set yet
63 return (threadLocal != NULL);
66 ThreadLocalStorage* ThreadLocalStorage::GetInternal()
71 Dali::Integration::PlatformAbstraction& ThreadLocalStorage::GetPlatformAbstraction()
73 return mCore->GetPlatform();
76 SceneGraph::UpdateManager& ThreadLocalStorage::GetUpdateManager()
78 return mCore->GetUpdateManager();
81 NotificationManager& ThreadLocalStorage::GetNotificationManager()
83 return mCore->GetNotificationManager();
86 ResourceManager& ThreadLocalStorage::GetResourceManager()
88 return mCore->GetResourceManager();
91 ResourceClient& ThreadLocalStorage::GetResourceClient()
93 return mCore->GetResourceClient();
96 ImageFactory& ThreadLocalStorage::GetImageFactory()
98 return mCore->GetImageFactory();
101 ShaderFactory& ThreadLocalStorage::GetShaderFactory()
103 return mCore->GetShaderFactory();
106 StagePtr ThreadLocalStorage::GetCurrentStage()
108 return mCore->GetCurrentStage();
111 GestureEventProcessor& ThreadLocalStorage::GetGestureEventProcessor()
113 return mCore->GetGestureEventProcessor();
116 RelayoutController& ThreadLocalStorage::GetRelayoutController()
118 return mCore->GetRelayoutController();
121 } // namespace Internal