From 1d9a36f340caec87a0541fe69e660ca1e32f14cb Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Fri, 27 Jul 2018 01:55:36 -0700 Subject: [PATCH] [M67 Dev][EFL] Fix crashes at webview launch 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 --- base/run_loop.h | 10 ++++++++ content/browser/browser_main_loop.cc | 2 +- content/child/blink_platform_impl.cc | 4 --- content/child/blink_platform_impl.h | 2 -- third_party/blink/public/public_features.gni | 2 +- .../renderer/platform/scroll/scrollbar_theme.cc | 8 ------ .../renderer_host/render_widget_host_view_efl.h | 1 - .../content/gpu/in_process_gpu_thread_efl.cc | 29 ++++++++++++++++------ tizen_src/ewk/efl_integration/ewk_global_data.cc | 5 ++++ .../ewk/efl_integration/message_pump_for_ui_efl.cc | 2 -- .../url_request_context_getter_efl.cc | 23 +++++++++-------- ui/gl/gl_surface_egl.cc | 3 ++- 12 files changed, 53 insertions(+), 38 deletions(-) diff --git a/base/run_loop.h b/base/run_loop.h index d3858fce..07a0b00 100644 --- a/base/run_loop.h +++ b/base/run_loop.h @@ -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. diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index 873406e..aeee062 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc @@ -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; diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc index 14351fa..aa67eb8 100644 --- a/content/child/blink_platform_impl.cc +++ b/content/child/blink_platform_impl.cc @@ -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() { diff --git a/content/child/blink_platform_impl.h b/content/child/blink_platform_impl.h index 63aed57..f9d13cf 100644 --- a/content/child/blink_platform_impl.h +++ b/content/child/blink_platform_impl.h @@ -126,9 +126,7 @@ class CONTENT_EXPORT BlinkPlatformImpl : public blink::Platform { scoped_refptr main_thread_task_runner_; scoped_refptr 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_; diff --git a/third_party/blink/public/public_features.gni b/third_party/blink/public/public_features.gni index 31312dd..0698a11 100644 --- a/third_party/blink/public/public_features.gni +++ b/third_party/blink/public/public_features.gni @@ -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 diff --git a/third_party/blink/renderer/platform/scroll/scrollbar_theme.cc b/third_party/blink/renderer/platform/scroll/scrollbar_theme.cc index a068657..ba85a69 100644 --- a/third_party/blink/renderer/platform/scroll/scrollbar_theme.cc +++ b/third_party/blink/renderer/platform/scroll/scrollbar_theme.cc @@ -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; } diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.h b/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.h index 9b86c97..8a3848b 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.h +++ b/tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.h @@ -297,7 +297,6 @@ class CONTENT_EXPORT RenderWidgetHostViewEfl Ecore_X_Window GetEcoreXWindow() const; #endif - RenderWidgetHostImpl* host_; std::unique_ptr evasgl_delegated_frame_host_; IMContextEfl* im_context_; Evas* evas_; diff --git a/tizen_src/chromium_impl/content/gpu/in_process_gpu_thread_efl.cc b/tizen_src/chromium_impl/content/gpu/in_process_gpu_thread_efl.cc index b070329..230a80d 100644 --- a/tizen_src/chromium_impl/content/gpu/in_process_gpu_thread_efl.cc +++ b/tizen_src/chromium_impl/content/gpu/in_process_gpu_thread_efl.cc @@ -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_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_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); } }; diff --git a/tizen_src/ewk/efl_integration/ewk_global_data.cc b/tizen_src/ewk/efl_integration/ewk_global_data.cc index 50df8f8..755c63e 100644 --- a/tizen_src/ewk/efl_integration/ewk_global_data.cc +++ b/tizen_src/ewk/efl_integration/ewk_global_data.cc @@ -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); diff --git a/tizen_src/ewk/efl_integration/message_pump_for_ui_efl.cc b/tizen_src/ewk/efl_integration/message_pump_for_ui_efl.cc index 066cd2e..68f3784 100644 --- a/tizen_src/ewk/efl_integration/message_pump_for_ui_efl.cc +++ b/tizen_src/ewk/efl_integration/message_pump_for_ui_efl.cc @@ -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(); diff --git a/tizen_src/ewk/efl_integration/url_request_context_getter_efl.cc b/tizen_src/ewk/efl_integration/url_request_context_getter_efl.cc index f0603d7..9ee9ddf 100644 --- a/tizen_src/ewk/efl_integration/url_request_context_getter_efl.cc +++ b/tizen_src/ewk/efl_integration/url_request_context_getter_efl.cc @@ -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 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 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)); diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc index 9c77b7a..bdfad82 100644 --- a/ui/gl/gl_surface_egl.cc +++ b/ui/gl/gl_surface_egl.cc @@ -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 = -- 2.7.4