Skip to content

Commit 330072d

Browse files
committed
Add RestartEngine API to handle cold-restart scenario
Signed-off-by: MuHong Byun <mh.byun@samsung.com>
1 parent 58d78e0 commit 330072d

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

shell/platform/tizen/channels/platform_view_channel.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ void PlatformViewChannel::ClearViewFactories() {
8080
view_factories_.clear();
8181
}
8282

83+
void PlatformViewChannel::PreEngineRestart() {
84+
ClearViewInstances();
85+
}
86+
8387
void PlatformViewChannel::SendKeyEvent(Ecore_Event_Key* key, bool is_down) {
8488
auto instances = ViewInstances();
8589
auto it = instances.find(CurrentFocusedViewId());

shell/platform/tizen/channels/platform_view_channel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ class PlatformViewChannel {
3838
void DispatchCompositionUpdateEvent(const std::string& key);
3939
void DispatchCompositionEndEvent(const std::string& key);
4040

41+
void PreEngineRestart();
42+
4143
private:
4244
void HandleMethodCall(
4345
const flutter::MethodCall<flutter::EncodableValue>& call,

shell/platform/tizen/flutter_tizen_engine.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ bool FlutterTizenEngine::RunEngine(
194194
auto engine = reinterpret_cast<FlutterTizenEngine*>(user_data);
195195
auto message = engine->ConvertToDesktopMessage(*engine_message);
196196
engine->message_dispatcher->HandleMessage(message);
197+
198+
// Workarounds for handling engine restarts. Needs to be replaced by
199+
// PlatformView::OnPreEngineRestart.
200+
if (strncmp(message.channel, "flutter/isolate", 15) == 0) {
201+
engine->RestartEngine();
202+
}
197203
};
198204
args.custom_task_runners = &custom_task_runners;
199205
#ifndef TIZEN_RENDERER_EVAS_GL
@@ -270,6 +276,13 @@ bool FlutterTizenEngine::StopEngine() {
270276
return false;
271277
}
272278

279+
void FlutterTizenEngine::RestartEngine() {
280+
// Need to reset native resource.
281+
if (platform_view_channel) {
282+
platform_view_channel->PreEngineRestart();
283+
}
284+
}
285+
273286
FlutterDesktopPluginRegistrarRef FlutterTizenEngine::GetPluginRegistrar() {
274287
return plugin_registrar_.get();
275288
}

shell/platform/tizen/flutter_tizen_engine.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ class FlutterTizenEngine : public TizenRenderer::Delegate {
7070
bool RunEngine(const FlutterDesktopEngineProperties& engine_properties);
7171
bool StopEngine();
7272

73+
void RestartEngine();
74+
7375
// Returns the currently configured Plugin Registrar.
7476
FlutterDesktopPluginRegistrarRef GetPluginRegistrar();
7577

0 commit comments

Comments
 (0)