Skip to content

Commit

Permalink
Revert some code
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaowei-guan committed Jul 5, 2024
1 parent e628c7b commit cc65393
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 27 deletions.
41 changes: 23 additions & 18 deletions flutter/shell/platform/tizen/flutter_tizen_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,32 @@ FlutterTizenEngine::~FlutterTizenEngine() {
StopEngine();
}

void FlutterTizenEngine::CreateRenderer(
FlutterDesktopRendererType renderer_type) {
if (renderer_type == FlutterDesktopRendererType::kEvasGL) {
renderer_ = std::make_unique<TizenRendererEvasGL>(view_->tizen_view());
render_loop_ = std::make_unique<TizenRenderEventLoop>(
std::this_thread::get_id(), // main thread
embedder_api_.GetCurrentTime,
[this](const auto* task) {
if (embedder_api_.RunTask(this->engine_, task) != kSuccess) {
FT_LOG(Error) << "Could not post an engine task.";
}
},
renderer_.get());
} else if (renderer_type == FlutterDesktopRendererType::kEGL) {
renderer_ = std::make_unique<TizenRendererEcoreGL>(view_->tizen_view());
} else {
renderer_ = std::make_unique<TizenRendererVulkan>(view_->tizen_view());
}
}

bool FlutterTizenEngine::RunEngine() {
if (engine_ != nullptr) {
FT_LOG(Error) << "The engine has already started.";
return false;
}
if (IsHeaded() && !renderer()->IsValid()) {
if (IsHeaded() && !renderer_->IsValid()) {
FT_LOG(Error) << "The display was not valid.";
return false;
}
Expand Down Expand Up @@ -141,15 +161,6 @@ bool FlutterTizenEngine::RunEngine() {
FlutterTaskRunnerDescription render_task_runner = {};

if (IsHeaded() && dynamic_cast<TizenRendererEvasGL*>(renderer())) {
render_loop_ = std::make_unique<TizenRenderEventLoop>(
std::this_thread::get_id(), // main thread
embedder_api_.GetCurrentTime,
[this](const auto* task) {
if (embedder_api_.RunTask(this->engine_, task) != kSuccess) {
FT_LOG(Error) << "Could not post an engine task.";
}
},
renderer());
render_task_runner.struct_size = sizeof(FlutterTaskRunnerDescription);
render_task_runner.user_data = render_loop_.get();
render_task_runner.runs_task_on_current_thread_callback =
Expand Down Expand Up @@ -201,7 +212,7 @@ bool FlutterTizenEngine::RunEngine() {
engine->OnUpdateSemantics(update);
};

if (IsHeaded() && dynamic_cast<TizenRendererEcoreGL*>(renderer())) {
if (IsHeaded() && dynamic_cast<TizenRendererEcoreGL*>(renderer_.get())) {
vsync_waiter_ = std::make_unique<TizenVsyncWaiter>(this);
args.vsync_callback = [](void* user_data, intptr_t baton) -> void {
auto* engine = static_cast<FlutterTizenEngine*>(user_data);
Expand Down Expand Up @@ -275,13 +286,7 @@ bool FlutterTizenEngine::StopEngine() {
void FlutterTizenEngine::SetView(FlutterTizenView* view,
FlutterDesktopRendererType renderer_type) {
view_ = view;
if (renderer_type == FlutterDesktopRendererType::kEvasGL) {
renderer_ = std::make_unique<TizenRendererEvasGL>(view_->tizen_view());
} else if (renderer_type == FlutterDesktopRendererType::kEGL) {
renderer_ = std::make_unique<TizenRendererEcoreGL>(view_->tizen_view());
} else {
renderer_ = std::make_unique<TizenRendererVulkan>(view_->tizen_view());
}
CreateRenderer(renderer_type);
}

void FlutterTizenEngine::AddPluginRegistrarDestructionCallback(
Expand Down
7 changes: 5 additions & 2 deletions flutter/shell/platform/tizen/flutter_tizen_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class FlutterTizenEngine {
FlutterTizenEngine(FlutterTizenEngine const&) = delete;
FlutterTizenEngine& operator=(FlutterTizenEngine const&) = delete;

// Creates a GL renderer from the given type.
void CreateRenderer(FlutterDesktopRendererType renderer_type);

// Starts running the engine with the given entrypoint. If null, defaults to
// main().
//
Expand All @@ -81,8 +84,6 @@ class FlutterTizenEngine {
// headless engines.
FlutterTizenView* view() { return view_; }

TizenRenderer* renderer() { return renderer_.get(); }

FlutterDesktopMessengerRef messenger() { return messenger_.get(); }

IncomingMessageDispatcher* message_dispatcher() {
Expand All @@ -97,6 +98,8 @@ class FlutterTizenEngine {
return texture_registrar_.get();
}

TizenRenderer* renderer() { return renderer_.get(); }

AppControlChannel* app_control_channel() {
return app_control_channel_.get();
}
Expand Down
2 changes: 1 addition & 1 deletion flutter/shell/platform/tizen/tizen_renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ bool TizenRenderer::Create(TizenViewBase* view) {
return false;
}

} // namespace flutter
} // namespace flutter
2 changes: 0 additions & 2 deletions flutter/shell/platform/tizen/tizen_renderer_ecore_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

#include "flutter/shell/platform/tizen/logger.h"
#include "flutter/shell/platform/tizen/tizen_renderer_ecore_gl.h"
#include "flutter/shell/platform/tizen/tizen_view.h"
#include "flutter/shell/platform/tizen/tizen_window.h"

namespace flutter {

Expand Down
2 changes: 0 additions & 2 deletions flutter/shell/platform/tizen/tizen_renderer_evas_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include "flutter/shell/platform/tizen/tizen_renderer_evas_gl.h"
#include "flutter/shell/platform/tizen/logger.h"
#include "flutter/shell/platform/tizen/tizen_evas_gl_helper.h"
#include "flutter/shell/platform/tizen/tizen_view.h"
#include "flutter/shell/platform/tizen/tizen_window.h"

// g_evas_gl is shared with ExternalTextureSurfaceEGL and
// ExternalTextureSurfaceEvasGL.
Expand Down
2 changes: 1 addition & 1 deletion flutter/shell/platform/tizen/tizen_renderer_vulkan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ void TizenRendererVulkan::DestroySurface() {}

void TizenRendererVulkan::ResizeSurface(int32_t width, int32_t height) {}

} // namespace flutter
} // namespace flutter
2 changes: 1 addition & 1 deletion flutter/shell/platform/tizen/tizen_renderer_vulkan.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ class TizenRendererVulkan : public TizenRenderer {
};
} // namespace flutter

#endif // EMBEDDER_TIZEN_RENDERER_VULKAN_H_
#endif // EMBEDDER_TIZEN_RENDERER_VULKAN_H_

0 comments on commit cc65393

Please sign in to comment.