Onscreen Rendering support based on Ozone EFL 02/284602/3
authorChandan Padhi <c.padhi@samsung.com>
Mon, 21 Nov 2022 11:41:20 +0000 (17:11 +0530)
committerChandan Padhi <c.padhi@samsung.com>
Wed, 23 Nov 2022 08:24:54 +0000 (08:24 +0000)
This commit enables onscreen rendering with OzonePlatform for
EFL and brings up content shell/chrome for desktop and tizen.

Launch on Desktop:
a. export EVAS_GL_NO_BLACKLIST=1
b. cd out.x64/Dependencies/Root/lib64/
c. export LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH
$ ./out.x64/content_shell --no-sandbox --ignore-gpu-blocklist
  --use-gl=egl --ozone-platform=efl
$ ./out.x64/chrome --no-sandbox --ignore-gpu-blocklist --use-gl=egl
  --ozone-platform=efl --window-size=800,600

Launch on TV:
$ /usr/lib/chromium-efl/chrome --no-sandbox --ozone-platform=efl
  --window-size=1920,1080 --in-process-gpu
$ /usr/lib/chromium-efl/content_shell --no-sandbox --ozone-platform=efl
  --content-shell-host-window-size=1920x1080 --in-process-gpu

References:
https://review.tizen.org/gerrit/268952/
https://review.tizen.org/gerrit/268957/
https://review.tizen.org/gerrit/269004/

Change-Id: Ia6448ab7ee939e53829873311f2ce0285390a617
Signed-off-by: Chandan Padhi <c.padhi@samsung.com>
36 files changed:
base/BUILD.gn
base/base_switches.cc
base/base_switches.h
base/message_loop/message_pump.cc
base/message_loop/message_pump_for_ui.h
base/message_loop/message_pump_type.h
build/config/ozone.gni
content/renderer/renderer_main.cc
mojo/public/cpp/base/message_pump_type_mojom_traits.cc
mojo/public/mojom/base/BUILD.gn
mojo/public/mojom/base/message_pump_type.mojom
tizen_src/chromium_impl/base/message_loop/message_pump_ecore.cc
tizen_src/chromium_impl/base/message_loop/message_pump_ecore.h
tizen_src/chromium_impl/base/message_loop/message_pump_for_ui_efl.cc
tizen_src/chromium_impl/base/message_loop/message_pump_for_ui_efl.h
tizen_src/chromium_impl/content/content_efl.gni
tizen_src/chromium_impl/ui/ozone/BUILD.gn [deleted file]
tizen_src/chromium_impl/ui/ozone/ozone_extra.gni [new file with mode: 0644]
tizen_src/chromium_impl/ui/ozone/ozone_platform_efl.cc [deleted file]
tizen_src/chromium_impl/ui/ozone/platform/efl/BUILD.gn [new file with mode: 0644]
tizen_src/chromium_impl/ui/ozone/platform/efl/client_native_pixmap_factory_efl.cc [moved from tizen_src/chromium_impl/ui/ozone/client_native_pixmap_factory_efl.cc with 71% similarity]
tizen_src/chromium_impl/ui/ozone/platform/efl/client_native_pixmap_factory_efl.h [moved from tizen_src/chromium_impl/ui/ozone/client_native_pixmap_factory_efl.h with 54% similarity]
tizen_src/chromium_impl/ui/ozone/platform/efl/efl_screen.cc [new file with mode: 0644]
tizen_src/chromium_impl/ui/ozone/platform/efl/efl_screen.h [new file with mode: 0644]
tizen_src/chromium_impl/ui/ozone/platform/efl/efl_surface_factory.cc [new file with mode: 0644]
tizen_src/chromium_impl/ui/ozone/platform/efl/efl_surface_factory.h [new file with mode: 0644]
tizen_src/chromium_impl/ui/ozone/platform/efl/efl_window.cc [new file with mode: 0644]
tizen_src/chromium_impl/ui/ozone/platform/efl/efl_window.h [new file with mode: 0644]
tizen_src/chromium_impl/ui/ozone/platform/efl/ozone_platform_efl.cc [new file with mode: 0644]
tizen_src/chromium_impl/ui/ozone/platform/efl/ozone_platform_efl.h [moved from tizen_src/chromium_impl/ui/ozone/ozone_platform_efl.h with 54% similarity]
tizen_src/chromium_impl/ui/ozone/surface_factory_efl.cc [deleted file]
tizen_src/chromium_impl/ui/ozone/surface_factory_efl.h [deleted file]
tizen_src/ewk/efl_integration/common/content_switches_efl.cc
tizen_src/ewk/efl_integration/common/content_switches_efl.h
tizen_src/ewk/efl_integration/ewk_global_data.cc
ui/ozone/BUILD.gn

index 501b314..198455d 100644 (file)
@@ -985,10 +985,6 @@ mixed_component("base") {
     "vlog.h",
   ]
 
-  if (use_efl) {
-    sources += external_base_sources
-  }
-
   if (is_tizen) {
     libs = [
       "event",
@@ -1483,6 +1479,11 @@ mixed_component("base") {
     }
   }
 
+  if (use_efl) {
+    sources += external_base_sources
+    configs += external_base_configs
+  }
+
   all_dependent_configs = []
   defines = [ "BASE_IMPLEMENTATION" ]
   data = []
@@ -3489,10 +3490,6 @@ test("base_unittests") {
 
   defines = []
 
-  if (use_efl) {
-    configs += external_base_configs
-  }
-
   deps = [
     ":arm_bti_testfunctions",
     ":base",
index f396198..28fdb35 100644 (file)
@@ -143,6 +143,12 @@ const char kDisableUsbKeyboardDetect[]      = "disable-usb-keyboard-detect";
 const char kDisableDevShmUsage[] = "disable-dev-shm-usage";
 #endif
 
+#if defined(USE_EFL)
+// Used for limiting memory allocations in MessagePumpForUIEfl.
+const char kLimitMemoryAllocationInScheduleDelayedWork[] =
+    "limit-memory-allocation-in-schedule-delayed-work";
+#endif
+
 #if BUILDFLAG(IS_POSIX)
 // Used for turning on Breakpad crash reporting in a debug environment where
 // crash reporting is typically compiled but disabled.
index 4f5dd6b..75d2b3c 100644 (file)
@@ -48,6 +48,10 @@ extern const char kDisableUsbKeyboardDetect[];
 extern const char kDisableDevShmUsage[];
 #endif
 
+#if defined(USE_EFL)
+extern const char kLimitMemoryAllocationInScheduleDelayedWork[];
+#endif
+
 #if BUILDFLAG(IS_POSIX)
 extern const char kEnableCrashReporterForTesting[];
 #endif
index e71527d..4f2cf41 100644 (file)
@@ -14,6 +14,9 @@
 #if BUILDFLAG(IS_APPLE)
 #include "base/message_loop/message_pump_mac.h"
 #endif
+#if defined(USE_EFL)
+#include "base/message_loop/message_pump_ecore.h"
+#endif
 
 namespace base {
 
@@ -71,6 +74,11 @@ std::unique_ptr<MessagePump> MessagePump::Create(MessagePumpType type) {
       return std::make_unique<MessagePumpNSRunLoop>();
 #endif
 
+#if defined(USE_EFL)
+    case MessagePumpType::ECORE:
+      return std::make_unique<MessagePumpEcore>();
+#endif
+
     case MessagePumpType::CUSTOM:
       NOTREACHED();
       return nullptr;
index e0abe31..3fbab14 100644 (file)
@@ -18,6 +18,8 @@
 #include "base/message_loop/message_pump.h"
 #elif BUILDFLAG(IS_NACL) || BUILDFLAG(IS_AIX)
 // No MessagePumpForUI, see below.
+#elif defined(USE_EFL)
+#include "base/message_loop/message_pump_ecore.h"
 #elif defined(USE_GLIB)
 #include "base/message_loop/message_pump_glib.h"
 #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
@@ -42,6 +44,8 @@ using MessagePumpForUI = MessagePump;
 #elif BUILDFLAG(IS_NACL) || BUILDFLAG(IS_AIX)
 // Currently NaCl and AIX don't have a MessagePumpForUI.
 // TODO(abarth): Figure out if we need this.
+#elif defined(USE_EFL)
+using MessagePumpForUI = MessagePumpEcore;
 #elif defined(USE_GLIB)
 using MessagePumpForUI = MessagePumpGlib;
 #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
index 4ae11f0..86959b9 100644 (file)
@@ -39,6 +39,11 @@ enum class MessagePumpType {
   // OSX and IOS.
   NS_RUNLOOP,
 #endif  // BUILDFLAG(IS_APPLE)
+
+#if defined(USE_EFL)
+  // This type of pump supports ecore events. This is only for use for EFL port.
+  ECORE,
+#endif  // defined(USE_EFL)
 };
 
 }  // namespace base
index 1eba4ab..2ad2bfa 100644 (file)
@@ -16,6 +16,9 @@ declare_args() {
   # Ozone extra platforms file path. Can be overridden to build out of
   # tree ozone platforms.
   ozone_extra_path = "//build/config/ozone_extra.gni"
+  if (use_efl) {
+    ozone_extra_path = "//tizen_src/chromium_impl/ui/ozone/ozone_extra.gni"
+  }
 
   # Select platforms automatically. Turn this off for manual control.
   ozone_auto_platforms = use_ozone
index 119e250..6b59882 100644 (file)
@@ -102,6 +102,8 @@ std::unique_ptr<base::MessagePump> CreateMainThreadMessagePump() {
 #elif BUILDFLAG(IS_FUCHSIA)
   // Allow FIDL APIs on renderer main thread.
   return base::MessagePump::Create(base::MessagePumpType::IO);
+#elif defined(USE_EFL)
+  return base::MessagePump::Create(base::MessagePumpType::ECORE);
 #else
   return base::MessagePump::Create(base::MessagePumpType::DEFAULT);
 #endif
index a6c5c66..cba6b09 100644 (file)
@@ -28,6 +28,10 @@ EnumTraits<mojo_base::mojom::MessagePumpType, base::MessagePumpType>::ToMojom(
     case base::MessagePumpType::NS_RUNLOOP:
       return mojo_base::mojom::MessagePumpType::kNsRunloop;
 #endif
+#if defined(USE_EFL)
+    case base::MessagePumpType::ECORE:
+      return mojo_base::mojom::MessagePumpType::kEcore;
+#endif
   }
   NOTREACHED();
   return mojo_base::mojom::MessagePumpType::kDefault;
@@ -60,6 +64,11 @@ bool EnumTraits<mojo_base::mojom::MessagePumpType, base::MessagePumpType>::
       *output = base::MessagePumpType::NS_RUNLOOP;
       return true;
 #endif
+#if defined(USE_EFL)
+    case mojo_base::mojom::MessagePumpType::kEcore:
+      *output = base::MessagePumpType::ECORE;
+      return true;
+#endif
   }
   return false;
 }
index 552313e..2334d60 100644 (file)
@@ -51,6 +51,9 @@ mojom_component("base") {
   }
 
   webui_module_path = "chrome://resources/mojo/mojo/public/mojom/base"
+  if (use_efl) {
+    enabled_features += [ "use_efl" ]
+  }
 
   output_prefix = "mojo_base_mojom"
   macro_prefix = "MOJO_BASE_MOJOM"
index 3145ee8..14ea6cd 100644 (file)
@@ -16,4 +16,6 @@ enum MessagePumpType {
   kNsRunloop,
   [EnableIf=is_ios]
   kNsRunloop,
+  [EnableIf=use_efl]
+  kEcore,
 };
index 612c6bd..8d9a09c 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "base/message_loop/message_pump_ecore.h"
 
+#include "base/logging.h"
 #include "base/notreached.h"
 
 // EFL version 1.8 and later don't define the function
@@ -15,27 +16,106 @@ int ecore_main_loop_iterate_may_block(int);
 
 namespace base {
 
-namespace {
-void PipeCallback(void *data, void*, unsigned int) {
-  static_cast<MessagePumpEcore*>(data)->HandleScheduledWork();
-}
-}
-
 struct MessagePumpEcore::RunState {
   Delegate* delegate;
   bool should_quit;
   int run_depth;
 };
 
-MessagePumpEcore::MessagePumpEcore()
-  : state_(NULL)
-  , pipe_(ecore_pipe_add(&PipeCallback, this))
-  , work_scheduled_(false) {
+MessagePumpEcore::FdWatchController::FdWatchController(
+    const Location& from_here)
+    : FdWatchControllerInterface(from_here) {}
+
+MessagePumpEcore::FdWatchController::~FdWatchController() {
+  if (fd_handler_)
+    StopWatchingFileDescriptor();
+  if (was_destroyed_) {
+    DCHECK(!*was_destroyed_);
+    *was_destroyed_ = true;
+  }
+}
+
+bool MessagePumpEcore::FdWatchController::StopWatchingFileDescriptor() {
+  if (!fd_handler_)
+    return true;
+
+  ecore_main_fd_handler_del(fd_handler_);
+  fd_handler_ = nullptr;
+  watcher_ = nullptr;
+  return true;
+}
+
+void MessagePumpEcore::FdWatchController::Init(Ecore_Fd_Handler* fd_handler,
+                                               bool persistent) {
+  DCHECK(fd_handler);
+  DCHECK(!fd_handler_);
+
+  fd_handler_ = fd_handler;
+  persistent_ = persistent;
+}
+
+void MessagePumpEcore::FdWatchController::OnFileCanReadWithoutBlocking(int fd) {
+  if (!watcher_)
+    return;
+  watcher_->OnFileCanReadWithoutBlocking(fd);
+}
+
+void MessagePumpEcore::FdWatchController::OnFileCanWriteWithoutBlocking(
+    int fd) {
+  if (!watcher_)
+    return;
+  watcher_->OnFileCanWriteWithoutBlocking(fd);
+}
+
+MessagePumpEcore::MessagePumpEcore() {
+  int ret = ecore_init();
+  CHECK_GT(ret, 0);
+  wakeup_pipe_ = ecore_pipe_add(&OnWakeup, this);
 }
 
 MessagePumpEcore::~MessagePumpEcore() {
-  ecore_pipe_del(pipe_);
-  pipe_ = NULL;
+  DCHECK(!state_);
+  if (ecore_event_handler_) {
+    ecore_event_handler_del(ecore_event_handler_);
+    ecore_event_handler_ = nullptr;
+  }
+
+  if (wakeup_pipe_) {
+    ecore_pipe_del(wakeup_pipe_);
+    wakeup_pipe_ = nullptr;
+  }
+
+  if (delayed_work_timer_) {
+    ecore_timer_del(delayed_work_timer_);
+    delayed_work_timer_ = nullptr;
+  }
+
+  ecore_shutdown();
+}
+
+bool MessagePumpEcore::WatchFileDescriptor(int fd,
+                                           bool persistent,
+                                           int mode,
+                                           FdWatchController* controller,
+                                           FdWatcher* delegate) {
+  int flags = 0;
+  if (mode & WATCH_READ)
+    flags |= ECORE_FD_READ;
+  if (mode & WATCH_WRITE)
+    flags |= ECORE_FD_WRITE;
+
+  Ecore_Fd_Handler* fd_handler =
+      ecore_main_fd_handler_add(fd, static_cast<Ecore_Fd_Handler_Flags>(flags),
+                                OnFdHandlerEvent, controller, nullptr, nullptr);
+
+  if (!fd_handler) {
+    LOG(ERROR) << "ecore_main_fd_handler_add failed (fd = " << fd << ")";
+    return false;
+  }
+
+  controller->Init(fd_handler, persistent);
+  controller->set_watcher(delegate);
+  return true;
 }
 
 void MessagePumpEcore::Run(Delegate* delegate) {
@@ -47,29 +127,48 @@ void MessagePumpEcore::Run(Delegate* delegate) {
   RunState* previous_state = state_;
   state_ = &state;
 
-  bool more_work_is_plausible = true;
-  for (;;) {
-    bool block = !more_work_is_plausible;
+  if (!ecore_event_handler_) {
+    ecore_event_handler_ = ecore_event_handler_add(
+        ECORE_EVENT_SIGNAL_EXIT, MessagePumpEcore::OnEcoreEvent,
+        static_cast<void*>(this));
+  }
 
-    more_work_is_plausible = ecore_main_loop_iterate_may_block(block);
+  for (;;) {
+    bool more_work_is_plausible = ecore_main_loop_iterate_may_block(EINA_FALSE);
     if (state_->should_quit)
       break;
 
-#if !defined(EWK_BRINGUP)  // FIXME: m85 bringup
-    more_work_is_plausible |= state_->delegate->DoWork();
+    Delegate::NextWorkInfo next_work_info = state_->delegate->DoWork();
+    more_work_is_plausible |= next_work_info.is_immediate();
     if (state_->should_quit)
       break;
 
-    more_work_is_plausible |=
-        state_->delegate->DoDelayedWork(&delayed_work_time_);
-#endif
+    if (more_work_is_plausible)
+      continue;
+
+    more_work_is_plausible = state_->delegate->DoIdleWork();
     if (state_->should_quit)
       break;
 
     if (more_work_is_plausible)
       continue;
 
-    more_work_is_plausible = state_->delegate->DoIdleWork();
+    // Check for delayed work.
+    if (next_work_info.delayed_run_time.is_max()) {
+      ecore_main_loop_iterate_may_block(EINA_TRUE);
+    } else {
+      const TimeDelta delay = next_work_info.remaining_delay();
+      if (delay > TimeDelta()) {
+        delayed_work_timer_ =
+            ecore_timer_add(delay.InSecondsF(), &OnTimerFired, this);
+        ecore_main_loop_iterate_may_block(EINA_TRUE);
+        if (delayed_work_timer_) {
+          ecore_timer_del(delayed_work_timer_);
+          delayed_work_timer_ = nullptr;
+        }
+      }
+    }
+
     if (state_->should_quit)
       break;
   }
@@ -80,48 +179,71 @@ void MessagePumpEcore::Run(Delegate* delegate) {
 void MessagePumpEcore::Quit() {
   if (state_) {
     state_->should_quit = true;
+    ScheduleWork();
   } else {
     NOTREACHED() << "Quit called outside Run!";
   }
 }
 
 void MessagePumpEcore::ScheduleWork() {
-  {
-    base::AutoLock locker(schedule_work_lock_);
-    if (work_scheduled_)
-      return;
-    work_scheduled_ = true;
-  }
-
-  static const char msg[] = "!";
-  if (!ecore_pipe_write(pipe_, msg, sizeof(msg))) {
-    NOTREACHED() << "Could not write to the UI message loop wakeup pipe!";
-  }
+  if (!wakeup_pipe_)
+    return;
+  AutoLock lock(wakeup_pipe_lock_);
+  char msg = 'W';
+  if (!ecore_pipe_write(wakeup_pipe_, &msg, 1))
+    NOTREACHED() << "Could not write to the message loop wakeup pipe!";
 }
 
 void MessagePumpEcore::ScheduleDelayedWork(
-    const Delegate::NextWorkInfo& next_work_info) {
-  delayed_work_time_ = next_work_info.delayed_run_time;
-  ScheduleWork();
+    const Delegate::NextWorkInfo& next_work_info) {}
+
+Eina_Bool MessagePumpEcore::OnEcoreEvent(void* data, int ev_type, void* ev) {
+  auto* message_pump_ecore_instance = static_cast<MessagePumpEcore*>(data);
+  if (message_pump_ecore_instance) {
+    if (message_pump_ecore_instance->ecore_event_handler_) {
+      ecore_event_handler_del(
+          message_pump_ecore_instance->ecore_event_handler_);
+      message_pump_ecore_instance->ecore_event_handler_ = nullptr;
+    }
+    message_pump_ecore_instance->Quit();
+  }
+  return ECORE_CALLBACK_PASS_ON;
 }
 
-void MessagePumpEcore::HandleScheduledWork() {
-  {
-    base::AutoLock locker(schedule_work_lock_);
-    DCHECK(work_scheduled_);
-    work_scheduled_ = false;
-  }
+// static
+void MessagePumpEcore::OnWakeup(void* data, void* buffer, unsigned int nbyte) {}
 
-#if !defined(EWK_BRINGUP)  // FIXME: m85 bringup
-  if (state_->delegate->DoWork()) {
-    ScheduleWork();
-  }
+// static
+Eina_Bool MessagePumpEcore::OnTimerFired(void* data) {
+  static_cast<MessagePumpEcore*>(data)->delayed_work_timer_ = nullptr;
+  return ECORE_CALLBACK_CANCEL;
+}
 
-  if (state_->should_quit)
-    return;
+// static
+Eina_Bool MessagePumpEcore::OnFdHandlerEvent(void* data,
+                                             Ecore_Fd_Handler* fd_handler) {
+  FdWatchController* controller = static_cast<FdWatchController*>(data);
+
+  int fd = ecore_main_fd_handler_fd_get(fd_handler);
+  if (ecore_main_fd_handler_active_get(
+          fd_handler, static_cast<Ecore_Fd_Handler_Flags>(ECORE_FD_READ |
+                                                          ECORE_FD_WRITE))) {
+    // Both callbacks will be called. It is necessary to check that |controller|
+    // is not destroyed.
+    bool controller_was_destroyed = false;
+    controller->was_destroyed_ = &controller_was_destroyed;
+    controller->OnFileCanWriteWithoutBlocking(fd);
+    if (!controller_was_destroyed)
+      controller->OnFileCanReadWithoutBlocking(fd);
+    if (!controller_was_destroyed)
+      controller->was_destroyed_ = nullptr;
+  } else if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE)) {
+    controller->OnFileCanWriteWithoutBlocking(fd);
+  } else if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)) {
+    controller->OnFileCanReadWithoutBlocking(fd);
+  }
 
-  state_->delegate->DoDelayedWork(&delayed_work_time_);
-#endif
+  return controller->persistent_ ? ECORE_CALLBACK_RENEW : ECORE_CALLBACK_CANCEL;
 }
 
-} // namespace base
+}  // namespace base
index b0cce84..b8b233f 100644 (file)
@@ -3,45 +3,96 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_EFL_H_
-#define BASE_MESSAGE_LOOP_MESSAGE_PUMP_EFL_H_
+#ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_ECORE_H_
+#define BASE_MESSAGE_LOOP_MESSAGE_PUMP_ECORE_H_
 
 #include "base/base_export.h"
 #include "base/message_loop/message_pump.h"
+#include "base/message_loop/watchable_io_message_pump_posix.h"
+#include "base/synchronization/lock.h"
 
 #include <Ecore.h>
 
 namespace base {
 
-class TimeTicks;
-
-class BASE_EXPORT MessagePumpEcore : public MessagePump {
+class BASE_EXPORT MessagePumpEcore : public MessagePump,
+                                     public WatchableIOMessagePumpPosix {
  public:
+  class FdWatchController : public FdWatchControllerInterface {
+   public:
+    explicit FdWatchController(const Location& from_here);
+
+    FdWatchController(const FdWatchController&) = delete;
+    FdWatchController& operator=(const FdWatchController&) = delete;
+
+    // Implicitly calls StopWatchingFileDescriptor.
+    ~FdWatchController() override;
+
+    // FdWatchControllerInterface:
+    bool StopWatchingFileDescriptor() override;
+
+   private:
+    friend class MessagePumpEcore;
+
+    void Init(Ecore_Fd_Handler* fd_handler, bool persistent);
+
+    void set_watcher(FdWatcher* watcher) { watcher_ = watcher; }
+
+    void OnFileCanReadWithoutBlocking(int fd);
+    void OnFileCanWriteWithoutBlocking(int fd);
+
+    Ecore_Fd_Handler* fd_handler_ = nullptr;
+    FdWatcher* watcher_ = nullptr;
+    bool persistent_ = false;
+
+    // If this pointer is non-NULL, the pointee is set to true in the
+    // destructor.
+    bool* was_destroyed_ = nullptr;
+  };
+
   MessagePumpEcore();
+
+  MessagePumpEcore(const MessagePumpEcore&) = delete;
+  MessagePumpEcore& operator=(const MessagePumpEcore&) = delete;
+
   ~MessagePumpEcore() override;
 
+  bool WatchFileDescriptor(int fd,
+                           bool persistent,
+                           int mode,
+                           FdWatchController* controller,
+                           FdWatcher* delegate);
+
   void Run(Delegate* delegate) override;
   void Quit() override;
   void ScheduleWork() override;
   void ScheduleDelayedWork(
       const Delegate::NextWorkInfo& next_work_info) override;
 
-  void HandleScheduledWork();
-
  private:
+  static void OnWakeup(void* data, void* buffer, unsigned int nbyte);
+  static Eina_Bool OnTimerFired(void* data);
+  static Eina_Bool OnEcoreEvent(void* data, int ev_type, void* ev);
+  static Eina_Bool OnFdHandlerEvent(void* data, Ecore_Fd_Handler* fd_handler);
   // We may make recursive calls to Run, so we save state that needs to be
   // separate between them in this structure type.
   struct RunState;
-  RunState* state_;
+  RunState* state_ = nullptr;
+
+  // We use a wakeup pipe to make sure we'll get out of the ecore mainloop
+  // blocking phase when another thread has scheduled us to do some work.
+  Ecore_Pipe* wakeup_pipe_ = nullptr;
+
+  // The lock that protects access to wakeup pipe.
+  base::Lock wakeup_pipe_lock_;
 
-  // This is the time when we need to do delayed work.
-  TimeTicks delayed_work_time_;
+  // This is the timer that is needed to get out of ecore mainloop blocking
+  // phase after delay.
+  Ecore_Timer* delayed_work_timer_ = nullptr;
 
-  Ecore_Pipe* pipe_;
-  base::Lock schedule_work_lock_;
-  bool work_scheduled_;
+  Ecore_Event_Handler* ecore_event_handler_ = nullptr;
 };
 
 }  // namespace base
 
-#endif  // BASE_MESSAGE_LOOP_MESSAGE_PUMP_EFL_H_
+#endif  // BASE_MESSAGE_LOOP_MESSAGE_PUMP_ECORE_H_
index 8fa2964..258856f 100644 (file)
@@ -4,11 +4,11 @@
 
 #include "base/message_loop/message_pump_for_ui_efl.h"
 
+#include "base/base_switches.h"
 #include "base/command_line.h"
 #include "base/run_loop.h"
 #include "base/time/time.h"
 #include "cc/base/switches.h"
-#include "ewk/efl_integration/common/content_switches_efl.h"
 
 namespace base {
 
@@ -18,14 +18,10 @@ static const int dummy_pipe_message_size = 1;
 }  // namespace
 
 MessagePumpForUIEfl::MessagePumpForUIEfl()
-    : pipe_(ecore_pipe_add(&PipeCallback, this)),
-      schedule_delayed_work_timer_(NULL),
-      run_loop_(NULL),
-      keep_running_(true),
-      work_scheduled_(false) {}
+    : pipe_(ecore_pipe_add(&PipeCallback, this)) {}
 
 MessagePumpForUIEfl::~MessagePumpForUIEfl() {
-  base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
+  CommandLine* cmdline = CommandLine::ForCurrentProcess();
   if (!cmdline->HasSwitch(
           switches::kLimitMemoryAllocationInScheduleDelayedWork)) {
     for (std::unordered_set<TimerPair*>::iterator it = pending_timers_.begin();
@@ -42,7 +38,7 @@ MessagePumpForUIEfl::~MessagePumpForUIEfl() {
 }
 
 // FIXME: need to be implemented for tests.
-void MessagePumpForUIEfl::Run(base::MessagePump::Delegate* delegate) {
+void MessagePumpForUIEfl::Run(Delegate* delegate) {
   DCHECK(keep_running_) << "Quit must have been called outside of Run!";
 
   bool previous_keep_running = keep_running_;
@@ -70,22 +66,20 @@ void MessagePumpForUIEfl::Quit() {
   ecore_pipe_del(pipe_);
   if (schedule_delayed_work_timer_)
     ecore_timer_del(schedule_delayed_work_timer_);
-#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
   if (run_loop_) {
     DCHECK(run_loop_->running());
     run_loop_->AfterRun();
     delete run_loop_;
-    run_loop_ = NULL;
+    run_loop_ = nullptr;
   }
-#endif
-  pipe_ = NULL;
-  schedule_delayed_work_timer_ = NULL;
+  pipe_ = nullptr;
+  schedule_delayed_work_timer_ = nullptr;
   keep_running_ = false;
 }
 
 void MessagePumpForUIEfl::ScheduleWork() {
   {
-    base::AutoLock locker(schedule_work_lock_);
+    AutoLock locker(schedule_work_lock_);
     if (work_scheduled_)
       return;
     work_scheduled_ = true;
@@ -99,8 +93,8 @@ void MessagePumpForUIEfl::ScheduleWork() {
 
 void MessagePumpForUIEfl::ScheduleDelayedWork(
     const Delegate::NextWorkInfo& next_work_info) {
-  base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
-  base::TimeTicks now = base::TimeTicks::Now();
+  CommandLine* cmdline = CommandLine::ForCurrentProcess();
+  TimeTicks now = TimeTicks::Now();
   double delay = 0;
   if (next_work_info.delayed_run_time > now)
     delay = base::TimeDelta(next_work_info.delayed_run_time - now).InSecondsF();
@@ -128,7 +122,7 @@ void MessagePumpForUIEfl::PipeCallback(void* data, void*, unsigned int) {
 }
 
 Eina_Bool MessagePumpForUIEfl::TimerCallback(void* data) {
-  base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
+  CommandLine* cmdline = CommandLine::ForCurrentProcess();
   if (!cmdline->HasSwitch(
           switches::kLimitMemoryAllocationInScheduleDelayedWork)) {
     TimerPair* current_timer_pair = static_cast<TimerPair*>(data);
@@ -138,8 +132,8 @@ Eina_Bool MessagePumpForUIEfl::TimerCallback(void* data) {
   } else {
     MessagePumpForUIEfl* messagePumpForUIEfl =
         static_cast<MessagePumpForUIEfl*>(data);
+    messagePumpForUIEfl->schedule_delayed_work_timer_ = nullptr;
     messagePumpForUIEfl->DoDelayedWork();
-    messagePumpForUIEfl->schedule_delayed_work_timer_ = NULL;
   }
 
   return ECORE_CALLBACK_CANCEL;
@@ -147,7 +141,7 @@ Eina_Bool MessagePumpForUIEfl::TimerCallback(void* data) {
 
 void MessagePumpForUIEfl::DoWork() {
   {
-    base::AutoLock locker(schedule_work_lock_);
+    AutoLock locker(schedule_work_lock_);
     DCHECK(work_scheduled_);
     work_scheduled_ = false;
   }
index 5e75bcd..75e20bd 100644 (file)
@@ -19,9 +19,13 @@ class TimeTicks;
 class MessagePumpForUIEfl;
 typedef std::pair<MessagePumpForUIEfl*, Ecore_Timer*> TimerPair;
 
-class BASE_EXPORT MessagePumpForUIEfl : public base::MessagePump {
+class BASE_EXPORT MessagePumpForUIEfl : public MessagePump {
  public:
   MessagePumpForUIEfl();
+
+  MessagePumpForUIEfl(const MessagePumpForUIEfl&) = delete;
+  MessagePumpForUIEfl& operator=(const MessagePumpForUIEfl&) = delete;
+
   ~MessagePumpForUIEfl() override;
 
   void Run(Delegate*) override;
@@ -42,17 +46,15 @@ class BASE_EXPORT MessagePumpForUIEfl : public base::MessagePump {
   // limit-memory-allocation-in-schedule-delayed-work gets accepted.
   std::unordered_set<TimerPair*> pending_timers_;
   Ecore_Pipe* pipe_;
-  Ecore_Timer* schedule_delayed_work_timer_;
+  Ecore_Timer* schedule_delayed_work_timer_ = nullptr;
 
   // The MessagePump::Delegate for this pump.
   Delegate* delegate_ = nullptr;
 
-  RunLoop* run_loop_;
-  base::Lock schedule_work_lock_;
-  bool keep_running_;
-  bool work_scheduled_;
-
-  // DISALLOW_COPY_AND_ASSIGN(MessagePumpForUIEfl);
+  RunLoop* run_loop_ = nullptr;
+  Lock schedule_work_lock_;
+  bool keep_running_ = true;
+  bool work_scheduled_ = false;
 };
 
 }  // namespace base
index 97a86b1..8b7a5f2 100644 (file)
@@ -41,12 +41,14 @@ external_content_browser_extra_configs = [
 ]
 
 external_content_browser_deps = [
-  "//tizen_src/chromium_impl/efl:window-factory",
   "//tizen_src/chromium_impl/edje_resources:edje_resources_efl",
+  "//tizen_src/chromium_impl/efl:window-factory",
   "//ui/gl:gl",
 ]
 
 external_content_renderer_extra_configs = [
+  "//tizen_src/build:ecore",
+  "//tizen_src/build:libecore",
   "//tizen_src/build:tts",
   "//tizen_src/build:libtts",
 ]
diff --git a/tizen_src/chromium_impl/ui/ozone/BUILD.gn b/tizen_src/chromium_impl/ui/ozone/BUILD.gn
deleted file mode 100644 (file)
index ce31353..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (c) 2015 Samsung Electronics. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import("//tizen_src/build/config/tizen_features.gni")
-
-static_library("ozone_efl") {
-  deps = [
-    "//ui/ozone/common",
-  ]
-
-  if (use_wayland) {
-    configs += [
-      "//tizen_src/build:ecore-wayland",
-      "//tizen_src/build:libecore-wayland",
-    ]
-  } else {
-    configs += [
-      "//tizen_src/build:ecore-x",
-      "//tizen_src/build:libecore-x",
-    ]
-  }
-
-  sources = [
-    "client_native_pixmap_factory_efl.cc",
-    "client_native_pixmap_factory_efl.h",
-    "ozone_platform_efl.cc",
-    "ozone_platform_efl.h",
-    "surface_factory_efl.cc",
-    "surface_factory_efl.h",
-  ]
-  include_dirs = [ "//ui/ozone/public" ]
-}
diff --git a/tizen_src/chromium_impl/ui/ozone/ozone_extra.gni b/tizen_src/chromium_impl/ui/ozone/ozone_extra.gni
new file mode 100644 (file)
index 0000000..acbc4ad
--- /dev/null
@@ -0,0 +1,16 @@
+# Copyright 2021 Samsung Electronics. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+ozone_external_platforms = [ "efl" ]
+
+ozone_external_platform_deps =
+    [ "//tizen_src/chromium_impl/ui/ozone/platform/efl" ]
+
+ozone_external_platform_test_deps = []
+
+ozone_external_platform_integration_test_deps = []
+
+ozone_external_platform_ui_test_support_deps = []
+
+ozone_external_interactive_ui_tests_deps = []
diff --git a/tizen_src/chromium_impl/ui/ozone/ozone_platform_efl.cc b/tizen_src/chromium_impl/ui/ozone/ozone_platform_efl.cc
deleted file mode 100644 (file)
index 12e05c0..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) 2015 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/ozone/ozone_platform_efl.h"
-
-#include "ui/base/ime/input_method.h"
-#include "ui/display/types/native_display_delegate.h"
-#include "ui/ozone/public/gpu_platform_support_host.h"
-#include "ui/ozone/public/ozone_platform.h"
-#include "ui/ozone/public/platform_screen.h"
-#include "ui/ozone/public/system_input_injector.h"
-#include "ui/ozone/surface_factory_efl.h"
-#include "ui/platform_window/platform_window.h"
-#include "ui/platform_window/platform_window_init_properties.h"
-
-namespace ui {
-
-namespace {
-
-// OzonePlatform implementation for EFL.
-class OzonePlatformEfl : public OzonePlatform {
- public:
-  OzonePlatformEfl() = default;
-  ~OzonePlatformEfl() override = default;
-
-  // OzonePlatform:
-  SurfaceFactoryOzone* GetSurfaceFactoryOzone() override {
-    return surface_factory_.get();
-  }
-
-  OverlayManagerOzone* GetOverlayManager() override { return nullptr; }
-
-  CursorFactory* GetCursorFactory() override { return nullptr; }
-
-  InputController* GetInputController() override { return nullptr; }
-
-  GpuPlatformSupportHost* GetGpuPlatformSupportHost() override {
-    return gpu_platform_host_.get();
-  }
-
-  std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override {
-    return nullptr;
-  }
-
-  std::unique_ptr<PlatformWindow> CreatePlatformWindow(
-      PlatformWindowDelegate* /*delegate*/,
-      PlatformWindowInitProperties /*properties*/) override {
-    return nullptr;
-  }
-
-  std::unique_ptr<display::NativeDisplayDelegate> CreateNativeDisplayDelegate()
-      override {
-    return nullptr;
-  }
-
-  std::unique_ptr<InputMethod> CreateInputMethod(
-      ImeKeyEventDispatcher* ime_key_event_dispatcher,
-      gfx::AcceleratedWidget widget) override {
-    return nullptr;
-  }
-
-  std::unique_ptr<PlatformScreen> CreateScreen() override { return nullptr; }
-  void InitScreen(PlatformScreen* screen) override {}
-
- private:
-  bool InitializeUI(const InitParams& /*params*/) override {
-    gpu_platform_host_.reset(CreateStubGpuPlatformSupportHost());
-    return true;
-  }
-
-  void InitializeGPU(const InitParams& /*params*/) override {
-    surface_factory_.reset(new SurfaceFactoryEfl());
-  }
-
-  std::unique_ptr<SurfaceFactoryEfl> surface_factory_;
-  std::unique_ptr<GpuPlatformSupportHost> gpu_platform_host_;
-
-  // DISALLOW_COPY_AND_ASSIGN(OzonePlatformEfl);
-};
-
-}  // namespace
-
-OzonePlatform* CreateOzonePlatformEfl() {
-  return new OzonePlatformEfl;
-}
-
-}  // namespace ui
diff --git a/tizen_src/chromium_impl/ui/ozone/platform/efl/BUILD.gn b/tizen_src/chromium_impl/ui/ozone/platform/efl/BUILD.gn
new file mode 100644 (file)
index 0000000..b7af927
--- /dev/null
@@ -0,0 +1,64 @@
+# Copyright 2021 Samsung Electronics. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//tizen_src/build/config/tizen_features.gni")
+
+visibility = [ "//ui/ozone/*" ]
+
+source_set("efl") {
+  sources = [
+    "client_native_pixmap_factory_efl.cc",
+    "client_native_pixmap_factory_efl.h",
+    "efl_screen.cc",
+    "efl_screen.h",
+    "efl_surface_factory.cc",
+    "efl_surface_factory.h",
+    "efl_window.cc",
+    "efl_window.h",
+    "ozone_platform_efl.cc",
+    "ozone_platform_efl.h",
+  ]
+
+  deps = [
+    "//base",
+    "//mojo/public/cpp/bindings",
+    "//mojo/public/cpp/system",
+    "//skia",
+    "//tizen_src/chromium_impl/tizen:system-info",
+    "//ui/base",
+    "//ui/base:buildflags",
+    "//ui/base/cursor",
+    "//ui/base/ime/linux",
+    "//ui/events",
+    "//ui/events:dom_keycode_converter",
+    "//ui/events/ozone",
+    "//ui/events/ozone/layout",
+    "//ui/events/platform",
+    "//ui/gfx",
+    "//ui/gfx:memory_buffer",
+    "//ui/gfx/geometry",
+    "//ui/ozone:ozone_base",
+    "//ui/ozone/common",
+    "//ui/platform_window",
+  ]
+
+  configs += [
+    "//tizen_src/build:ecore-evas",
+    "//tizen_src/build:libecore-evas",
+  ]
+
+  if (use_wayland) {
+    configs += [
+      "//tizen_src/build:ecore-wayland",
+      "//tizen_src/build:libecore-wayland",
+    ]
+  } else {
+    configs += [
+      "//tizen_src/build:ecore-x",
+      "//tizen_src/build:libecore-x",
+    ]
+  }
+
+  defines = [ "OZONE_IMPLEMENTATION" ]
+}
@@ -1,8 +1,8 @@
-// Copyright (c) 2015 Samsung Electronics. All rights reserved.
+// Copyright (c) 2021 Samsung Electronics. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "ui/ozone/client_native_pixmap_factory_efl.h"
+#include "ui/ozone/platform/efl/client_native_pixmap_factory_efl.h"
 
 #include "ui/ozone/common/stub_client_native_pixmap_factory.h"
 
@@ -1,9 +1,9 @@
-// Copyright (c) 2015 Samsung Electronics. All rights reserved.
+// Copyright (c) 2021 Samsung Electronics. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef UI_OZONE_CLIENT_NATIVE_PIXMAP_FACTORY_EFL_H_
-#define UI_OZONE_CLIENT_NATIVE_PIXMAP_FACTORY_EFL_H_
+#ifndef UI_OZONE_PLATFORM_EFL_CLIENT_NATIVE_PIXMAP_FACTORY_EFL_H_
+#define UI_OZONE_PLATFORM_EFL_CLIENT_NATIVE_PIXMAP_FACTORY_EFL_H_
 
 namespace gfx {
 class ClientNativePixmapFactory;
@@ -16,4 +16,4 @@ gfx::ClientNativePixmapFactory* CreateClientNativePixmapFactoryEfl();
 
 }  // namespace ui
 
-#endif  // UI_OZONE_CLIENT_NATIVE_PIXMAP_FACTORY_EFL_H_
+#endif  // UI_OZONE_PLATFORM_EFL_CLIENT_NATIVE_PIXMAP_FACTORY_EFL_H_
diff --git a/tizen_src/chromium_impl/ui/ozone/platform/efl/efl_screen.cc b/tizen_src/chromium_impl/ui/ozone/platform/efl/efl_screen.cc
new file mode 100644 (file)
index 0000000..f6aed36
--- /dev/null
@@ -0,0 +1,92 @@
+// Copyright 2021 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/ozone/platform/efl/efl_screen.h"
+
+#include "base/logging.h"
+#include "base/stl_util.h"
+#include "ecore_wrapper/ecore_x_wayland_wrapper.h"
+#include "tizen/system_info.h"
+#include "ui/display/display.h"
+#include "ui/display/display_finder.h"
+#include "ui/display/display_observer.h"
+#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/native_widget_types.h"
+
+namespace ui {
+
+EflScreen::EflScreen() {
+  int width = 0, height = 0;
+#if defined(USE_WAYLAND)
+  Ecore_Wl2_Display* wl2_display = ecore_wl2_connected_display_get(nullptr);
+  ecore_wl2_display_screen_size_get(wl2_display, &width, &height);
+#else
+  ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height);
+#endif
+  display::Display display(0);
+  display.set_bounds(gfx::Rect(width, height));
+  display_list_.AddDisplay(display, display::DisplayList::Type::PRIMARY);
+}
+
+EflScreen::~EflScreen() = default;
+
+const std::vector<display::Display>& EflScreen::GetAllDisplays() const {
+  return display_list_.displays();
+}
+
+display::Display EflScreen::GetPrimaryDisplay() const {
+  auto iter = display_list_.GetPrimaryDisplayIterator();
+  DCHECK(iter != display_list_.displays().end());
+  return *iter;
+}
+
+display::Display EflScreen::GetDisplayForAcceleratedWidget(
+    gfx::AcceleratedWidget widget) const {
+  NOTIMPLEMENTED();
+  return GetPrimaryDisplay();
+}
+
+gfx::Point EflScreen::GetCursorScreenPoint() const {
+  NOTIMPLEMENTED();
+  return {};
+}
+
+gfx::AcceleratedWidget EflScreen::GetAcceleratedWidgetAtScreenPoint(
+    const gfx::Point& point) const {
+  NOTIMPLEMENTED();
+  return gfx::kNullAcceleratedWidget;
+}
+
+gfx::AcceleratedWidget EflScreen::GetLocalProcessWidgetAtPoint(
+    const gfx::Point& point,
+    const std::set<gfx::AcceleratedWidget>& ignore) const {
+  NOTIMPLEMENTED();
+  return gfx::kNullAcceleratedWidget;
+}
+
+display::Display EflScreen::GetDisplayNearestPoint(
+    const gfx::Point& point) const {
+  return *display::FindDisplayNearestPoint(display_list_.displays(), point);
+}
+
+display::Display EflScreen::GetDisplayMatching(
+    const gfx::Rect& match_rect) const {
+  if (match_rect.IsEmpty())
+    return GetDisplayNearestPoint(match_rect.origin());
+
+  const display::Display* display_matching =
+      display::FindDisplayWithBiggestIntersection(display_list_.displays(),
+                                                  match_rect);
+  return display_matching ? *display_matching : GetPrimaryDisplay();
+}
+
+void EflScreen::AddObserver(display::DisplayObserver* observer) {
+  display_list_.AddObserver(observer);
+}
+
+void EflScreen::RemoveObserver(display::DisplayObserver* observer) {
+  display_list_.RemoveObserver(observer);
+}
+
+}  // namespace ui
diff --git a/tizen_src/chromium_impl/ui/ozone/platform/efl/efl_screen.h b/tizen_src/chromium_impl/ui/ozone/platform/efl/efl_screen.h
new file mode 100644 (file)
index 0000000..ebfabd7
--- /dev/null
@@ -0,0 +1,54 @@
+// Copyright 2021 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_OZONE_PLATFORM_EFL_EFL_SCREEN_H_
+#define UI_OZONE_PLATFORM_EFL_EFL_SCREEN_H_
+
+#include <set>
+#include <vector>
+
+#include "base/observer_list.h"
+#include "ui/display/display_list.h"
+#include "ui/gfx/geometry/point.h"
+#include "ui/ozone/public/platform_screen.h"
+
+namespace ui {
+
+// A PlatformScreen implementation for EFL.
+class EflScreen : public PlatformScreen {
+ public:
+  EflScreen();
+
+  EflScreen(const EflScreen&) = delete;
+  EflScreen& operator=(const EflScreen&) = delete;
+
+  ~EflScreen() override;
+
+  // PlatformScreen overrides:
+  const std::vector<display::Display>& GetAllDisplays() const override;
+  display::Display GetPrimaryDisplay() const override;
+  display::Display GetDisplayForAcceleratedWidget(
+      gfx::AcceleratedWidget widget) const override;
+  gfx::Point GetCursorScreenPoint() const override;
+  gfx::AcceleratedWidget GetAcceleratedWidgetAtScreenPoint(
+      const gfx::Point& point) const override;
+  gfx::AcceleratedWidget GetLocalProcessWidgetAtPoint(
+      const gfx::Point& point,
+      const std::set<gfx::AcceleratedWidget>& ignore) const override;
+  display::Display GetDisplayNearestPoint(
+      const gfx::Point& point) const override;
+  display::Display GetDisplayMatching(
+      const gfx::Rect& match_rect) const override;
+  void AddObserver(display::DisplayObserver* observer) override;
+  void RemoveObserver(display::DisplayObserver* observer) override;
+
+ private:
+  display::DisplayList display_list_;
+
+  base::ObserverList<display::DisplayObserver> observers_;
+};
+
+}  // namespace ui
+
+#endif  // UI_OZONE_PLATFORM_EFL_EFL_SCREEN_H_
diff --git a/tizen_src/chromium_impl/ui/ozone/platform/efl/efl_surface_factory.cc b/tizen_src/chromium_impl/ui/ozone/platform/efl/efl_surface_factory.cc
new file mode 100644 (file)
index 0000000..d164e8d
--- /dev/null
@@ -0,0 +1,138 @@
+// Copyright (c) 2021 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/ozone/platform/efl/efl_surface_factory.h"
+
+#include "base/memory/ptr_util.h"
+#include "ecore_wrapper/ecore_x_wayland_wrapper.h"
+#include "third_party/skia/include/core/SkSurface.h"
+#include "ui/gfx/vsync_provider.h"
+#include "ui/gl/gl_surface_egl.h"
+#include "ui/gl/gl_surface_stub.h"
+#include "ui/ozone/common/egl_util.h"
+#include "ui/ozone/common/gl_ozone_egl.h"
+#include "ui/ozone/public/surface_ozone_canvas.h"
+
+namespace ui {
+
+namespace {
+
+class GLOzoneEGLEfl : public GLOzoneEGL {
+ public:
+  GLOzoneEGLEfl() = default;
+
+  GLOzoneEGLEfl(const GLOzoneEGLEfl&) = delete;
+  GLOzoneEGLEfl& operator=(const GLOzoneEGLEfl&) = delete;
+
+  ~GLOzoneEGLEfl() override = default;
+
+  scoped_refptr<gl::GLSurface> CreateViewGLSurface(
+      gl::GLDisplay* display,
+      gfx::AcceleratedWidget window) override {
+    if (gl::GetGLImplementation() != gl::kGLImplementationEGLGLES2)
+      return nullptr;
+
+    if (window != gfx::kNullAcceleratedWidget) {
+      return gl::InitializeGLSurface(new gl::NativeViewGLSurfaceEGL(
+          display->GetAs<gl::GLDisplayEGL>(), window, nullptr));
+    } else {
+      return gl::InitializeGLSurface(new gl::GLSurfaceStub());
+    }
+  }
+
+  scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface(
+      gl::GLDisplay* display,
+      const gfx::Size& size) override {
+    gl::GLDisplayEGL* egl_display = display->GetAs<gl::GLDisplayEGL>();
+    if (egl_display->IsEGLSurfacelessContextSupported() && size.width() == 0 &&
+        size.height() == 0) {
+      return gl::InitializeGLSurface(new gl::SurfacelessEGL(egl_display, size));
+    } else {
+      return gl::InitializeGLSurface(
+          new gl::PbufferGLSurfaceEGL(egl_display, size));
+    }
+  }
+
+ protected:
+  gl::EGLDisplayPlatform GetNativeDisplay() override {
+#if defined(USE_WAYLAND)
+    Ecore_Wl2_Display* wl2_display = ecore_wl2_connected_display_get(nullptr);
+    return gl::EGLDisplayPlatform(reinterpret_cast<EGLNativeDisplayType>(
+        ecore_wl2_display_get(wl2_display)));
+#else
+    return gl::EGLDisplayPlatform(
+        reinterpret_cast<EGLNativeDisplayType>(ecore_x_display_get()));
+#endif
+  }
+
+  bool LoadGLES2Bindings(
+      const gl::GLImplementationParts& implementation) override {
+    return LoadDefaultEGLGLES2Bindings(implementation);
+  }
+};
+
+class EflSurfaceCanvas : public SurfaceOzoneCanvas {
+ public:
+  EflSurfaceCanvas() = default;
+
+  EflSurfaceCanvas(const EflSurfaceCanvas&) = delete;
+  EflSurfaceCanvas& operator=(const EflSurfaceCanvas&) = delete;
+
+  ~EflSurfaceCanvas() override = default;
+
+  // SurfaceOzoneCanvas implementation:
+  SkCanvas* GetCanvas() override { return surface_->getCanvas(); }
+
+  void ResizeCanvas(const gfx::Size& viewport_size, float scale) override {
+    SkImageInfo info =
+        SkImageInfo::Make(viewport_size.width(), viewport_size.height(),
+                          kBGRA_8888_SkColorType, kOpaque_SkAlphaType);
+    surface_ = SkSurface::MakeRaster(info);
+  }
+
+  void PresentCanvas(const gfx::Rect& damage) override {
+    // TODO: Implement this method to show/render canvas contents by creating
+    // evas image from SkBitmap.
+    NOTIMPLEMENTED();
+  }
+
+  std::unique_ptr<gfx::VSyncProvider> CreateVSyncProvider() override {
+    return nullptr;
+  }
+
+ private:
+  sk_sp<SkSurface> surface_;
+};
+
+}  // namespace
+
+EflSurfaceFactory::EflSurfaceFactory()
+    : egl_implementation_(std::make_unique<GLOzoneEGLEfl>()) {}
+
+std::vector<gl::GLImplementationParts>
+EflSurfaceFactory::GetAllowedGLImplementations() {
+  std::vector<gl::GLImplementationParts> impls;
+  if (egl_implementation_) {
+    impls.emplace_back(
+        gl::GLImplementationParts(gl::kGLImplementationEGLGLES2));
+  }
+  return impls;
+}
+
+GLOzone* EflSurfaceFactory::GetGLOzone(
+    const gl::GLImplementationParts& implementation) {
+  switch (implementation.gl) {
+    case gl::kGLImplementationEGLGLES2:
+      return egl_implementation_.get();
+    default:
+      return nullptr;
+  }
+}
+
+std::unique_ptr<SurfaceOzoneCanvas> EflSurfaceFactory::CreateCanvasForWidget(
+    gfx::AcceleratedWidget widget) {
+  return base::WrapUnique(new EflSurfaceCanvas());
+}
+
+}  // namespace ui
diff --git a/tizen_src/chromium_impl/ui/ozone/platform/efl/efl_surface_factory.h b/tizen_src/chromium_impl/ui/ozone/platform/efl/efl_surface_factory.h
new file mode 100644 (file)
index 0000000..c057ed2
--- /dev/null
@@ -0,0 +1,37 @@
+// Copyright (c) 2021 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_OZONE_PLATFORM_EFL_EFL_SURFACE_FACTORY_
+#define UI_OZONE_PLATFORM_EFL_EFL_SURFACE_FACTORY_
+
+#include <memory>
+#include <vector>
+
+#include "ui/ozone/public/surface_factory_ozone.h"
+
+namespace ui {
+
+// SurfaceFactoryOzone implementation for EFL.
+class EflSurfaceFactory : public SurfaceFactoryOzone {
+ public:
+  EflSurfaceFactory();
+
+  EflSurfaceFactory(const EflSurfaceFactory&) = delete;
+  EflSurfaceFactory& operator=(const EflSurfaceFactory&) = delete;
+
+  ~EflSurfaceFactory() override = default;
+
+  // SurfaceFactoryOzone overrides:
+  std::vector<gl::GLImplementationParts> GetAllowedGLImplementations() override;
+  GLOzone* GetGLOzone(const gl::GLImplementationParts& implementation) override;
+  std::unique_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget(
+      gfx::AcceleratedWidget widget) override;
+
+ private:
+  std::unique_ptr<GLOzone> egl_implementation_;
+};
+
+}  // namespace ui
+
+#endif  // UI_OZONE_PLATFORM_EFL_EFL_SURFACE_FACTORY_
diff --git a/tizen_src/chromium_impl/ui/ozone/platform/efl/efl_window.cc b/tizen_src/chromium_impl/ui/ozone/platform/efl/efl_window.cc
new file mode 100644 (file)
index 0000000..09929e0
--- /dev/null
@@ -0,0 +1,220 @@
+// Copyright 2021 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/ozone/platform/efl/efl_window.h"
+
+#include "base/logging.h"
+#include "base/memory/scoped_refptr.h"
+#include "base/notreached.h"
+#include "ui/base/cursor/platform_cursor.h"
+
+namespace ui {
+
+EflWindow::EflWindow(PlatformWindowDelegate* delegate,
+                     PlatformWindowInitProperties properties)
+    : delegate_(delegate) {
+  Initialize(properties);
+}
+
+EflWindow::~EflWindow() {
+#if defined(USE_WAYLAND)
+  if (wl2_egl_window_) {
+    ecore_wl2_egl_window_destroy(wl2_egl_window_);
+    wl2_egl_window_ = nullptr;
+  }
+#endif
+  if (ee_)
+    ecore_evas_free(ee_);
+}
+
+void EflWindow::Show(bool inactive) {
+  ecore_evas_show(ee_);
+}
+
+void EflWindow::Hide() {
+  ecore_evas_hide(ee_);
+}
+
+void EflWindow::Close() {
+  delegate_->OnClosed();
+}
+
+bool EflWindow::IsVisible() const {
+  NOTIMPLEMENTED();
+  return false;
+}
+
+void EflWindow::PrepareForShutdown() {
+  NOTIMPLEMENTED();
+}
+
+void EflWindow::SetBoundsInPixels(const gfx::Rect& bounds) {
+#if defined(USE_WAYLAND)
+  ecore_wl2_egl_window_resize_with_rotation(wl2_egl_window_, bounds.x(),
+                                            bounds.y(), bounds.width(),
+                                            bounds.height(), 0);
+#else
+  ecore_evas_resize(ee_, bounds.width(), bounds.height());
+#endif
+  bool origin_changed = bounds_.origin() != bounds.origin();
+  bounds_ = bounds;
+  delegate_->OnBoundsChanged({origin_changed});
+}
+
+gfx::Rect EflWindow::GetBoundsInPixels() const {
+  return bounds_;
+}
+
+void EflWindow::SetBoundsInDIP(const gfx::Rect& bounds) {
+  SetBoundsInPixels(delegate_->ConvertRectToPixels(bounds));
+}
+
+gfx::Rect EflWindow::GetBoundsInDIP() const {
+  return delegate_->ConvertRectToDIP(bounds_);
+}
+
+void EflWindow::SetTitle(const std::u16string& title) {
+  NOTIMPLEMENTED();
+}
+
+void EflWindow::SetCapture() {
+  NOTIMPLEMENTED();
+}
+
+void EflWindow::ReleaseCapture() {
+  NOTIMPLEMENTED();
+}
+
+bool EflWindow::HasCapture() const {
+  NOTIMPLEMENTED();
+  return false;
+}
+
+void EflWindow::ToggleFullscreen() {
+  NOTIMPLEMENTED();
+}
+
+void EflWindow::Maximize() {
+  NOTIMPLEMENTED();
+}
+
+void EflWindow::Minimize() {
+  NOTIMPLEMENTED();
+}
+
+void EflWindow::Restore() {
+  NOTIMPLEMENTED();
+}
+
+PlatformWindowState EflWindow::GetPlatformWindowState() const {
+  NOTIMPLEMENTED();
+  return PlatformWindowState::kNormal;
+}
+
+void EflWindow::Activate() {
+  NOTIMPLEMENTED();
+}
+
+void EflWindow::Deactivate() {
+  NOTIMPLEMENTED();
+}
+
+void EflWindow::SetUseNativeFrame(bool use_native_frame) {
+  NOTIMPLEMENTED();
+}
+
+bool EflWindow::ShouldUseNativeFrame() const {
+  NOTIMPLEMENTED();
+  return false;
+}
+
+void EflWindow::SetCursor(scoped_refptr<PlatformCursor> cursor) {
+  NOTIMPLEMENTED();
+}
+
+void EflWindow::MoveCursorTo(const gfx::Point& location) {
+  NOTIMPLEMENTED();
+}
+
+void EflWindow::ConfineCursorToBounds(const gfx::Rect& bounds) {
+  NOTIMPLEMENTED();
+}
+
+void EflWindow::SetRestoredBoundsInDIP(const gfx::Rect& bounds) {
+  restored_bounds_ = delegate_->ConvertRectToPixels(bounds);
+}
+
+gfx::Rect EflWindow::GetRestoredBoundsInDIP() const {
+  return delegate_->ConvertRectToDIP(restored_bounds_);
+}
+
+void EflWindow::SetWindowIcons(const gfx::ImageSkia& window_icon,
+                               const gfx::ImageSkia& app_icon) {
+  NOTIMPLEMENTED();
+}
+
+void EflWindow::SizeConstraintsChanged() {
+  NOTIMPLEMENTED();
+}
+
+bool EflWindow::CanDispatchEvent(const PlatformEvent& event) {
+  NOTIMPLEMENTED();
+  return false;
+}
+
+uint32_t EflWindow::DispatchEvent(const PlatformEvent& event) {
+  NOTIMPLEMENTED();
+  return POST_DISPATCH_NONE;
+}
+
+bool EflWindow::Initialize(const PlatformWindowInitProperties& properties) {
+  bounds_ = properties.bounds;
+  opacity_ = properties.opacity;
+  type_ = properties.type;
+
+  ecore_evas_init();
+
+#if defined(USE_WAYLAND)
+  ee_ = ecore_evas_new("wayland_egl", 0, 0, bounds_.width(), bounds_.height(),
+                       nullptr);
+#else
+  ee_ = ecore_evas_new("opengl_x11", 0, 0, bounds_.width(), bounds_.height(),
+                       nullptr);
+#endif
+
+  if (!ee_) {
+    LOG(ERROR) << "Failed to create ecore evas.";
+    return false;
+  }
+
+#if defined(USE_WAYLAND)
+  Ecore_Wl2_Window* ww = ecore_evas_wayland2_window_get(ee_);
+  if (!ww) {
+    LOG(ERROR) << "Failed to get Wl2 window";
+    return false;
+  }
+
+  wl2_egl_window_ =
+      ecore_wl2_egl_window_create(ww, bounds_.width(), bounds_.height());
+  if (!wl2_egl_window_) {
+    LOG(ERROR) << "Failed to create wl2 egl window";
+    return false;
+  }
+
+  void* egl_window = ecore_wl2_egl_window_native_get(wl2_egl_window_);
+  if (!egl_window) {
+    LOG(ERROR) << "Failed to get native egl window";
+    return false;
+  }
+
+  delegate_->OnAcceleratedWidgetAvailable(
+      reinterpret_cast<gfx::AcceleratedWidget>(egl_window));
+#else
+  delegate_->OnAcceleratedWidgetAvailable(ecore_evas_window_get(ee_));
+#endif
+
+  return true;
+}
+
+}  // namespace ui
diff --git a/tizen_src/chromium_impl/ui/ozone/platform/efl/efl_window.h b/tizen_src/chromium_impl/ui/ozone/platform/efl/efl_window.h
new file mode 100644 (file)
index 0000000..192ddf7
--- /dev/null
@@ -0,0 +1,93 @@
+// Copyright 2021 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_OZONE_PLATFORM_EFL_EFL_WINDOW_H_
+#define UI_OZONE_PLATFORM_EFL_EFL_WINDOW_H_
+
+#include "ui/events/platform/platform_event_dispatcher.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/platform_window/platform_window.h"
+#include "ui/platform_window/platform_window_delegate.h"
+#include "ui/platform_window/platform_window_init_properties.h"
+
+#include <Ecore_Evas.h>
+
+#if defined(USE_WAYLAND)
+#include <Ecore_Wl2.h>
+#endif
+
+namespace ui {
+
+class EflWindow : public PlatformWindow, public PlatformEventDispatcher {
+ public:
+  EflWindow(PlatformWindowDelegate* delegate,
+            PlatformWindowInitProperties properties);
+
+  EflWindow(const EflWindow&) = delete;
+  EflWindow& operator=(const EflWindow&) = delete;
+
+  ~EflWindow() override;
+
+  // PlatformWindow implementation.
+  void Show(bool inactive = false) override;
+  void Hide() override;
+  void Close() override;
+  bool IsVisible() const override;
+  void PrepareForShutdown() override;
+  void SetBoundsInPixels(const gfx::Rect& bounds) override;
+  gfx::Rect GetBoundsInPixels() const override;
+  void SetBoundsInDIP(const gfx::Rect& bounds) override;
+  gfx::Rect GetBoundsInDIP() const override;
+  void SetTitle(const std::u16string& title) override;
+  void SetCapture() override;
+  void ReleaseCapture() override;
+  bool HasCapture() const override;
+  void ToggleFullscreen() override;
+  void Maximize() override;
+  void Minimize() override;
+  void Restore() override;
+  PlatformWindowState GetPlatformWindowState() const override;
+  void Activate() override;
+  void Deactivate() override;
+  void SetUseNativeFrame(bool use_native_frame) override;
+  bool ShouldUseNativeFrame() const override;
+  void SetCursor(scoped_refptr<PlatformCursor> cursor) override;
+  void MoveCursorTo(const gfx::Point& location) override;
+  void ConfineCursorToBounds(const gfx::Rect& bounds) override;
+  void SetRestoredBoundsInDIP(const gfx::Rect& bounds) override;
+  gfx::Rect GetRestoredBoundsInDIP() const override;
+  void SetWindowIcons(const gfx::ImageSkia& window_icon,
+                      const gfx::ImageSkia& app_icon) override;
+  void SizeConstraintsChanged() override;
+
+  // PlatformEventDispatcher implementation.
+  bool CanDispatchEvent(const PlatformEvent& event) override;
+  uint32_t DispatchEvent(const PlatformEvent& event) override;
+
+ private:
+  bool Initialize(const PlatformWindowInitProperties& properties);
+
+  PlatformWindowDelegate* delegate_;
+
+  // Current bounds of the platform window.
+  gfx::Rect bounds_;
+  // The bounds of the platform window before it went maximized or fullscreen.
+  gfx::Rect restored_bounds_;
+
+  // Stores current opacity of the window. Set on ::Initialize call.
+  ui::PlatformWindowOpacity opacity_;
+
+  // The type of the current WaylandWindow object.
+  ui::PlatformWindowType type_ = ui::PlatformWindowType::kWindow;
+
+  Ecore_Evas* ee_ = nullptr;
+
+#if defined(USE_WAYLAND)
+  Ecore_Wl2_Egl_Window* wl2_egl_window_ = nullptr;
+#endif
+};
+
+}  // namespace ui
+
+#endif  // UI_OZONE_PLATFORM_EFL_EFL_WINDOW_H_
diff --git a/tizen_src/chromium_impl/ui/ozone/platform/efl/ozone_platform_efl.cc b/tizen_src/chromium_impl/ui/ozone/platform/efl/ozone_platform_efl.cc
new file mode 100644 (file)
index 0000000..cffb56f
--- /dev/null
@@ -0,0 +1,162 @@
+// Copyright 2021 nclude "ui/display/types/native_display_delegate.h"    Samsung
+// Electronics. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "ui/ozone/platform/efl/ozone_platform_efl.h"
+
+#include <memory>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "base/bind.h"
+#include "base/memory/ptr_util.h"
+#include "base/message_loop/message_pump_type.h"
+#include "base/no_destructor.h"
+#include "ecore_wrapper/ecore_x_wayland_wrapper.h"
+#include "ui/base/buildflags.h"
+#include "ui/base/cursor/cursor_factory.h"
+#include "ui/base/ime/linux/input_method_auralinux.h"
+#include "ui/base/ime/linux/linux_input_method_context_factory.h"
+#include "ui/display/types/native_display_delegate.h"
+#include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
+#include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h"
+#include "ui/gfx/native_widget_types.h"
+#include "ui/ozone/common/bitmap_cursor_factory.h"
+#include "ui/ozone/common/stub_overlay_manager.h"
+#include "ui/ozone/platform/efl/efl_screen.h"
+#include "ui/ozone/platform/efl/efl_surface_factory.h"
+#include "ui/ozone/platform/efl/efl_window.h"
+#include "ui/ozone/public/gpu_platform_support_host.h"
+#include "ui/ozone/public/input_controller.h"
+#include "ui/ozone/public/ozone_platform.h"
+#include "ui/ozone/public/system_input_injector.h"
+#include "ui/platform_window/platform_window_init_properties.h"
+
+namespace ui {
+
+namespace {
+
+class OzonePlatformEfl : public OzonePlatform {
+ public:
+  OzonePlatformEfl() = default;
+
+  OzonePlatformEfl(const OzonePlatformEfl&) = delete;
+  OzonePlatformEfl& operator=(const OzonePlatformEfl&) = delete;
+
+  ~OzonePlatformEfl() override = default;
+
+  // OzonePlatform
+  SurfaceFactoryOzone* GetSurfaceFactoryOzone() override {
+    return surface_factory_.get();
+  }
+
+  OverlayManagerOzone* GetOverlayManager() override {
+    NOTIMPLEMENTED();
+    return overlay_manager_.get();
+  }
+
+  CursorFactory* GetCursorFactory() override { return cursor_factory_.get(); }
+
+  InputController* GetInputController() override {
+    NOTIMPLEMENTED();
+    return input_controller_.get();
+  }
+
+  GpuPlatformSupportHost* GetGpuPlatformSupportHost() override {
+    return gpu_platform_support_host_.get();
+  }
+
+  std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override {
+    NOTIMPLEMENTED();
+    return nullptr;
+  }
+
+  std::unique_ptr<PlatformWindow> CreatePlatformWindow(
+      PlatformWindowDelegate* delegate,
+      PlatformWindowInitProperties properties) override {
+    return std::make_unique<EflWindow>(delegate, std::move(properties));
+  }
+
+  std::unique_ptr<display::NativeDisplayDelegate> CreateNativeDisplayDelegate()
+      override {
+    NOTIMPLEMENTED();
+    return nullptr;
+  }
+
+  std::unique_ptr<PlatformScreen> CreateScreen() override {
+    return std::make_unique<EflScreen>();
+  }
+
+  void InitScreen(PlatformScreen* screen) override {}
+
+  PlatformClipboard* GetPlatformClipboard() override {
+    NOTIMPLEMENTED();
+    return nullptr;
+  }
+
+  std::unique_ptr<InputMethod> CreateInputMethod(
+      ImeKeyEventDispatcher* ime_key_event_dispatcher,
+      gfx::AcceleratedWidget widget) override {
+    return std::make_unique<InputMethodAuraLinux>(ime_key_event_dispatcher);
+  }
+
+  bool InitializeUI(const InitParams& args) override {
+#if defined(USE_WAYLAND)
+    if (ecore_wl2_init()) {
+      Ecore_Wl2_Display* wl2_display = ecore_wl2_display_connect(nullptr);
+      if (!wl2_display) {
+        LOG(ERROR) << "Failed to connect to ecore-wl2 display.";
+      }
+    } else {
+      LOG(ERROR) << "Failed to initialize ecore-wl2.";
+    }
+#else
+    if (!ecore_x_init(nullptr))
+      LOG(ERROR) << "Failed to initialize ecore-x.";
+#endif
+
+    keyboard_layout_engine_ = std::make_unique<StubKeyboardLayoutEngine>();
+    KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(
+        keyboard_layout_engine_.get());
+
+    cursor_factory_ = std::make_unique<BitmapCursorFactory>();
+    overlay_manager_ = std::make_unique<StubOverlayManager>();
+    input_controller_ = CreateStubInputController();
+    gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
+
+    return true;
+  }
+
+  void InitializeGPU(const InitParams& args) override {
+    surface_factory_ = std::make_unique<EflSurfaceFactory>();
+  }
+
+  const PlatformProperties& GetPlatformProperties() override {
+    static base::NoDestructor<OzonePlatform::PlatformProperties> properties;
+    static bool initialised = false;
+    if (!initialised) {
+      initialised = true;
+    }
+
+    return *properties;
+  }
+
+  void AddInterfaces(mojo::BinderMap* binders) override {}
+
+ private:
+  std::unique_ptr<KeyboardLayoutEngine> keyboard_layout_engine_;
+  std::unique_ptr<EflSurfaceFactory> surface_factory_;
+  std::unique_ptr<CursorFactory> cursor_factory_;
+  std::unique_ptr<StubOverlayManager> overlay_manager_;
+  std::unique_ptr<InputController> input_controller_;
+  std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
+};
+
+}  // namespace
+
+OzonePlatform* CreateOzonePlatformEfl() {
+  return new OzonePlatformEfl;
+}
+
+}  // namespace ui
@@ -1,9 +1,9 @@
-// Copyright (c) 2015 Samsung Electronics. All rights reserved.
+// Copyright 2021 Samsung Electronics. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef OZONE_OZONE_PLATFORM_EFL_H_
-#define OZONE_OZONE_PLATFORM_EFL_H_
+#ifndef UI_OZONE_PLATFORM_EFL_OZONE_PLATFORM_EFL_H_
+#define UI_OZONE_PLATFORM_EFL_OZONE_PLATFORM_EFL_H_
 
 namespace ui {
 
@@ -14,4 +14,4 @@ OzonePlatform* CreateOzonePlatformEfl();
 
 }  // namespace ui
 
-#endif // OZONE_OZONE_PLATFORM_EFL_H_
+#endif  // UI_OZONE_PLATFORM_EFL_OZONE_PLATFORM_EFL_H_
diff --git a/tizen_src/chromium_impl/ui/ozone/surface_factory_efl.cc b/tizen_src/chromium_impl/ui/ozone/surface_factory_efl.cc
deleted file mode 100644 (file)
index 781cdc7..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (c) 2015 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/ozone/surface_factory_efl.h"
-#include "chromium_impl/build/tizen_version.h"
-
-#include "ecore_x_wayland_wrapper.h"
-
-#include "ui/gl/gl_surface_egl.h"
-#include "ui/ozone/common/egl_util.h"
-#include "ui/ozone/common/gl_ozone_egl.h"
-
-namespace ui {
-
-namespace {
-
-class GLOzoneEGLEfl : public GLOzoneEGL {
- public:
-  GLOzoneEGLEfl() {}
-  ~GLOzoneEGLEfl() override {}
-
-  scoped_refptr<gl::GLSurface> CreateViewGLSurface(
-      gl::GLDisplay* display,
-      gfx::AcceleratedWidget window) override {
-    // We use offscreen surface for EFL port.
-    return nullptr;
-  }
-
-  scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface(
-      gl::GLDisplay* display,
-      const gfx::Size& size) override {
-    gl::GLDisplayEGL* egl_display = display->GetAs<gl::GLDisplayEGL>();
-    if (egl_display->IsEGLSurfacelessContextSupported() && size.width() == 0 &&
-        size.height() == 0) {
-      return gl::InitializeGLSurface(new gl::SurfacelessEGL(egl_display, size));
-    } else {
-      return gl::InitializeGLSurface(
-          new gl::PbufferGLSurfaceEGL(egl_display, size));
-    }
-  }
-
- protected:
-  gl::EGLDisplayPlatform GetNativeDisplay() override {
-#if defined(USE_WAYLAND)
-#if TIZEN_VERSION_AT_LEAST(5, 0, 0)
-    Ecore_Wl2_Display* wl2_display = ecore_wl2_connected_display_get(NULL);
-    return gl::EGLDisplayPlatform(reinterpret_cast<EGLNativeDisplayType>(
-        ecore_wl2_display_get(wl2_display)));
-#else
-    return gl::EGLDisplayPlatform(
-        reinterpret_cast<EGLNativeDisplayType>(ecore_wl_display_get()));
-#endif  // TIZEN_VERSION_AT_LEAST(5, 0, 0)
-#else
-    return gl::EGLDisplayPlatform(
-        reinterpret_cast<EGLNativeDisplayType>(ecore_x_display_get()));
-#endif
-  }
-
-  bool LoadGLES2Bindings(
-      const gl::GLImplementationParts& implementation) override {
-    return LoadDefaultEGLGLES2Bindings(implementation);
-  }
-
- private:
-  // DISALLOW_COPY_AND_ASSIGN(GLOzoneEGLEfl);
-};
-
-}  // namespace
-
-SurfaceFactoryEfl::SurfaceFactoryEfl() {
-  egl_implementation_.reset(new GLOzoneEGLEfl());
-}
-
-SurfaceFactoryEfl::~SurfaceFactoryEfl() {}
-
-std::vector<gl::GLImplementationParts>
-SurfaceFactoryEfl::GetAllowedGLImplementations() {
-  std::vector<gl::GLImplementationParts> impls;
-  impls.push_back(gl::GLImplementationParts(gl::kGLImplementationEGLGLES2));
-  return impls;
-}
-
-GLOzone* SurfaceFactoryEfl::GetGLOzone(
-    const gl::GLImplementationParts& implementation) {
-  switch (implementation.gl) {
-    case gl::kGLImplementationEGLGLES2:
-      return egl_implementation_.get();
-    default:
-      return nullptr;
-  }
-}
-
-}  // namespace ui
diff --git a/tizen_src/chromium_impl/ui/ozone/surface_factory_efl.h b/tizen_src/chromium_impl/ui/ozone/surface_factory_efl.h
deleted file mode 100644 (file)
index ec0e660..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (c) 2015 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef OZONE_SURFACE_FACTORY_EFL
-#define OZONE_SURFACE_FACTORY_EFL
-
-#include "ui/ozone/public/surface_factory_ozone.h"
-
-namespace ui {
-
-// SurfaceFactoryOzone implementation for EFL.
-class SurfaceFactoryEfl : public SurfaceFactoryOzone {
- public:
-  SurfaceFactoryEfl();
-  ~SurfaceFactoryEfl() override;
-
-  // SurfaceFactoryOzone:
-  std::vector<gl::GLImplementationParts> GetAllowedGLImplementations() override;
-  GLOzone* GetGLOzone(const gl::GLImplementationParts& implementation) override;
-
- private:
-  std::unique_ptr<GLOzone> egl_implementation_;
-
-  // DISALLOW_COPY_AND_ASSIGN(SurfaceFactoryEfl);
-};
-
-}  // namespace ui
-
-#endif // OZONE_SURFACE_FACTORY_EFL
index d3dd7c1..bde2e47 100644 (file)
@@ -22,8 +22,6 @@ const char kWidgetEncodedBundle[] = "widget-encoded-bundle";
 const char kEwkEnableMobileFeaturesForDesktop[] =
     "ewk-enable-mobile-features-for-desktop";
 
-const char kLimitMemoryAllocationInScheduleDelayedWork[] = "limit-memory-allocation-in-schedule-delayed-work";
-
 // Don't dump stuff here, follow the same order as the header.
 
 }  // namespace switches
index 183e026..25519a6 100644 (file)
@@ -28,8 +28,6 @@ CONTENT_EXPORT extern const char kWidgetEncodedBundle[];
 // similar set of features that mobile build has.
 CONTENT_EXPORT extern const char kEwkEnableMobileFeaturesForDesktop[];
 
-CONTENT_EXPORT extern const char kLimitMemoryAllocationInScheduleDelayedWork[];
-
 // DON'T ADD RANDOM STUFF HERE. Put it in the main section above in
 // alphabetical order, or in one of the ifdefs (also in order in each section).
 
index a5d3151..7a94187 100644 (file)
@@ -8,6 +8,7 @@
 #include "base/logging.h"
 #include "base/message_loop/message_pump_for_ui_efl.h"
 #include "base/path_service.h"
+#include "base/run_loop.h"
 #include "browser/autofill/personal_data_manager_factory.h"
 #include "components/discardable_memory/service/discardable_shared_memory_manager.h"
 #include "components/variations/variations_ids_provider.h"
@@ -69,29 +70,22 @@ EwkGlobalData::~EwkGlobalData() {
   // URLRequestContextGetterEfl needs to be deleted before loop stops
   system_request_context_ = nullptr;
 
-// MessageLoop::QuitNow is deprecated. Should use RunLoop::Quit()
-#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
   // We need to pretend that message loop was stopped so chromium unwinds
   // correctly
-  MessageLoop* loop = MessageLoop::current();
-  loop->QuitNow();
-#endif
-
-// Since we forcibly shutdown our UI message loop, it is possible
-// that important pending Tasks are simply not executed.
-// Among these, the destruction of RenderProcessHostImpl class
-// (scheduled with DeleteSoon) performs various process umplumbing
-// stuff and also holds strong references of lots of other objects
-// (e.g. URLRequestContextGetterEfl, RenderWidgetHelper,
-// ChildProcessLauncher). Not performing the proper destruction
-// of them might result in crashes or other undefined problems.
-//
-// Line below gives the message loop a extra run ('till it gets idle)
-// to perform such pending tasks.
-#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
-  // FIXME: EWK_BRINGUP definition should be removed.
-  loop->RunUntilIdle();
-#endif  // !defined(EWK_BRINGUP)
+  if (base::RunLoop::IsRunningOnCurrentThread())
+    base::RunLoop::QuitCurrentDeprecated();
+  // Since we forcibly shutdown our UI message loop, it is possible
+  // that important pending Tasks are simply not executed.
+  // Among these, the destruction of RenderProcessHostImpl class
+  // (scheduled with DeleteSoon) performs various process umplumbing
+  // stuff and also holds strong references of lots of other objects
+  // (e.g. URLRequestContextGetterEfl, RenderWidgetHelper,
+  // ChildProcessLauncher). Not performing the proper destruction
+  // of them might result in crashes or other undefined problems.
+  //
+  // Line below gives the message loop a extra run ('till it gets idle)
+  // to perform such pending tasks.
+  base::RunLoop().RunUntilIdle();
 }
 
 EwkGlobalData* EwkGlobalData::GetInstance() {
index 5a37cac..0358710 100644 (file)
@@ -9,10 +9,6 @@ import("//build/config/ui.gni")
 import("//gpu/vulkan/features.gni")
 import("//testing/test.gni")
 
-if (use_efl) {
-  import("//tizen_src/chromium_impl/ui/ui_efl.gni")
-}
-
 assert(use_ozone)
 
 visibility = [ ":*" ]
@@ -26,10 +22,6 @@ ozone_platform_deps = ozone_external_platform_deps
 # Extra dependencies to pull into ozone_unittests for built platforms.
 ozone_platform_test_deps = ozone_external_platform_test_deps
 
-if (use_efl) {
-  ozone_platforms += external_ozone_platforms
-}
-
 # Extra dependencies to pull into ozone_integration_tests
 ozone_platform_integration_test_deps =
     ozone_external_platform_integration_test_deps
@@ -232,10 +224,6 @@ source_set("platform") {
   # Platforms are always linked into //ui/ozone and can include our headers.
   allow_circular_includes_from = ozone_platform_deps
 
-  if (use_efl) {
-    deps += external_ozone_platform_deps
-  }
-
   # This is used for platform tests.
   visibility += [ "//ui/ozone/platform/*" ]