[M67 Dev][EFL] Fix crashes at webview launch 00/185300/3
authorChandan Padhi <c.padhi@samsung.com>
Fri, 27 Jul 2018 08:55:36 +0000 (01:55 -0700)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Mon, 30 Jul 2018 08:35:18 +0000 (08:35 +0000)
This commit fixes the crashes during webview launch.
It also fixes the white screen observed later.

Basic page rendering works fine on desktop.

Reference: https://review.tizen.org/gerrit/#/c/171308/

Change-Id: I5825876d8294ebfed387ee4b09da3aeb13e58954
Signed-off-by: Chandan Padhi <c.padhi@samsung.com>
12 files changed:
base/run_loop.h
content/browser/browser_main_loop.cc
content/child/blink_platform_impl.cc
content/child/blink_platform_impl.h
third_party/blink/public/public_features.gni
third_party/blink/renderer/platform/scroll/scrollbar_theme.cc
tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.h
tizen_src/chromium_impl/content/gpu/in_process_gpu_thread_efl.cc
tizen_src/ewk/efl_integration/ewk_global_data.cc
tizen_src/ewk/efl_integration/message_pump_for_ui_efl.cc
tizen_src/ewk/efl_integration/url_request_context_getter_efl.cc
ui/gl/gl_surface_egl.cc

index d3858fc..07a0b00 100644 (file)
@@ -24,6 +24,10 @@ namespace base {
 class MessagePumpForUI;
 #endif
 
+#if defined(USE_EFL)
+class MessagePumpForUIEfl;
+#endif
+
 #if defined(OS_IOS)
 class MessagePumpUIApplication;
 #endif
@@ -270,6 +274,12 @@ class BASE_EXPORT RunLoop {
   friend class base::MessagePumpForUI;
 #endif
 
+#if defined(USE_EFL)
+  // EFL doesn't support the blocking RunLoop::Run, so it calls
+  // BeforeRun directly.
+  friend class base::MessagePumpForUIEfl;
+#endif
+
 #if defined(OS_IOS)
   // iOS doesn't support the blocking RunLoop::Run, so it calls
   // BeforeRun directly.
index 873406e..aeee062 100644 (file)
@@ -1160,7 +1160,7 @@ viz::FrameSinkManagerImpl* BrowserMainLoop::GetFrameSinkManager() const {
 
 void BrowserMainLoop::GetCompositingModeReporter(
     viz::mojom::CompositingModeReporterRequest request) {
-#if defined(OS_ANDROID)
+#if defined(OS_ANDROID) || defined(USE_EFL)
   // Android doesn't support non-gpu compositing modes, and doesn't make a
   // CompositingModeReporter.
   return;
index 14351fa..aa67eb8 100644 (file)
@@ -699,11 +699,7 @@ BlinkPlatformImpl::MediaCapabilitiesClient() {
 }
 
 WebThemeEngine* BlinkPlatformImpl::ThemeEngine() {
-#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
   return &native_theme_engine_;
-#else
-  return nullptr;
-#endif
 }
 
 WebFallbackThemeEngine* BlinkPlatformImpl::FallbackThemeEngine() {
index 63aed57..f9d13cf 100644 (file)
@@ -126,9 +126,7 @@ class CONTENT_EXPORT BlinkPlatformImpl : public blink::Platform {
 
   scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
   scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_;
-#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
   WebThemeEngineImpl native_theme_engine_;
-#endif
   WebFallbackThemeEngineImpl fallback_theme_engine_;
   base::ThreadLocalStorage::Slot current_thread_slot_;
   webcrypto::WebCryptoImpl web_crypto_;
index 31312dd..0698a11 100644 (file)
@@ -15,7 +15,7 @@ declare_args() {
 # Unhandled Tap enable means Contextual Search aka Touch to Search.
 enable_unhandled_tap = is_android
 
-use_default_render_theme = use_aura
+use_default_render_theme = use_aura || use_efl
 
 # Use Minikin hyphenation engine.
 use_minikin_hyphenation = is_android
index a068657..ba85a69 100644 (file)
@@ -407,14 +407,6 @@ ScrollbarTheme& ScrollbarTheme::DeprecatedStaticGetTheme() {
   return NativeTheme();
 }
 
-// TODO: Remove this mock theme and apply the appropriate theme for tizen.
-#if defined(EWK_BRINGUP)
-ScrollbarTheme& ScrollbarTheme::NativeTheme() {
-  DEFINE_STATIC_LOCAL(ScrollbarThemeMock, mock_theme, ());
-  return mock_theme;
-}
-#endif
-
 void ScrollbarTheme::SetMockScrollbarsEnabled(bool flag) {
   g_mock_scrollbars_enabled_ = flag;
 }
index 9b86c97..8a3848b 100644 (file)
@@ -297,7 +297,6 @@ class CONTENT_EXPORT RenderWidgetHostViewEfl
   Ecore_X_Window GetEcoreXWindow() const;
 #endif
 
-  RenderWidgetHostImpl* host_;
   std::unique_ptr<EvasGLDelegatedFrameHost> evasgl_delegated_frame_host_;
   IMContextEfl* im_context_;
   Evas* evas_;
index b070329..230a80d 100644 (file)
@@ -2,12 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "base/command_line.h"
+#include "base/time/time.h"
 #include "content/gpu/gpu_process.h"
 #include "content/public/common/content_client.h"
-#include "content/public/gpu/content_gpu_client.h"
+#include "content/public/common/content_switches.h"
 #include "gpu/command_buffer/client/shared_mailbox_manager.h"
+#include "gpu/command_buffer/service/gpu_preferences.h"
 #include "gpu/command_buffer/service/mailbox_manager.h"
-#include "gpu/config/gpu_info_collector.h"
 #include "gpu/ipc/service/gpu_init.h"
 #include "ui/gl/gl_shared_context_efl.h"
 
@@ -26,6 +28,14 @@ struct GpuChildThreadEfl : public content::GpuChildThread {
   explicit GpuChildThreadEfl(const InProcessChildThreadParams& params,
                              std::unique_ptr<gpu::GpuInit> gpu_init)
       : GpuChildThread(params, std::move(gpu_init)) {}
+
+  void OnGpuServiceConnection(viz::GpuServiceImpl* gpu_service) override {
+    GpuChildThread::OnGpuServiceConnection(gpu_service);
+    gpu_service->gpu_channel_manager()->share_group_ =
+        GLSharedContextEfl::GetShareGroup();
+    gpu_service->gpu_channel_manager()->mailbox_manager_ =
+        base::WrapUnique(SharedMailboxManager::GetMailboxManager());
+  }
 };
 
 struct InProcessGpuThreadEfl : public content::InProcessGpuThread {
@@ -37,17 +47,22 @@ struct InProcessGpuThreadEfl : public content::InProcessGpuThread {
   void Init() override {
     gpu_process_ = new content::GpuProcess(base::ThreadPriority::NORMAL);
 
-    gpu::GPUInfo gpu_info;
-    gpu::CollectContextGraphicsInfo(&gpu_info);
-
     auto gpu_init = std::make_unique<gpu::GpuInit>();
     gpu_init->InitializeInProcess(base::CommandLine::ForCurrentProcess(),
                                   gpu_preferences_);
 
+    GetContentClient()->SetGpuInfo(gpu_init->gpu_info());
+
     // The process object takes ownership of the thread object, so do not
     // save and delete the pointer.
-    gpu_process_->set_main_thread(
-        new GpuChildThreadEfl(params_, std::move(gpu_init)));
+    GpuChildThread* child_thread =
+        new GpuChildThreadEfl(params_, std::move(gpu_init));
+
+    // Since we are in the browser process, use the thread start time as the
+    // process start time.
+    child_thread->Init(base::Time::Now());
+
+    gpu_process_->set_main_thread(child_thread);
   }
 };
 
index 50df8f8..755c63e 100644 (file)
@@ -23,6 +23,7 @@
 #include "content/utility/in_process_utility_thread.h"
 #include "efl/window_factory.h"
 #include "eweb_view.h"
+#include "mojo/edk/embedder/embedder.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/ozone/public/ozone_platform.h"
 
@@ -112,6 +113,10 @@ EwkGlobalData* EwkGlobalData::GetInstance() {
 
   instance_ = new EwkGlobalData();
 
+  // TODO: Check if service_manager::Main should be used instead.
+  // The Mojo EDK must be initialized before using IPC.
+  mojo::edk::Init();
+
   bool message_pump_overridden =
       base::MessageLoop::InitMessagePumpForUIFactory(&MessagePumpFactory);
   DCHECK(message_pump_overridden);
index 066cd2e..68f3784 100644 (file)
@@ -155,13 +155,11 @@ void MessagePumpForUIEfl::DoWork() {
   }
 
   Delegate* delegate = base::MessageLoopForUI::current();
-#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
   if (!run_loop_) {
     run_loop_ = new RunLoop();
     bool result = run_loop_->BeforeRun();
     DCHECK(result);
   }
-#endif
 
   bool more_work_is_plausible = delegate->DoWork();
 
index f0603d7..9ee9ddf 100644 (file)
@@ -146,6 +146,18 @@ net::URLRequestContext* URLRequestContextGetterEfl::GetURLRequestContext() {
           net::DISK_CACHE, net::CACHE_BACKEND_DEFAULT, cache_path, 0);
     }
 
+#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
+    if (command_line.HasSwitch(switches::kHostResolverRules)) {
+      std::unique_ptr<net::MappedHostResolver> mapped_host_resolver(
+          new net::MappedHostResolver(std::move(host_resolver)));
+      mapped_host_resolver->SetRulesFromString(
+          command_line.GetSwitchValueASCII(switches::kHostResolverRules));
+      host_resolver = std::move(mapped_host_resolver);
+    }
+#endif
+    // Give |storage_| ownership at the end in case it's |mapped_host_resolver|.
+    storage_->set_host_resolver(std::move(host_resolver));
+
     net::HttpNetworkSession::Context network_session_context;
     network_session_context.cert_verifier =
         url_request_context_->cert_verifier();
@@ -186,17 +198,6 @@ net::URLRequestContext* URLRequestContextGetterEfl::GetURLRequestContext() {
           &value);
       network_session_params.testing_fixed_https_port = value;
     }
-#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
-    if (command_line.HasSwitch(switches::kHostResolverRules)) {
-      std::unique_ptr<net::MappedHostResolver> mapped_host_resolver(
-          new net::MappedHostResolver(std::move(host_resolver)));
-      mapped_host_resolver->SetRulesFromString(
-          command_line.GetSwitchValueASCII(switches::kHostResolverRules));
-      host_resolver = std::move(mapped_host_resolver);
-    }
-#endif
-    // Give |storage_| ownership at the end in case it's |mapped_host_resolver|.
-    storage_->set_host_resolver(std::move(host_resolver));
 
     http_network_session_.reset(new net::HttpNetworkSession(
         network_session_params, network_session_context));
index 9c77b7a..bdfad82 100644 (file)
@@ -589,9 +589,10 @@ bool GLSurfaceEGL::InitializeOneOffForTesting() {
 // static
 bool GLSurfaceEGL::InitializeOneOffCommon() {
   g_egl_extensions = eglQueryString(g_egl_display, EGL_EXTENSIONS);
-
+#if !defined(USE_EFL)
   g_egl_create_context_robustness_supported =
       HasEGLExtension("EGL_EXT_create_context_robustness");
+#endif
   g_egl_create_context_bind_generates_resource_supported =
       HasEGLExtension("EGL_CHROMIUM_create_context_bind_generates_resource");
   g_egl_create_context_webgl_compatability_supported =