2 * Copyright (c) 2015 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 "framework.h"
25 #include <dali/integration-api/debug.h>
28 #include <callback-manager.h>
41 * Impl to hide LibUV data members
43 struct Framework::Impl
48 : mAbortCallBack( NULL ),
49 mCallbackManager( NULL )
51 mCallbackManager = CallbackManager::New();
52 mMainLoop = new uv_loop_t;
53 uv_loop_init( mMainLoop );
59 delete mAbortCallBack;
61 // we're quiting the main loop so
62 // mCallbackManager->RemoveAllCallBacks() does not need to be called
63 // to delete our abort handler
64 delete mCallbackManager;
71 uv_run( mMainLoop , UV_RUN_DEFAULT);
73 uv_loop_close( mMainLoop );
84 CallbackBase* mAbortCallBack;
85 CallbackManager *mCallbackManager;
91 Impl( const Impl& impl );
94 Impl& operator=( const Impl& impl );
97 Framework::Framework( Framework::Observer& observer, int *argc, char ***argv, Type type )
98 : mObserver(observer),
105 mAbortHandler( MakeCallback( this, &Framework::AbortCallback ) ),
109 mImpl = new Impl(this);
112 Framework::~Framework()
122 void Framework::Run()
132 void Framework::Quit()
137 bool Framework::IsMainLoopRunning()
142 void Framework::AddAbortCallback( CallbackBase* callback )
144 mImpl->mAbortCallBack = callback;
147 std::string Framework::GetBundleName() const
152 void Framework::SetBundleName(const std::string& name)
156 std::string Framework::GetBundleId() const
161 std::string Framework::GetResourcePath()
163 // TIZEN_PLATFORM_CONFIG_SUPPORTED not defined for libuv so path not available.
167 void Framework::SetBundleId(const std::string& id)
171 void Framework::AbortCallback( )
173 // if an abort call back has been installed run it.
174 if (mImpl->mAbortCallBack)
176 CallbackBase::Execute( *mImpl->mAbortCallBack );
184 bool Framework::AppStatusHandler(int type, void *bundleData)
189 } // namespace Adaptor
191 } // namespace Internal