Skip to content

Commit

Permalink
Minor code cleanup (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
swift-kim authored Aug 3, 2022
1 parent 7c39f5f commit 0abeb89
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 32 deletions.
3 changes: 2 additions & 1 deletion shell/platform/tizen/external_texture_pixel_evas_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

#include "external_texture_pixel_evas_gl.h"

#include "tizen_evas_gl_helper.h"
#include "flutter/shell/platform/tizen/tizen_evas_gl_helper.h"

extern Evas_GL* g_evas_gl;
EVAS_GL_GLOBAL_GLES2_DECLARE();

Expand Down
6 changes: 3 additions & 3 deletions shell/platform/tizen/external_texture_surface_evas_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

#include <tbm_surface.h>

#include "tizen_evas_gl_helper.h"
#include "flutter/shell/platform/tizen/logger.h"
#include "flutter/shell/platform/tizen/tizen_evas_gl_helper.h"

extern Evas_GL* g_evas_gl;
EVAS_GL_GLOBAL_GLES2_DECLARE();

#include "flutter/shell/platform/tizen/logger.h"

namespace flutter {

ExternalTextureSurfaceEvasGL::ExternalTextureSurfaceEvasGL(
Expand Down
25 changes: 11 additions & 14 deletions shell/platform/tizen/flutter_tizen_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,26 +199,24 @@ bool FlutterTizenEngine::RunEngine() {
engine->message_dispatcher_->HandleMessage(message);
};
args.custom_task_runners = &custom_task_runners;
if (aot_data_) {
args.aot_data = aot_data_.get();
}
if (!project_->custom_dart_entrypoint().empty()) {
args.custom_dart_entrypoint = project_->custom_dart_entrypoint().c_str();
}
#ifndef WEARABLE_PROFILE
args.update_semantics_node_callback = OnUpdateSemanticsNode;
args.update_semantics_custom_action_callback = OnUpdateSemanticsCustomActions;
#endif

#ifndef WEARABLE_PROFILE
if (IsHeaded() && renderer_->type() == FlutterDesktopRendererType::kEGL) {
tizen_vsync_waiter_ = std::make_unique<TizenVsyncWaiter>(this);
vsync_waiter_ = std::make_unique<TizenVsyncWaiter>(this);
args.vsync_callback = [](void* user_data, intptr_t baton) -> void {
reinterpret_cast<FlutterTizenEngine*>(user_data)
->tizen_vsync_waiter_->AsyncWaitForVsync(baton);
auto* engine = reinterpret_cast<FlutterTizenEngine*>(user_data);
engine->vsync_waiter_->AsyncWaitForVsync(baton);
};
}
#endif
if (aot_data_) {
args.aot_data = aot_data_.get();
}
if (!project_->custom_dart_entrypoint().empty()) {
args.custom_dart_entrypoint = project_->custom_dart_entrypoint().c_str();
}

FlutterRendererConfig renderer_config = GetRendererConfig();

Expand Down Expand Up @@ -269,10 +267,9 @@ bool FlutterTizenEngine::StopEngine() {
plugin_registrar_destruction_callbacks_) {
callback(registrar);
}

#ifndef WEARABLE_PROFILE
if (IsHeaded() && renderer_->type() == FlutterDesktopRendererType::kEGL) {
tizen_vsync_waiter_.reset();
if (vsync_waiter_) {
vsync_waiter_.reset();
}
#endif
FlutterEngineResult result = embedder_api_.Shutdown(engine_);
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/tizen/flutter_tizen_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class FlutterTizenEngine {

#ifndef WEARABLE_PROFILE
// The vsync waiter for the embedder.
std::unique_ptr<TizenVsyncWaiter> tizen_vsync_waiter_;
std::unique_ptr<TizenVsyncWaiter> vsync_waiter_;
#endif
};

Expand Down
11 changes: 5 additions & 6 deletions shell/platform/tizen/tizen_event_loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <thread>

#include "flutter/shell/platform/embedder/embedder.h"
#include "flutter/shell/platform/tizen/tizen_renderer.h"

namespace flutter {

Expand Down Expand Up @@ -69,10 +70,10 @@ class TizenEventLoop {
std::priority_queue<Task, std::deque<Task>, Task::Comparer> task_queue_;
std::vector<Task> expired_tasks_;
std::mutex expired_tasks_mutex_;
std::atomic<std::uint64_t> task_order_{0};
std::atomic<std::uint64_t> task_order_ = 0;

private:
Ecore_Pipe* ecore_pipe_;
Ecore_Pipe* ecore_pipe_ = nullptr;

// Returns a TaskTimePoint computed from the given target time from Flutter.
TaskTimePoint TimePointFromFlutterTime(uint64_t flutter_target_time_nanos);
Expand All @@ -88,8 +89,6 @@ class TizenPlatformEventLoop : public TizenEventLoop {
virtual void OnTaskExpired() override;
};

class TizenRenderer;

class TizenRenderEventLoop : public TizenEventLoop {
public:
TizenRenderEventLoop(std::thread::id main_thread_id,
Expand All @@ -101,8 +100,8 @@ class TizenRenderEventLoop : public TizenEventLoop {
virtual void OnTaskExpired() override;

private:
TizenRenderer* renderer_{nullptr};
std::atomic_bool has_pending_renderer_callback_{false};
TizenRenderer* renderer_ = nullptr;
std::atomic_bool has_pending_renderer_callback_ = false;
};

} // namespace flutter
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/tizen/tizen_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <cstdint>

#include "public/flutter_tizen.h"
#include "flutter/shell/platform/tizen/public/flutter_tizen.h"

namespace flutter {

Expand Down
2 changes: 1 addition & 1 deletion shell/platform/tizen/tizen_renderer_egl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ bool TizenRendererEgl::CreateSurface(void* render_target,
int32_t height) {
egl_display_ = eglGetDisplay(static_cast<wl_display*>(render_target_display));

if (EGL_NO_DISPLAY == egl_display_) {
if (egl_display_ == EGL_NO_DISPLAY) {
PrintEGLError();
FT_LOG(Error) << "Could not get EGL display.";
return false;
Expand Down
7 changes: 3 additions & 4 deletions shell/platform/tizen/tizen_renderer_evas_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@

#include "tizen_renderer_evas_gl.h"

#include "tizen_evas_gl_helper.h"
#include "flutter/shell/platform/tizen/logger.h"
#include "flutter/shell/platform/tizen/tizen_evas_gl_helper.h"

// g_evas_gl is shared with ExternalTextureSurfaceEGL and
// ExternalTextureSurfaceEvasGL.
Evas_GL* g_evas_gl = nullptr;

EVAS_GL_GLOBAL_GLES2_DEFINE();

#include "flutter/shell/platform/tizen/logger.h"

namespace flutter {

TizenRendererEvasGL::TizenRendererEvasGL() {
Expand Down Expand Up @@ -81,6 +79,7 @@ bool TizenRendererEvasGL::CreateSurface(void* render_target,
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
OnPresent();

return true;
}

Expand Down
2 changes: 1 addition & 1 deletion shell/platform/tizen/tizen_vsync_waiter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void TdmClient::VblankCallback(tdm_client_vblank* vblank,
std::lock_guard<std::mutex> lock(self->engine_mutex_);
if (self->engine_) {
uint64_t frame_start_time_nanos = tv_sec * 1e9 + tv_usec * 1e3;
uint64_t frame_target_time_nanos = 16.6 * 1e6 + frame_start_time_nanos;
uint64_t frame_target_time_nanos = frame_start_time_nanos + 16.6 * 1e6;
self->engine_->OnVsync(self->baton_, frame_start_time_nanos,
frame_target_time_nanos);
}
Expand Down

0 comments on commit 0abeb89

Please sign in to comment.