Skip to content

Commit

Permalink
Additional clean-ups
Browse files Browse the repository at this point in the history
  • Loading branch information
swift-kim committed Jul 8, 2021
1 parent f6318c0 commit 3b1c6a7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion shell/platform/tizen/tizen_event_loop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,6 @@ void TizenRenderEventLoop::OnTaskExpired() {
// Do nothing
}
}
#endif
#endif // TIZEN_RENDERER_EVAS_GL

} // namespace flutter
20 changes: 13 additions & 7 deletions shell/platform/tizen/tizen_event_loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ class TizenRenderer;
class TizenEventLoop {
public:
using TaskExpiredCallback = std::function<void(const FlutterTask*)>;

TizenEventLoop(std::thread::id main_thread_id,
CurrentTimeProc get_current_time,
TaskExpiredCallback on_task_expired);
virtual ~TizenEventLoop();

// Prevent copying.
TizenEventLoop(const TizenEventLoop&) = delete;
TizenEventLoop& operator=(const TizenEventLoop&) = delete;

bool RunsTasksOnCurrentThread() const;

void ExcuteTaskEvents(
Expand All @@ -44,6 +50,7 @@ class TizenEventLoop {

protected:
using TaskTimePoint = std::chrono::steady_clock::time_point;

struct Task {
uint64_t order;
TaskTimePoint fire_time;
Expand All @@ -58,6 +65,7 @@ class TizenEventLoop {
}
};
};

std::thread::id main_thread_id_;
CurrentTimeProc get_current_time_;
TaskExpiredCallback on_task_expired_;
Expand All @@ -71,16 +79,12 @@ class TizenEventLoop {
private:
Ecore_Pipe* ecore_pipe_;

TizenEventLoop(const TizenEventLoop&) = delete;

TizenEventLoop& operator=(const TizenEventLoop&) = delete;
// Returns a TaskTimePoint computed from the given target time from Flutter.
TaskTimePoint TimePointFromFlutterTime(uint64_t flutter_target_time_nanos);

static void ExcuteTaskEvents(void* data, void* buffer, unsigned int nbyte);

static Eina_Bool TaskTimerCallback(void* data);

// Returns a TaskTimePoint computed from the given target time from Flutter.
TaskTimePoint TimePointFromFlutterTime(uint64_t flutter_target_time_nanos);
};

class TizenPlatformEventLoop : public TizenEventLoop {
Expand All @@ -89,6 +93,7 @@ class TizenPlatformEventLoop : public TizenEventLoop {
CurrentTimeProc get_current_time,
TaskExpiredCallback on_task_expired);
virtual ~TizenPlatformEventLoop();

virtual void OnTaskExpired() override;
};

Expand All @@ -100,13 +105,14 @@ class TizenRenderEventLoop : public TizenEventLoop {
TaskExpiredCallback on_task_expired,
TizenRenderer* renderer);
virtual ~TizenRenderEventLoop();

virtual void OnTaskExpired() override;

private:
TizenRenderer* renderer_{nullptr};
std::atomic_bool has_pending_renderer_callback_{false};
};
#endif
#endif // TIZEN_RENDERER_EVAS_GL

} // namespace flutter

Expand Down

0 comments on commit 3b1c6a7

Please sign in to comment.