diff options
Diffstat (limited to 'src/components/application_manager/include/application_manager/app_launch')
8 files changed, 44 insertions, 10 deletions
diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl.h index 9fc85db38c..a10963ad82 100644 --- a/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl.h +++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl.h @@ -33,11 +33,11 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_APP_LAUNCH_CTRL_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_APP_LAUNCH_CTRL_H_ #include <string> -#include "utils/shared_ptr.h" +#include <memory> namespace application_manager { class Application; -typedef utils::SharedPtr<const Application> ApplicationConstSharedPtr; +typedef std::shared_ptr<const Application> ApplicationConstSharedPtr; } // namespace application_manager namespace app_launch { diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl_impl.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl_impl.h index 1f508eebe5..61f3480f77 100644 --- a/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl_impl.h +++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl_impl.h @@ -49,7 +49,7 @@ class ResumeCtrl; namespace app_launch { // TODO(AK) Use unique pointer -typedef utils::SharedPtr<timer::Timer> TimerPtr; +typedef std::shared_ptr<timer::Timer> TimerPtr; class MultipleAppsLauncherFactoryImpl; class AppLaunchCtrlImpl : public AppLaunchCtrl { diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_data.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_data.h index 0d52384018..73e9623b62 100644 --- a/src/components/application_manager/include/application_manager/app_launch/app_launch_data.h +++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_data.h @@ -36,7 +36,7 @@ #include <stdint.h> #include <vector> #include <string> -#include "utils/shared_ptr.h" +#include <memory> namespace app_launch { @@ -59,7 +59,7 @@ struct ApplicationData { bundle_id_ == app_data.bundle_id_ && device_mac_ == device_mac_; } }; -typedef utils::SharedPtr<ApplicationData> ApplicationDataPtr; +typedef std::shared_ptr<ApplicationData> ApplicationDataPtr; /** * @brief class contains interfaces to AppLaunchDataDB and AppLaunchDataJson diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_db.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_db.h index 92d6bbd9ef..ccbf4c7c01 100644 --- a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_db.h +++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_db.h @@ -153,7 +153,7 @@ class AppLaunchDataDB : public AppLaunchDataImpl { /** * @brief returns pointer to data base */ - std::auto_ptr<utils::dbms::SQLDatabase> db_; + std::unique_ptr<utils::dbms::SQLDatabase> db_; /** * @brief indicate initializing status of DB diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_impl.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_impl.h index 111ff25ab2..a2b8630bcc 100644 --- a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_impl.h +++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_impl.h @@ -35,6 +35,8 @@ #include "application_manager/app_launch/app_launch_data.h" #include "application_manager/app_launch_settings.h" +#include "utils/macro.h" +#include <memory> namespace app_launch { diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h index 61117e552b..a292b84fc0 100644 --- a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h +++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h @@ -38,6 +38,7 @@ #include "resumption/last_state.h" #include "utils/lock.h" #include "utils/macro.h" +#include <memory> namespace app_launch { @@ -141,7 +142,7 @@ class AppLaunchDataJson : public AppLaunchDataImpl { /** * @brief lock to protected common data */ - mutable sync_primitives::Lock app_launch_json_lock_; + mutable sync_primitives::RecursiveLock app_launch_json_lock_; /** * @brief ponter to Last State object diff --git a/src/components/application_manager/include/application_manager/app_launch/apps_launcher.h b/src/components/application_manager/include/application_manager/app_launch/apps_launcher.h index 751e04bada..6285514be9 100644 --- a/src/components/application_manager/include/application_manager/app_launch/apps_launcher.h +++ b/src/components/application_manager/include/application_manager/app_launch/apps_launcher.h @@ -3,6 +3,7 @@ #include "application_manager/app_launch/app_launch_data.h" #include "connection_handler/connection_handler.h" #include "utils/timer.h" +#include <memory> namespace app_launch { class AppLaunchCtrlImpl; @@ -69,7 +70,7 @@ class AppsLauncher { connection_handler::ConnectionHandler& connection_handler_; AppsLauncher& parent_; }; - typedef utils::SharedPtr<Launcher> LauncherPtr; + typedef std::shared_ptr<Launcher> LauncherPtr; typedef std::vector<LauncherPtr> AppLaunchers; private: diff --git a/src/components/application_manager/include/application_manager/app_launch/device_apps_launcher.h b/src/components/application_manager/include/application_manager/app_launch/device_apps_launcher.h index f1f29471e6..f156654215 100644 --- a/src/components/application_manager/include/application_manager/app_launch/device_apps_launcher.h +++ b/src/components/application_manager/include/application_manager/app_launch/device_apps_launcher.h @@ -10,9 +10,39 @@ namespace app_launch { class AppLaunchCtrlImpl; -class DeviceAppsLauncherImpl; +class DeviceAppsLauncher; class AppsLauncher; class AppLaunchSettings; +class Launcher; +class LauncherGenerator; + +// impl class must be defined for unique_ptr in DeviceAppsLauncher +class DeviceAppsLauncherImpl { + public: + DeviceAppsLauncherImpl(DeviceAppsLauncher& interface, + AppsLauncher& apps_launcher); + + bool LaunchAppsOnDevice( + const std::string& device_mac, + const std::vector<ApplicationDataPtr>& applications_to_launch); + + struct LauncherFinder { + LauncherFinder(const std::string& device_mac) : device_mac_(device_mac) {} + + bool operator()(const std::shared_ptr<Launcher>& launcher) const; + + std::string device_mac_; + }; + + bool StopLaunchingAppsOnDevice(const std::string& device_mac); + + private: + sync_primitives::Lock launchers_lock_; + std::vector<std::shared_ptr<Launcher> > free_launchers_; + std::vector<std::shared_ptr<Launcher> > works_launchers_; + DeviceAppsLauncher& interface_; +}; + /** * @brief The MultipleAppsLauncher struct * should manage launching applications and gaps between launching application @@ -36,7 +66,7 @@ class DeviceAppsLauncher { private: application_manager::ApplicationManager& app_mngr_; const AppLaunchSettings& settings_; - std::auto_ptr<DeviceAppsLauncherImpl> impl_; + std::unique_ptr<DeviceAppsLauncherImpl> impl_; friend class DeviceAppsLauncherImpl; DISALLOW_COPY_AND_ASSIGN(DeviceAppsLauncher); }; |