Remove slave async launch feature. 45/39145/1
authorSung-jae Park <nicesj.park@samsung.com>
Fri, 8 May 2015 09:09:15 +0000 (18:09 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Fri, 8 May 2015 09:09:15 +0000 (18:09 +0900)
[model] Redwood,Kiran,B3(Wearable)
[binary_type] AP
[customer] Docomo/Orange/ATT/Open
[issue#] N/A
[problem]
[cause]
[solution]
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: If3dcd9738573290a4fd21e0a694114610525fdeb

include/instance.h
include/slave_life.h
src/instance.c
src/package.c
src/server.c
src/slave_life.c

index f8e7f7b..81a111e 100644 (file)
@@ -269,7 +269,6 @@ extern void instance_reload_period(struct inst_info *inst, double period);
  * For the hello_sync or prepare_hello_sync command
  */
 extern struct packet *instance_duplicate_packet_create(const struct packet *packet, struct inst_info *inst, struct pkg_info *info, int width, int height);
-extern struct packet *instance_watch_create(const struct packet *packet, const char *pkgname, int width, int height);
 
 extern void instance_set_orientation(struct inst_info *inst, int orientation);
 extern int instance_orientation(struct inst_info *inst);
index a2fce01..4684d8d 100644 (file)
@@ -96,7 +96,7 @@ extern const int const slave_refcnt(struct slave_node *slave);
  * \param[in] period
  * \return slave_node
  */
-extern struct slave_node *slave_create(const char *name, int is_secured, const char *abi, const char *pkgname, int network, const char *hw_acceleration, int launch_async);
+extern struct slave_node *slave_create(const char *name, int is_secured, const char *abi, const char *pkgname, int network, const char *hw_acceleration);
 
 /*!
  * \brief
index 387485c..0720682 100644 (file)
@@ -1097,112 +1097,6 @@ HAPI struct packet *instance_duplicate_packet_create(const struct packet *packet
        return result;
 }
 
-HAPI struct packet *instance_watch_create(const struct packet *packet, const char *pkgname, int width, int height)
-{
-       struct inst_info *inst;
-       struct packet *result;
-
-       inst = calloc(1, sizeof(*inst));
-       if (!inst) {
-               ErrPrint("calloc: %d\n", errno);
-               return NULL;
-       }
-
-       /**
-        * @note
-        * This timestamp will not be used by viewer.
-        * So we can set it manually from here.
-        */
-       inst->timestamp = util_timestamp();
-       inst->widget.width = width;
-       inst->widget.height = height;
-
-       if (fork_package(inst, pkgname) < 0) {
-               DbgFree(inst);
-               return NULL;
-       }
-
-       if (WIDGET_CONF_EXTRA_BUFFER_COUNT) {
-               inst->widget.extra_buffer = calloc(WIDGET_CONF_EXTRA_BUFFER_COUNT, sizeof(*inst->widget.extra_buffer));
-               if (!inst->widget.extra_buffer) {
-                       ErrPrint("Failed to allocate buffer for widget extra buffer\n");
-               }
-
-               inst->gbar.extra_buffer = calloc(WIDGET_CONF_EXTRA_BUFFER_COUNT, sizeof(*inst->gbar.extra_buffer));
-               if (!inst->gbar.extra_buffer) {
-                       ErrPrint("Failed to allocate buffer for gbar extra buffer\n");
-               }
-       }
-
-       /**
-        * We don't need to set the state of this instance from here.
-        * But, in case of fail to add a new instance to package information(inst->info) data,
-        * the "instance_destroy" will be invoked.
-        * it will try to get the state of an instance.
-        */
-       inst->state = INST_INIT;
-       inst->requested_state = INST_INIT;
-       instance_ref(inst);
-
-       /**
-        * @note
-        * We already create a slave object from caller.
-        * This will finds it and map it to package information object
-        */
-       if (package_add_instance(inst->info, inst) < 0) {
-               ErrPrint("Failed to package_add_instance\n");
-               unfork_package(inst);
-               DbgFree(inst->widget.extra_buffer);
-               DbgFree(inst->gbar.extra_buffer);
-               DbgFree(inst);
-               return NULL;
-       }
-
-       /**
-        * Before activate an instance, update its id first for client
-       instance_send_update_id(inst);
-        */
-       DbgPrint("[TODO] send_update_id\n");
-
-       result = packet_create_reply(packet, "sssiidssisiis",
-                       package_name(inst->info),
-                       inst->id,
-                       inst->content,
-                       package_timeout(inst->info),
-                       !!package_widget_path(inst->info),
-                       inst->widget.period,
-                       inst->cluster,
-                       inst->category,
-                       !!inst->client,
-                       package_abi(inst->info),
-                       inst->widget.width,
-                       inst->widget.height,
-                       client_direct_addr(inst->client));
-
-       if (!result) {
-               ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
-               package_del_instance(inst->info, inst); /* This will reset the inst->info->slave */
-               unfork_package(inst);
-               DbgFree(inst->widget.extra_buffer);
-               DbgFree(inst->gbar.extra_buffer);
-               DbgFree(inst);
-               return NULL;
-       }
-
-       slave_load_instance(package_slave(inst->info));
-
-       inst->requested_state = INST_ACTIVATED;
-       inst->state = INST_ACTIVATED;
-
-       inst->visible = WIDGET_HIDE_WITH_PAUSE;
-
-       instance_create_widget_buffer(inst, WIDGET_CONF_DEFAULT_PIXELS);
-       instance_broadcast_created_event(inst);
-       instance_thaw_updator(inst);
-
-       return result;
-}
-
 HAPI struct inst_info *instance_ref(struct inst_info *inst)
 {
        if (!inst) {
index 0481175..e87c312 100644 (file)
@@ -1150,7 +1150,6 @@ HAPI const char *package_category(struct pkg_info *info)
 static inline int assign_new_slave(const char *slave_pkgname, struct pkg_info *info)
 {
        char *s_name;
-       int launch_async = 0;
 
        s_name = util_slavename();
        if (!s_name) {
@@ -1158,10 +1157,8 @@ static inline int assign_new_slave(const char *slave_pkgname, struct pkg_info *i
                return WIDGET_ERROR_FAULT;
        }
 
-       launch_async = (!!package_category(info) && !strcmp(package_category(info), CATEGORY_WATCH_CLOCK));
-
-       DbgPrint("New slave[%s] is assigned for %s (using %s / abi[%s] / accel[%s] / launch_async[%d])\n", s_name, info->widget_id, slave_pkgname, info->abi, info->hw_acceleration, launch_async);
-       info->slave = slave_create(s_name, info->secured, info->abi, slave_pkgname, info->network, info->hw_acceleration, launch_async);
+       DbgPrint("New slave[%s] is assigned for %s (using %s / abi[%s] / accel[%s]\n", s_name, info->widget_id, slave_pkgname, info->abi, info->hw_acceleration);
+       info->slave = slave_create(s_name, info->secured, info->abi, slave_pkgname, info->network, info->hw_acceleration);
 
        DbgFree(s_name);
 
index 3a26480..e1c3529 100644 (file)
@@ -6607,7 +6607,7 @@ static inline __attribute__((always_inline)) struct slave_node *debug_mode_enabl
 
        slave = slave_find_by_pkgname(pkgname);
        if (!slave) {
-               slave = slave_create(slavename, secured, abi, pkgname, 0, acceleration, 0);
+               slave = slave_create(slavename, secured, abi, pkgname, 0, acceleration);
                if (!slave) {
                        return NULL;
                }
@@ -8179,120 +8179,8 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe
                                goto out;
                        }
                } else {
-                       struct pkg_info *info;
-                       int network;
-                       int width, height;
-                       unsigned int widget_size;
-                       const char *category;
-                       const char *db_acceleration;
-                       int db_secured;
-                       const char *tmp;
-
-                       widget_id = is_valid_slave(pid, abi, pkgname);
-                       if (!widget_id) {
-                               goto out;
-                       }
-
-                       info = package_find(widget_id);
-                       if (!info) {
-                               char *pkgid;
-
-                               pkgid = widget_service_get_package_id(widget_id);
-                               if (!pkgid) {
-                                       DbgFree(widget_id);
-                                       goto out;
-                               }
-
-                               info = package_create(pkgid, widget_id);
-                               DbgFree(pkgid);
-                       }
-
-                       category = package_category(info);
-                       tmp = package_abi(info);
-                       db_secured = package_secured(info);
-                       db_acceleration = package_hw_acceleration(info);
-
-                       if (db_secured != secured) {
-                               DbgPrint("%s secured (%d)\n", pkgname, db_secured);
-                               DbgFree(widget_id);
-                               goto out;
-                       }
-
-                       if (strcmp(tmp, abi)) {
-                               DbgPrint("%s abi (%s)\n", pkgname, tmp);
-                               DbgFree(widget_id);
-                               goto out;
-                       }
-
-                       if (strcmp(acceleration, db_acceleration)) {
-                               DbgPrint("%s accel (%s)\n", pkgname, db_acceleration);
-                               DbgFree(widget_id);
-                               goto out;
-                       }
-
-                       if (util_string_is_in_list(category, WIDGET_CONF_CATEGORY_LIST) == 0) {
-                               DbgPrint("%s category (%s)\n", pkgname, category);
-                               DbgFree(widget_id);
-                               goto out;
-                       }
-
-                       network = package_network(info);
-
-                       if (strcmp(CATEGORY_WATCH_CLOCK, category) == 0) {
-                               /**
-                                * if the new provider is watch app,
-                                * destroy the old watch app instance
-                                */
-                               package_del_instance_by_category(CATEGORY_WATCH_CLOCK, NULL);
-                       }
-
-                       /**
-                        * If a provider sent hello_sync, we will assumes it as a watch widget.
-                        * In this case, activate it again asynchronously.
-                        */
-                       slave = slave_create(slavename, secured, abi, pkgname, network, acceleration, 1);
-                       if (!slave) {
-                               ErrPrint("Failed to create a new slave for %s\n", slavename);
-                               DbgFree(widget_id);
-                               goto out;
-                       }
-
-                       slave_set_state(slave, SLAVE_REQUEST_TO_LAUNCH);
-                       slave_set_pid(slave, pid);
-                       slave_set_valid(slave);
-
-                       if (handle >= 0) {
-                               /**
-                                * @note
-                                * In this case, there could not be exists any pended packets.
-                                * But we tried to clear them for a case!
-                                */
-                               slave_rpc_update_handle(slave, handle, 1);
-                       } else {
-                               DbgPrint("Slave RPC should be updated soon (waiting prepare sync)\n");
-                       }
-
-                       DbgPrint("Slave is activated by request: %d (%s)/(%s)\n", pid, pkgname, slavename);
-
-                       widget_size = package_size_list(info);
-
-                       if (widget_size & WIDGET_SIZE_TYPE_2x2) {
-                               widget_service_get_size(WIDGET_SIZE_TYPE_2x2, &width, &height);
-                       } else if (widget_size & WIDGET_SIZE_TYPE_4x4) {
-                               widget_service_get_size(WIDGET_SIZE_TYPE_4x4, &width, &height);
-                       } else {
-                               widget_service_get_size(WIDGET_SIZE_TYPE_1x1, &width, &height);
-                               DbgPrint("widget(%s] does not support size [2x2], [4x4]\n",pkgname);
-                       }
-
-                       result = instance_watch_create(packet, widget_id, width, height);
-                       if (!result) {
-                               ErrPrint("Failed to create a new instance\n");
-                               if (slave_unref(slave)) {
-                                       ErrPrint("Slave is not deleted yet\n");
-                               }
-                       }
-                       DbgFree(widget_id);
+                       ErrPrint("There is no valid slave instance. ignore this %s\n", slavename);
+                       goto out;
                }
        } else {
                struct pkg_info *info;
index 40db882..66b2f81 100644 (file)
@@ -77,8 +77,6 @@ struct slave_node {
        int reactivate_instances;
        int reactivate_slave;
 
-       int launch_async;
-
        pid_t pid;
 
        enum event_process {
@@ -298,7 +296,7 @@ static inline int xmonitor_resume_cb(void *data)
        return WIDGET_ERROR_NONE;
 }
 
-static inline struct slave_node *create_slave_node(const char *name, int is_secured, const char *abi, const char *pkgname, int network, const char *hw_acceleration, int launch_async)
+static inline struct slave_node *create_slave_node(const char *name, int is_secured, const char *abi, const char *pkgname, int network, const char *hw_acceleration)
 {
        struct slave_node *slave;
 
@@ -349,7 +347,6 @@ static inline struct slave_node *create_slave_node(const char *name, int is_secu
        slave->state = SLAVE_TERMINATED;
        slave->network = network;
        slave->relaunch_count = WIDGET_CONF_SLAVE_RELAUNCH_COUNT;
-       slave->launch_async = launch_async;
 
        xmonitor_add_event_callback(XMONITOR_PAUSED, xmonitor_pause_cb, slave);
        xmonitor_add_event_callback(XMONITOR_RESUMED, xmonitor_resume_cb, slave);
@@ -495,7 +492,7 @@ HAPI const int const slave_refcnt(struct slave_node *slave)
        return slave->refcnt;
 }
 
-HAPI struct slave_node *slave_create(const char *name, int is_secured, const char *abi, const char *pkgname, int network, const char *hw_acceleration, int launch_async)
+HAPI struct slave_node *slave_create(const char *name, int is_secured, const char *abi, const char *pkgname, int network, const char *hw_acceleration)
 {
        struct slave_node *slave;
 
@@ -507,7 +504,7 @@ HAPI struct slave_node *slave_create(const char *name, int is_secured, const cha
                return slave;
        }
 
-       slave = create_slave_node(name, is_secured, abi, pkgname, network, hw_acceleration, launch_async);
+       slave = create_slave_node(name, is_secured, abi, pkgname, network, hw_acceleration);
        if (!slave) {
                return NULL;
        }
@@ -663,13 +660,8 @@ static Eina_Bool relaunch_timer_cb(void *data)
                        bundle_add(param, WIDGET_CONF_BUNDLE_SLAVE_ABI, slave->abi);
                        bundle_add(param, WIDGET_CONF_BUNDLE_SLAVE_HW_ACCELERATION, slave->hw_acceleration);
 
-                       if (slave->launch_async) {
-                               ErrPrint("Launch App Async [%s]\n", slave_pkgname(slave));
-                               slave->pid = (pid_t)aul_launch_app_async(slave_pkgname(slave), param);
-                       } else {
-                               ErrPrint("Launch App Sync [%s]\n", slave_pkgname(slave));
-                               slave->pid = (pid_t)aul_launch_app(slave_pkgname(slave), param);
-                       }
+                       ErrPrint("Launch App [%s]\n", slave_pkgname(slave));
+                       slave->pid = (pid_t)aul_launch_app(slave_pkgname(slave), param);
 
                        bundle_free(param);
 
@@ -769,13 +761,8 @@ HAPI int slave_activate(struct slave_node *slave)
                bundle_add(param, WIDGET_CONF_BUNDLE_SLAVE_ABI, slave->abi);
                bundle_add(param, WIDGET_CONF_BUNDLE_SLAVE_HW_ACCELERATION, slave->hw_acceleration);
 
-               if (slave->launch_async) {
-                       ErrPrint("Launch App Async [%s]\n", slave_pkgname(slave));
-                       slave->pid = (pid_t)aul_launch_app_async(slave_pkgname(slave), param);
-               } else {
-                       ErrPrint("Launch App Sync [%s]\n", slave_pkgname(slave));
-                       slave->pid = (pid_t)aul_launch_app(slave_pkgname(slave), param);
-               }
+               ErrPrint("Launch App [%s]\n", slave_pkgname(slave));
+               slave->pid = (pid_t)aul_launch_app(slave_pkgname(slave), param);
 
                bundle_free(param);