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 #if defined(EMSCRIPTEN)
34 ThreadLocalStorage* threadLocal = NULL;
36 __thread ThreadLocalStorage* threadLocal = NULL;
40 ThreadLocalStorage::ThreadLocalStorage(Core* core)
43 DALI_ASSERT_ALWAYS( threadLocal == NULL && "Cannot create more than one ThreadLocalStorage object" );
48 ThreadLocalStorage::~ThreadLocalStorage()
52 void ThreadLocalStorage::Remove()
57 ThreadLocalStorage& ThreadLocalStorage::Get()
59 DALI_ASSERT_ALWAYS(threadLocal);
64 bool ThreadLocalStorage::Created()
66 // see if the TLS has been set yet
67 return (threadLocal != NULL);
70 ThreadLocalStorage* ThreadLocalStorage::GetInternal()
75 Dali::Integration::PlatformAbstraction& ThreadLocalStorage::GetPlatformAbstraction()
77 return mCore->GetPlatform();
80 SceneGraph::UpdateManager& ThreadLocalStorage::GetUpdateManager()
82 return mCore->GetUpdateManager();
85 NotificationManager& ThreadLocalStorage::GetNotificationManager()
87 return mCore->GetNotificationManager();
90 ResourceManager& ThreadLocalStorage::GetResourceManager()
92 return mCore->GetResourceManager();
95 ResourceClient& ThreadLocalStorage::GetResourceClient()
97 return mCore->GetResourceClient();
100 ImageFactory& ThreadLocalStorage::GetImageFactory()
102 return mCore->GetImageFactory();
105 ShaderFactory& ThreadLocalStorage::GetShaderFactory()
107 return mCore->GetShaderFactory();
110 StagePtr ThreadLocalStorage::GetCurrentStage()
112 return mCore->GetCurrentStage();
115 GestureEventProcessor& ThreadLocalStorage::GetGestureEventProcessor()
117 return mCore->GetGestureEventProcessor();
120 RelayoutController& ThreadLocalStorage::GetRelayoutController()
122 return mCore->GetRelayoutController();
125 } // namespace Internal