2 * Copyright (c) 2017 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 ShaderFactory& ThreadLocalStorage::GetShaderFactory()
88 return mCore->GetShaderFactory();
91 StagePtr ThreadLocalStorage::GetCurrentStage()
93 return mCore->GetCurrentStage();
96 GestureEventProcessor& ThreadLocalStorage::GetGestureEventProcessor()
98 return mCore->GetGestureEventProcessor();
101 RelayoutController& ThreadLocalStorage::GetRelayoutController()
103 return mCore->GetRelayoutController();
106 } // namespace Internal