diff options
author | Hwankyu Jhun <h.jhun@samsung.com> | 2020-03-04 07:58:38 +0900 |
---|---|---|
committer | Hwankyu Jhun <h.jhun@samsung.com> | 2020-03-04 08:18:45 +0900 |
commit | 5c0b97dd238058fa2607c7999602986ce4bbd695 (patch) | |
tree | 5b7497eb72eea82c3dc963b2327c087f33621a17 /screen_connector_launcher_service | |
parent | f5cbc39465651ec3ad584b509594577517af461d (diff) | |
download | screen-connector-5c0b97dd238058fa2607c7999602986ce4bbd695.tar.gz screen-connector-5c0b97dd238058fa2607c7999602986ce4bbd695.tar.bz2 screen-connector-5c0b97dd238058fa2607c7999602986ce4bbd695.zip |
Fix Launcher Service
- Uses RawImage ptr instead of shared_ptr<RawImage> ptr
- Sets previous raw image handle after calling prepare_cb function
Change-Id: I9fe2338354cd258e6e54a56b1c1d857edd6dd509
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
Diffstat (limited to 'screen_connector_launcher_service')
-rw-r--r-- | screen_connector_launcher_service/stub.cc | 95 |
1 files changed, 13 insertions, 82 deletions
diff --git a/screen_connector_launcher_service/stub.cc b/screen_connector_launcher_service/stub.cc index 437bf24..c95d496 100644 --- a/screen_connector_launcher_service/stub.cc +++ b/screen_connector_launcher_service/stub.cc @@ -69,10 +69,11 @@ class LauncherServiceStub void OnPrepareEvent(std::shared_ptr<screen_connector::RawImage> image, uint32_t serial) override { - raw_image_ = std::move(image); if (ops_.prepare) { - ops_.prepare(reinterpret_cast<void*>(&raw_image_), serial, user_data_); + ops_.prepare(reinterpret_cast<void*>(image.get()), serial, + user_data_); } + raw_image_ = std::move(image); } void OnStopEvent(uint32_t serial) override { @@ -229,14 +230,7 @@ extern "C" EXPORT int screen_connector_launcher_service_image_get_direction( return -EINVAL; } - auto img_ptr = - reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast<screen_connector::RawImage*>(handle); *direction = __convert_direction(img->GetDirection()); return 0; @@ -250,14 +244,7 @@ extern "C" EXPORT int screen_connector_launcher_service_image_get_type( return -EINVAL; } - auto img_ptr = - reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast<screen_connector::RawImage*>(handle); *image_type = __convert_image_type(img->GetImageType()); return 0; @@ -271,14 +258,7 @@ extern "C" EXPORT int screen_connector_launcher_service_image_get_position_x( return -EINVAL; } - auto img_ptr = - reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast<screen_connector::RawImage*>(handle); *x = img->GetPositionX(); return 0; @@ -292,14 +272,7 @@ extern "C" EXPORT int screen_connector_launcher_service_image_get_position_y( return -EINVAL; } - auto img_ptr = - reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast<screen_connector::RawImage*>(handle); *y = img->GetPositionY(); return 0; @@ -314,14 +287,7 @@ screen_connector_launcher_service_image_get_shared_widget_info( return -EINVAL; } - auto img_ptr = - reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast<screen_connector::RawImage*>(handle); *shared_widget_info = strdup(img->GetSharedWidgetInfo().c_str()); if (*shared_widget_info == nullptr) { _E("Out of memory"); @@ -340,14 +306,7 @@ screen_connector_launcher_service_image_get_tbm_surface( return -EINVAL; } - auto img_ptr = - reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast<screen_connector::RawImage*>(handle); *tbm_surface = img->GetWlBuffer()->GetTbmSurface(); return 0; @@ -362,14 +321,7 @@ screen_connector_launcher_service_image_get_tbm_surface_info( return -EINVAL; } - auto img_ptr = - reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast<screen_connector::RawImage*>(handle); *tbm_surface_info = img->GetWlBuffer()->GetTbmSurfaceInfo(); return 0; @@ -383,14 +335,7 @@ extern "C" EXPORT int screen_connector_launcher_service_image_get_image_file( return -EINVAL; } - auto img_ptr = - reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast<screen_connector::RawImage*>(handle); *fd = img->GetImageFile()->GetRaw(); *size = img->GetImageFile()->GetSize(); @@ -405,14 +350,7 @@ extern "C" EXPORT int screen_connector_launcher_service_image_get_file_path( return -EINVAL; } - auto img_ptr = - reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast<screen_connector::RawImage*>(handle); *file_path = strdup(img->GetFilePath().c_str()); if (*file_path == nullptr) { _E("Out of memory"); @@ -430,14 +368,7 @@ extern "C" EXPORT int screen_connector_launcher_service_image_get_file_group( return -EINVAL; } - auto img_ptr = - reinterpret_cast<std::shared_ptr<screen_connector::RawImage>*>(handle); - auto img = img_ptr->get(); - if (img == nullptr) { - _E("Invalid parameter"); - return -EINVAL; - } - + auto img = reinterpret_cast<screen_connector::RawImage*>(handle); *file_group = strdup(img->GetFileGroup().c_str()); if (*file_group == nullptr) { _E("Out of memory"); |