From c8f452658044dce0f28847493c25dab9b737430b Mon Sep 17 00:00:00 2001 From: "qiang.ji" Date: Thu, 23 Mar 2023 10:17:01 +0800 Subject: [PATCH 01/16] [M108 Migration][VD] Support floating video window Support the new requirement of floating video window for WebBrowser. - Provide an api of ewk_view_floating_window_state_changed. Notify WebEngine the status that floating video window is on/off. If floating video window existed, but not current webView, For tabs switching case, in order to keep floating video window, need to prevent media resume. - Provide "notify,video,resized" for video rect notification. WebEngine notify WebBrowser playing video dimension in normal webview through which mini tab button is displayed at correct location on video. - Appended the document url to the paramater of "video,playing,url". In case video is playing inside an iframe, document URL provides URL loaded in iFrame to identify which document is playing video. - Allow to run the insecure content from localhost, that are http://127.0.0.1 and http://localhost. refs: https://review.tizen.org/gerrit/283144/ Change-Id: I3c8c0f4c2279e4cadcba471250a2e6e1c67729c6 Signed-off-by: qiang.ji --- .../renderer_host/render_widget_host_impl.cc | 6 ++ .../renderer_host/render_widget_host_impl.h | 3 + content/public/renderer/content_renderer_client.h | 3 + .../public/mojom/widget/platform_widget.mojom | 3 + third_party/blink/public/web/web_view.h | 4 ++ third_party/blink/public/web/web_view_client.h | 5 ++ .../blink/renderer/core/exported/web_view_impl.cc | 10 +++ .../blink/renderer/core/exported/web_view_impl.h | 4 ++ .../renderer/core/frame/web_frame_widget_impl.cc | 6 ++ .../renderer/core/frame/web_frame_widget_impl.h | 3 + .../renderer/core/html/media/html_media_element.cc | 72 ++++++++++++++++++++++ .../renderer/core/html/media/html_media_element.h | 17 +++++ third_party/blink/renderer/core/page/page.h | 10 +++ .../blink/renderer/platform/widget/widget_base.cc | 6 ++ .../blink/renderer/platform/widget/widget_base.h | 3 + .../renderer/platform/widget/widget_base_client.h | 9 +++ tizen_src/ewk/efl_integration/eweb_view.cc | 9 +++ tizen_src/ewk/efl_integration/eweb_view.h | 3 + tizen_src/ewk/efl_integration/public/ewk_view.cc | 6 +- .../renderer/content_renderer_client_efl.h | 14 +++++ 20 files changed, 194 insertions(+), 2 deletions(-) diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 84f8aae..02d6156 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -1074,6 +1074,12 @@ void RenderWidgetHostImpl::OnGetSelectionRect(const gfx::Rect& rect) { void RenderWidgetHostImpl::ResetLastInteractedElements() { blink_widget_->ResetLastInteractedElements(); } + +#if BUILDFLAG(IS_TIZEN_TV) +void RenderWidgetHostImpl::SetFloatVideoWindowState(bool enabled) { + blink_widget_->SetFloatVideoWindowState(enabled); +} +#endif #endif blink::VisualProperties RenderWidgetHostImpl::GetInitialVisualProperties() { diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index b069615..99f88c4 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -464,6 +464,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl void RequestSelectionRect(); void OnGetSelectionRect(const gfx::Rect& rect); void ResetLastInteractedElements(); +#if BUILDFLAG(IS_TIZEN_TV) + void SetFloatVideoWindowState(bool enabled); +#endif #endif // Returns true if the RenderWidget is hidden. diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h index d31fc6b..f89f2da 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h @@ -226,6 +226,9 @@ class CONTENT_EXPORT ContentRendererClient { blink::WebNavigationPolicy default_policy, bool is_redirect); #endif +#if BUILDFLAG(IS_TIZEN_TV) + virtual bool HasFloatingVideoWindowOn() const { return false; } +#endif // Notifies the embedder that the given frame is requesting the resource at // |url|. If the function returns a valid |new_url|, the request must be diff --git a/third_party/blink/public/mojom/widget/platform_widget.mojom b/third_party/blink/public/mojom/widget/platform_widget.mojom index 50071a7..b222ca4 100644 --- a/third_party/blink/public/mojom/widget/platform_widget.mojom +++ b/third_party/blink/public/mojom/widget/platform_widget.mojom @@ -155,6 +155,9 @@ interface Widget { [EnableIf=is_efl] RequestSelectionRect() => (gfx.mojom.Rect rect); + [EnableIf=is_tizen_tv] + SetFloatVideoWindowState(bool enabled); + // Informs the widget that it was hidden. This allows it to reduce its // resource utilization, and will cancel any pending // RecordContentToVisibleTimeRequest that was set with WasShown or diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h index 5a25218..608a2ee 100644 --- a/third_party/blink/public/web/web_view.h +++ b/third_party/blink/public/web/web_view.h @@ -513,6 +513,10 @@ class BLINK_EXPORT WebView { virtual gfx::Rect CurrentSelectionRect() const = 0; #endif +#if BUILDFLAG(IS_TIZEN_TV) + virtual void SetFloatVideoWindowState(bool enable) = 0; +#endif + protected: ~WebView() = default; }; diff --git a/third_party/blink/public/web/web_view_client.h b/third_party/blink/public/web/web_view_client.h index d551e78..2435c9c 100644 --- a/third_party/blink/public/web/web_view_client.h +++ b/third_party/blink/public/web/web_view_client.h @@ -48,6 +48,11 @@ class WebViewClient { // the layers. virtual void InvalidateContainer() {} +#if BUILDFLAG(IS_TIZEN_TV) + // Floating Video Window + virtual bool HasFloatingVideoWindowOn() const { return false; } +#endif + // UI ------------------------------------------------------------------ // Called when the View has changed size as a result of an auto-resize. diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index 316ae20..ad878e5 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc @@ -3565,6 +3565,16 @@ void WebViewImpl::RemoveObserver(WebViewObserver* observer) { observers_.RemoveObserver(observer); } +#if BUILDFLAG(IS_TIZEN_TV) +void WebViewImpl::SetFloatVideoWindowState(bool enable) { + if (!GetPage()) + return; + + LOG(INFO) << __FUNCTION__ << " enable : " << enable; + GetPage()->SetFloatVideoWindowState(enable); +} +#endif + void WebViewImpl::SetIsActive(bool active) { if (GetPage()) GetPage()->GetFocusController().SetActive(active); diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h index 952342b..18d4dd8 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h @@ -243,6 +243,10 @@ class CORE_EXPORT WebViewImpl final : public WebView, void AddObserver(WebViewObserver* observer); void RemoveObserver(WebViewObserver* observer); +#if defined(OS_TIZEN_TV_PRODUCT) + void SetFloatVideoWindowState(bool) override; +#endif // OS_TIZEN_TV_PRODUCT + // `BaseBackgroundColor()` affects how the document is rendered. // `BackgroundColor()` is what the document computes as its background color // (with `BaseBackgroundColor()` as an input), or `BaseBackgroundColor()` if diff --git a/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc b/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc index d6b3018..3f8d61b 100644 --- a/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc +++ b/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc @@ -4304,6 +4304,12 @@ bool WebFrameWidgetImpl::RequestMainFrameScrollbarVisible(bool& visible) { local_frame->HasVerticalScrollbar(); return true; } + +#if BUILDFLAG(IS_TIZEN_TV) +void WebFrameWidgetImpl::SetFloatVideoWindowState(bool enabled) { + View()->SetFloatVideoWindowState(enabled); +} +#endif #endif #if BUILDFLAG(IS_TIZEN) diff --git a/third_party/blink/renderer/core/frame/web_frame_widget_impl.h b/third_party/blink/renderer/core/frame/web_frame_widget_impl.h index 80cc841..833586a 100644 --- a/third_party/blink/renderer/core/frame/web_frame_widget_impl.h +++ b/third_party/blink/renderer/core/frame/web_frame_widget_impl.h @@ -738,6 +738,9 @@ class CORE_EXPORT WebFrameWidgetImpl void SelectClosestWord(uint32_t x, uint32_t y) override; void SelectFocusedLink() override; gfx::Rect RequestSelectionRect() override; +#if BUILDFLAG(IS_TIZEN_TV) + void SetFloatVideoWindowState(bool enabled) override; +#endif #endif void OrientationChanged() override; diff --git a/third_party/blink/renderer/core/html/media/html_media_element.cc b/third_party/blink/renderer/core/html/media/html_media_element.cc index c96a6d2..85b1638 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.cc +++ b/third_party/blink/renderer/core/html/media/html_media_element.cc @@ -501,6 +501,9 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tag_name, tracks_are_ready_(true), processing_preference_change_(false), was_always_muted_(true), +#if BUILDFLAG(IS_TIZEN_TV) + is_deactivate_(false), +#endif #if defined(TIZEN_MULTIMEDIA) suspended_by_player_(false), #endif @@ -2742,6 +2745,9 @@ absl::optional HTMLMediaElement::Play() { absl::optional exception_code = autoplay_policy_->RequestPlay(); +#if BUILDFLAG(IS_TIZEN_TV) + is_deactivate_ = false; +#endif if (exception_code == DOMExceptionCode::kNotAllowedError) { // If we're already playing, then this play would do nothing anyway. @@ -4969,6 +4975,72 @@ void HTMLMediaElement::OpenerContextObserver::ContextDestroyed() { element_->AttachToNewFrame(); } +#if defined(TIZEN_MULTIMEDIA_SUPPORT) +void HTMLMediaElement::MediaPlayerHidden() { + LOG(INFO) << "Media player hidden: " << this; + // TODO(m.debski): It should store periodic timers and restore on shown. + // Currently they will still fire, but will return immediately. + suppress_events_ = true; +} + +void HTMLMediaElement::MediaPlayerShown() { + LOG(INFO) << "Media player shown: " << this; + suppress_events_ = false; +} + +void HTMLMediaElement::Suspend() { + LOG(INFO) << "Suspend(" << (void*)this << ")"; + if (!GetWebMediaPlayer()) + return; + +#if defined(SAMSUNG_ELEMENTARY_MEDIA_STREAM_SOURCE) + if (media_source_attachment_) { + // Send suspend event to the source before WebMediaPlayer suspends backend. + media_source_attachment_->OnSuspend(media_source_tracer_); + } +#endif // SAMSUNG_ELEMENTARY_MEDIA_STREAM_SOURCE + + GetWebMediaPlayer()->Suspend(); +} + +void HTMLMediaElement::Resume() { + LOG(INFO) << "Resume(" << (void*)this << ")"; + if (!GetWebMediaPlayer()) + return; + +#if BUILDFLAG(IS_TIZEN_TV) + // IsViewResumedByTabSwitching, return true on the tab which has no + // floatwindow, otherwise it is false + if (GetDocument().GetPage() && + GetDocument().GetPage()->IsViewResumedByTabSwitching()) { + GetWebMediaPlayer()->Deactivate(); + LOG(INFO) << "is_deactivate_ TRUE"; + is_deactivate_ = true; + } else if (is_deactivate_) { + GetWebMediaPlayer()->Activate(); + LOG(INFO) << "is_deactivate_ FALSE"; + is_deactivate_ = false; + } +#endif + + GetWebMediaPlayer()->Resume(); + +#if defined(SAMSUNG_ELEMENTARY_MEDIA_STREAM_SOURCE) + if (media_source_attachment_) { + // Send suspend event to the source after WebMediaPlayer resumes backend. + media_source_attachment_->OnResume(media_source_tracer_); + } +#endif // SAMSUNG_ELEMENTARY_MEDIA_STREAM_SOURCE +} + +void HTMLMediaElement::ActivatePlayer() { + if (!GetWebMediaPlayer()) + return; + + GetWebMediaPlayer()->Activate(); +} +#endif + STATIC_ASSERT_ENUM(WebMediaPlayer::kReadyStateHaveNothing, HTMLMediaElement::kHaveNothing); STATIC_ASSERT_ENUM(WebMediaPlayer::kReadyStateHaveMetadata, diff --git a/third_party/blink/renderer/core/html/media/html_media_element.h b/third_party/blink/renderer/core/html/media/html_media_element.h index 0677124..8a0e3ce 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.h +++ b/third_party/blink/renderer/core/html/media/html_media_element.h @@ -604,6 +604,14 @@ class CORE_EXPORT HTMLMediaElement void SetAudioSinkId(const String&) override; void SuspendForFrameClosed() override; +#if defined(TIZEN_MULTIMEDIA_SUPPORT) + void MediaPlayerHidden() final; + void MediaPlayerShown() final; + void Suspend(); + void Resume(); + void NotifyPlayingUrl(); +#endif + void LoadTimerFired(TimerBase*); void ProgressEventTimerFired(); void PlaybackProgressTimerFired(); @@ -858,6 +866,15 @@ class CORE_EXPORT HTMLMediaElement // playback raters other than 1.0. bool preserves_pitch_ = true; +#if BUILDFLAG(IS_TIZEN_TV) + bool is_deactivate_ : 1; +#endif + +#if defined(TIZEN_MULTIMEDIA_SUPPORT) + // This is to suppress stuff set to JS. Do not use it for other purposes. + bool suppress_events_ : 1; +#endif + #if defined(TIZEN_MULTIMEDIA) bool suspended_by_player_ : 1; #endif diff --git a/third_party/blink/renderer/core/page/page.h b/third_party/blink/renderer/core/page/page.h index 3d0597b..e165464 100644 --- a/third_party/blink/renderer/core/page/page.h +++ b/third_party/blink/renderer/core/page/page.h @@ -402,6 +402,12 @@ class CORE_EXPORT Page final : public GarbageCollected, // with the 'persisted' property set to 'true'. bool DispatchedPagehidePersistedAndStillHidden(); +#if BUILDFLAG(IS_TIZEN_TV) + // Floating Video Window: record the page that has floating video window. + void SetFloatVideoWindowState(bool enable) { is_floating_page_ = enable; } + bool HasFloatingVideoWindowOn() const { return is_floating_page_; } +#endif + static void PrepareForLeakDetection(); // Fully invalidate paint of all local frames in this page. @@ -507,6 +513,10 @@ class CORE_EXPORT Page final : public GarbageCollected, bool is_painting_ = false; #endif +#if BUILDFLAG(IS_TIZEN_TV) + bool is_floating_page_ = false; +#endif + int subframe_count_; HeapHashSet> plugins_changed_observers_; diff --git a/third_party/blink/renderer/platform/widget/widget_base.cc b/third_party/blink/renderer/platform/widget/widget_base.cc index a699184..63fdc24 100644 --- a/third_party/blink/renderer/platform/widget/widget_base.cc +++ b/third_party/blink/renderer/platform/widget/widget_base.cc @@ -531,6 +531,12 @@ void WidgetBase::RequestSelectionRect(RequestSelectionRectCallback callback) { } #endif +#if BUILDFLAG(IS_TIZEN_TV) +void WidgetBase::SetFloatVideoWindowState(bool enabled) { + client_->SetFloatVideoWindowState(enabled); +} +#endif // IS_TIZEN_TV + void WidgetBase::WasHidden() { // A provisional frame widget will never be hidden since that would require it // to be shown first. A frame must be attached to the frame tree before diff --git a/third_party/blink/renderer/platform/widget/widget_base.h b/third_party/blink/renderer/platform/widget/widget_base.h index ad55f28..665bdcf 100644 --- a/third_party/blink/renderer/platform/widget/widget_base.h +++ b/third_party/blink/renderer/platform/widget/widget_base.h @@ -150,6 +150,9 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget, void SetMainFrameScrollbarVisible(bool visible) override; void RequestMainFrameScrollbarVisible( RequestMainFrameScrollbarVisibleCallback callback) override; +#if BUILDFLAG(IS_TIZEN_TV) + void SetFloatVideoWindowState(bool enabled) override; +#endif // IS_TIZEN_TV void QueryInputType(QueryInputTypeCallback) override; void SelectClosestWord(uint32_t x, uint32_t y) override; void SelectFocusedLink() override; diff --git a/third_party/blink/renderer/platform/widget/widget_base_client.h b/third_party/blink/renderer/platform/widget/widget_base_client.h index d17c30f..4b4bd1e6 100644 --- a/third_party/blink/renderer/platform/widget/widget_base_client.h +++ b/third_party/blink/renderer/platform/widget/widget_base_client.h @@ -186,6 +186,15 @@ class WidgetBaseClient { virtual void SelectFocusedLink() {} virtual gfx::Rect RequestSelectionRect() { return gfx::Rect(); } virtual void ResetLastInteractedElements() {} + +#if BUILDFLAG(IS_TIZEN_TV) + virtual bool IsHitScrollbar() { return false; } + virtual bool IsMouseDownEventSwallowed() { return false; } + virtual void SuspendNetworkLoading() {} + virtual void ResumeNetworkLoading() {} + virtual void SetFloatVideoWindowState(bool enabled) {}; +#endif // IS_TIZEN_TV + #endif // Convert screen coordinates to device emulated coordinates (scaled diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index c0247ca..6df07b9 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -785,6 +785,15 @@ void EWebView::Resume() { #endif } +#if BUILDFLAG(IS_TIZEN_TV) +void EWebView::SetFloatVideoWindowState(bool enabled) { + RenderWidgetHostImpl* rwhi = static_cast( + web_contents_->GetRenderViewHost()->GetWidget()); + + rwhi->SetFloatVideoWindowState(enabled); +} +#endif // IS_TIZEN_TV + double EWebView::GetTextZoomFactor() const { if (text_zoom_factor_ < 0.0) return -1.0; diff --git a/tizen_src/ewk/efl_integration/eweb_view.h b/tizen_src/ewk/efl_integration/eweb_view.h index a5b33d5..981217e 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.h +++ b/tizen_src/ewk/efl_integration/eweb_view.h @@ -347,6 +347,9 @@ class EWebView { void Suspend(); void Resume(); void Stop(); +#if BUILDFLAG(IS_TIZEN_TV) + void SetFloatVideoWindowState(bool enabled); +#endif // IS_TIZEN_TV void SetSessionTimeout(uint64_t timeout); double GetTextZoomFactor() const; void SetTextZoomFactor(double text_zoom_factor); diff --git a/tizen_src/ewk/efl_integration/public/ewk_view.cc b/tizen_src/ewk/efl_integration/public/ewk_view.cc index af9ed6d..118651a 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_view.cc +++ b/tizen_src/ewk/efl_integration/public/ewk_view.cc @@ -1772,10 +1772,12 @@ void ewk_view_voicemanager_labels_clear(Evas_Object* view) { #endif } -void ewk_view_floating_window_state_changed(const Evas_Object *o, Eina_Bool status) +void ewk_view_floating_window_state_changed(const Evas_Object *view, Eina_Bool status) { #if BUILDFLAG(IS_TIZEN_TV) - EWK_VIEW_IMPL_GET_OR_RETURN(o, impl); + EWK_VIEW_IMPL_GET_OR_RETURN(view, impl); + LOG(INFO) << __FUNCTION__ << ", view: "<< view << ", status: " << status; + impl->SetFloatVideoWindowState(status); #else LOG_EWK_API_MOCKUP(); #endif diff --git a/tizen_src/ewk/efl_integration/renderer/content_renderer_client_efl.h b/tizen_src/ewk/efl_integration/renderer/content_renderer_client_efl.h index 7ca20ad..f3b57c3 100644 --- a/tizen_src/ewk/efl_integration/renderer/content_renderer_client_efl.h +++ b/tizen_src/ewk/efl_integration/renderer/content_renderer_client_efl.h @@ -63,6 +63,16 @@ class ContentRendererClientEfl : public content::ContentRendererClient { blink::WebNavigationPolicy default_policy, bool is_redirect) override; +#if BUILDFLAG(IS_TIZEN_TV) + // Floating Video Window + void SetFloatVideoWindowState(bool enable) { + floating_video_window_on_ = enable; + } + bool HasFloatingVideoWindowOn() const override { + return floating_video_window_on_; + } +#endif + void DidCreateScriptContext(content::RenderFrame* render_frame, v8::Handle context, int world_id); @@ -105,6 +115,10 @@ class ContentRendererClientEfl : public content::ContentRendererClient { std::unique_ptr visited_link_reader_; bool javascript_can_open_windows_ = true; bool shutting_down_ = false; + +#if BUILDFLAG(IS_TIZEN_TV) + bool floating_video_window_on_ = false; +#endif }; #endif // CONTENT_RENDERER_CLIENT_EFL_H -- 2.7.4 From cb26ca73432dddbf195aeda9a72446e35ce64885 Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Mon, 27 Mar 2023 09:21:03 +0900 Subject: [PATCH 02/16] Add IS_TIZEN guard for XWalkExtension XWalkExtension can be enabled with IS_TIZEN and this will fix build break for the desktop profile. Change-Id: I0edb4a3c33a42a4637bebce0b3c74cd683f8ccf2 Signed-off-by: DongHyun Song --- content/browser/browser_interface_binders.cc | 4 ++-- tizen_src/ewk/efl_integration/content_browser_client_efl.cc | 5 ++++- tizen_src/ewk/efl_integration/content_main_delegate_efl.cc | 8 +++++++- .../efl_integration/renderer/content_renderer_client_efl.cc | 11 ++++++++--- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/content/browser/browser_interface_binders.cc b/content/browser/browser_interface_binders.cc index 1d3cc71..567d15d 100644 --- a/content/browser/browser_interface_binders.cc +++ b/content/browser/browser_interface_binders.cc @@ -210,7 +210,7 @@ #include "content/browser/date_time_chooser_efl.h" #endif -#if defined(ENABLE_WRT_JS) +#if BUILDFLAG(IS_TIZEN) #include "tizen_src/chromium_impl/components/xwalk_extensions/browser/xwalk_extension_manager.h" #endif @@ -1208,7 +1208,7 @@ void PopulateDedicatedWorkerBinders(DedicatedWorkerHost* host, map->Add(BindWorkerReceiverForStorageKey( &RenderProcessHostImpl::BindQuotaManagerHost, host)); -#if defined(ENABLE_WRT_JS) +#if BUILDFLAG(IS_TIZEN) map->Add(base::BindRepeating( &wrt::XWalkExtensionManager::Bind)); #endif diff --git a/tizen_src/ewk/efl_integration/content_browser_client_efl.cc b/tizen_src/ewk/efl_integration/content_browser_client_efl.cc index e93b875..9810adc 100644 --- a/tizen_src/ewk/efl_integration/content_browser_client_efl.cc +++ b/tizen_src/ewk/efl_integration/content_browser_client_efl.cc @@ -24,7 +24,6 @@ #include "components/error_page/common/localized_error.h" #include "components/navigation_interception/intercept_navigation_throttle.h" #include "components/password_manager/content/browser/content_password_manager_driver_factory.h" -#include "components/xwalk_extensions/browser/xwalk_extension_manager.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/render_process_host.h" @@ -47,6 +46,8 @@ #if BUILDFLAG(IS_TIZEN) #include + +#include "components/xwalk_extensions/browser/xwalk_extension_manager.h" #endif #include "private/ewk_notification_private.h" @@ -652,9 +653,11 @@ void ContentBrowserClientEfl::ExposeInterfacesToRenderer( switches::kXWalkExtensionJsonPath)) { return; } +#if BUILDFLAG(IS_TIZEN) registry->AddInterface( base::BindRepeating(&wrt::XWalkExtensionManager::Bind), content::GetUIThreadTaskRunner({})); +#endif } #if BUILDFLAG(IS_TIZEN_TV) diff --git a/tizen_src/ewk/efl_integration/content_main_delegate_efl.cc b/tizen_src/ewk/efl_integration/content_main_delegate_efl.cc index 7024865..08b3a35 100644 --- a/tizen_src/ewk/efl_integration/content_main_delegate_efl.cc +++ b/tizen_src/ewk/efl_integration/content_main_delegate_efl.cc @@ -8,7 +8,6 @@ #include "browser/xwalk_extension_browser_efl.h" #include "command_line_efl.h" #include "common/content_switches_efl.h" -#include "components/xwalk_extensions/browser/xwalk_extension_manager.h" #include "content/browser/gpu/gpu_main_thread_factory.h" #include "content/browser/gpu/gpu_process_host.h" #include "content/common/locale_efl.h" @@ -18,6 +17,11 @@ #include "content_browser_client_efl.h" #include "renderer/content_renderer_client_efl.h" #include "ui/base/resource/resource_bundle.h" + +#if BUILDFLAG(IS_TIZEN) +#include "components/xwalk_extensions/browser/xwalk_extension_manager.h" +#endif + #if BUILDFLAG(IS_TIZEN_TV) #include "content/public/browser/render_process_host.h" #include "devtools_port_manager.h" @@ -94,6 +98,7 @@ void ContentMainDelegateEfl::PreSandboxStartupBrowser() { // needed for gpu thread content::RegisterGpuMainThreadFactory(CreateInProcessGpuThread); +#if BUILDFLAG(IS_TIZEN) // switches::kXWalkExtensionJsonPath SHOULD be set before MainDelegate init. auto json_path = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( @@ -105,6 +110,7 @@ void ContentMainDelegateEfl::PreSandboxStartupBrowser() { extension_manager->SetDelegate( std::make_unique()); } +#endif } void ContentMainDelegateEfl::PreSandboxStartup() { diff --git a/tizen_src/ewk/efl_integration/renderer/content_renderer_client_efl.cc b/tizen_src/ewk/efl_integration/renderer/content_renderer_client_efl.cc index 7342715..c55cca8 100644 --- a/tizen_src/ewk/efl_integration/renderer/content_renderer_client_efl.cc +++ b/tizen_src/ewk/efl_integration/renderer/content_renderer_client_efl.cc @@ -9,6 +9,8 @@ #if BUILDFLAG(IS_TIZEN) #include + +#include "components/xwalk_extensions/renderer/xwalk_extension_renderer_controller.h" #endif #include "base/command_line.h" @@ -17,7 +19,6 @@ #include "common/content_switches_efl.h" #include "common/render_messages_ewk.h" #include "components/visitedlink/renderer/visitedlink_reader.h" -#include "components/xwalk_extensions/renderer/xwalk_extension_renderer_controller.h" #include "content/common/locale_efl.h" #include "content/common/paths_efl.h" #include "content/public/common/content_switches.h" @@ -169,6 +170,7 @@ void ContentRendererClientEfl::RenderThreadStarted() { if (!command_line.HasSwitch(switches::kSingleProcess)) LocaleEfl::Initialize(); +#if BUILDFLAG(IS_TIZEN) if (command_line.HasSwitch(switches::kXWalkExtensionJsonPath)) { wrt::XWalkExtensionRendererController::GetInstance().SetPrivilegeChecker( base::BindRepeating([]() -> bool { @@ -177,6 +179,7 @@ void ContentRendererClientEfl::RenderThreadStarted() { return true; })); } +#endif } void ContentRendererClientEfl::RenderFrameCreated(content::RenderFrame* render_frame) { @@ -268,9 +271,10 @@ void ContentRendererClientEfl::DidCreateScriptContext( content::RenderFrame* render_frame, v8::Handle context, int world_id) { +#if BUILDFLAG(IS_TIZEN) if (ShouldRegisterXWalkExtension(world_id)) wrt::XWalkExtensionRendererController::DidCreateScriptContext(context); - +#endif if (!widget_) return; @@ -299,9 +303,10 @@ void ContentRendererClientEfl::WillReleaseScriptContext( blink::WebFrame* frame, v8::Handle context, int world_id) { +#if BUILDFLAG(IS_TIZEN) if (ShouldRegisterXWalkExtension(world_id)) wrt::XWalkExtensionRendererController::WillReleaseScriptContext(context); - +#endif if (widget_) widget_->StopSession(context); } -- 2.7.4 From f24ac826223268878f4d2f225174af12e728308c Mon Sep 17 00:00:00 2001 From: Ayush Kumar Date: Fri, 24 Mar 2023 13:20:10 +0530 Subject: [PATCH 03/16] Fix major SVACE issues This patch fixes major SVACE issues. Change-Id: Ie5fbe44a3aa99aa1589718a8d7d64d75453ef5d0 Signed-off-by: Ayush Kumar --- .../browser/renderer_host/rwhv_aura_common_helper_efl.cc | 10 +++++----- .../renderer_host/rwhv_aura_offscreen_helper_efl.cc | 16 +++++++++------- .../chromium_impl/ui/base/clipboard/clipboard_efl.cc | 1 + .../browser/autofill/autofill_client_efl.cc | 1 + tizen_src/ewk/efl_integration/eweb_view.cc | 9 +++++---- tizen_src/ewk/efl_integration/login_delegate_efl.cc | 3 +++ .../efl_integration/public/ewk_media_playback_info.cc | 1 + tizen_src/ewk/efl_integration/public/ewk_view.cc | 1 + .../renderer/plugins/plugin_placeholder_hole.cc | 3 +++ 9 files changed, 29 insertions(+), 16 deletions(-) diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.cc b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.cc index 0f7e55a..7c3a3d8 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.cc +++ b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.cc @@ -275,12 +275,12 @@ ui::IMContextEfl* RWHVAuraCommonHelperEfl::GetIMContextEfl() { // im_context_efl_ is always nullptr on desktop efl. #if BUILDFLAG(IS_TIZEN) if (!im_context_efl_) { - if (GetEventHandler() && GetEventHandler()->GetIMContextEfl()) { - im_context_efl_ = GetEventHandler()->GetIMContextEfl(); + im_context_efl_ = + GetEventHandler() ? GetEventHandler()->GetIMContextEfl() : nullptr; + if (im_context_efl_) im_context_efl_->SetRWHHelper(rwh_helper_.get()); - return im_context_efl_; - } - LOG(ERROR) << "im_context_efl_ is not set"; + else + LOG(ERROR) << "im_context_efl_ is not set"; } #endif return im_context_efl_; diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.cc b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.cc index 96feda0..c09f396 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.cc +++ b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.cc @@ -1067,13 +1067,15 @@ void RWHVAuraOffscreenHelperEfl::RequestMagnifierSnapshotAsync( gfx::Rect view_rect = GetViewBoundsInPix(); // Adjust snapshot rect for email app - auto visible_viewport_rect = - GetSelectionController()->GetVisibleViewportRect(); - int hidden_view_width = visible_viewport_rect.x() - view_rect.x(); - int hidden_view_height = visible_viewport_rect.y() - view_rect.y(); - if (hidden_view_height || hidden_view_width) { - snapshot_area.set_x(snapshot_area.x() + hidden_view_width); - snapshot_area.set_y(snapshot_area.y() + hidden_view_height); + if (GetSelectionController()) { + auto visible_viewport_rect = + GetSelectionController()->GetVisibleViewportRect(); + int hidden_view_width = visible_viewport_rect.x() - view_rect.x(); + int hidden_view_height = visible_viewport_rect.y() - view_rect.y(); + if (hidden_view_height || hidden_view_width) { + snapshot_area.set_x(snapshot_area.x() + hidden_view_width); + snapshot_area.set_y(snapshot_area.y() + hidden_view_height); + } } magnifier_snapshot_request_ = diff --git a/tizen_src/chromium_impl/ui/base/clipboard/clipboard_efl.cc b/tizen_src/chromium_impl/ui/base/clipboard/clipboard_efl.cc index 032fc01..dd7325a 100644 --- a/tizen_src/chromium_impl/ui/base/clipboard/clipboard_efl.cc +++ b/tizen_src/chromium_impl/ui/base/clipboard/clipboard_efl.cc @@ -232,5 +232,6 @@ std::vector ClipboardEfl::GetStandardFormats( ClipboardBuffer buffer, const DataTransferEndpoint* data_dst) const { NOTIMPLEMENTED(); + return {}; } } //namespace ui diff --git a/tizen_src/ewk/efl_integration/browser/autofill/autofill_client_efl.cc b/tizen_src/ewk/efl_integration/browser/autofill/autofill_client_efl.cc index 2b7103d..de49c85 100644 --- a/tizen_src/ewk/efl_integration/browser/autofill/autofill_client_efl.cc +++ b/tizen_src/ewk/efl_integration/browser/autofill/autofill_client_efl.cc @@ -402,6 +402,7 @@ void AutofillClientEfl::UpdateWebauthnOfferDialogWithError() { bool AutofillClientEfl::CloseWebauthnDialog() { NOTIMPLEMENTED(); + return false; } void AutofillClientEfl::ConfirmSaveUpiIdLocally( diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index 6df07b9..f3909f7 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -833,10 +833,11 @@ void EWebView::ExecuteEditCommand(const char* command, const char* value) { optional_value = absl::make_optional(base::ASCIIToUTF16(value)); WebContentsImpl* wc = static_cast(web_contents_.get()); - if (wc && wc->GetFocusedFrameWidgetInputHandler()) { - wc->GetFocusedFrameWidgetInputHandler()->ExecuteEditCommand( - std::string(command), optional_value); - } + if (!wc || !wc->GetFocusedFrameWidgetInputHandler()) + return; + + wc->GetFocusedFrameWidgetInputHandler()->ExecuteEditCommand( + std::string(command), optional_value); } #if BUILDFLAG(IS_TIZEN) diff --git a/tizen_src/ewk/efl_integration/login_delegate_efl.cc b/tizen_src/ewk/efl_integration/login_delegate_efl.cc index 708a1de..ecac7d9 100644 --- a/tizen_src/ewk/efl_integration/login_delegate_efl.cc +++ b/tizen_src/ewk/efl_integration/login_delegate_efl.cc @@ -55,6 +55,9 @@ void LoginDelegateEfl::HandleHttpAuthRequestOnUIThread() { web_contents_->GetDelegate()); if (first_auth_attempt_ && auth_info_->is_proxy) { + if (!delegate->web_view() || !delegate->web_view()->context()) + return; + const EWebContext* web_context = delegate->web_view()->context()->GetImpl(); DCHECK(web_context); diff --git a/tizen_src/ewk/efl_integration/public/ewk_media_playback_info.cc b/tizen_src/ewk/efl_integration/public/ewk_media_playback_info.cc index 1d7d318..4f36ddbb 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_media_playback_info.cc +++ b/tizen_src/ewk/efl_integration/public/ewk_media_playback_info.cc @@ -94,6 +94,7 @@ void ewk_media_playback_info_decoder_set( const int ewk_media_playback_info_video_id_get(Ewk_Media_Playback_Info* data) { LOG_EWK_API_MOCKUP(); + return 0; } Ewk_Media_Playback_Info* ewkMediaPlaybackInfoCreate(const int player_id, diff --git a/tizen_src/ewk/efl_integration/public/ewk_view.cc b/tizen_src/ewk/efl_integration/public/ewk_view.cc index 118651a..14ab2d0 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_view.cc +++ b/tizen_src/ewk/efl_integration/public/ewk_view.cc @@ -1009,6 +1009,7 @@ char* ewk_view_get_cookies_for_url(Evas_Object* view, const char* url) EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context(), 0); + EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context()->cookieManager(), 0); std::string cookiesForURL = impl->context()->cookieManager()->GetCookiesForURL(std::string(url)); if (cookiesForURL.empty()) diff --git a/tizen_src/ewk/efl_integration/renderer/plugins/plugin_placeholder_hole.cc b/tizen_src/ewk/efl_integration/renderer/plugins/plugin_placeholder_hole.cc index a78eed8..a5730a6 100644 --- a/tizen_src/ewk/efl_integration/renderer/plugins/plugin_placeholder_hole.cc +++ b/tizen_src/ewk/efl_integration/renderer/plugins/plugin_placeholder_hole.cc @@ -413,6 +413,9 @@ void PluginPlaceholderHole::NotifyGeometryChanged() { v8::Local func_handle = v8::Local::Cast(func_val); v8::TryCatch try_catch(isolate); + if (!plugin() || !plugin()->Container()) + return; + gfx::Point position_in_root_frame = plugin()->Container()->LocalToRootFramePoint(local_rect_.origin()); -- 2.7.4 From 903a554f50298b3404e909343aa370b683911fb1 Mon Sep 17 00:00:00 2001 From: jiangyuwei Date: Thu, 23 Mar 2023 15:43:29 +0800 Subject: [PATCH 04/16] [M108 Migration][VD] Enable Suspend & resume feature Because RenderViewObserverEfl unavailable in M108, so need to implement in widget.mojom References: - https://review.tizen.org/gerrit/284921/ Change-Id: Ib558fcb5a21f34c0aaf7946b07c161342ee74e1a Signed-off-by: jiangyuwei --- .../renderer_host/render_widget_host_impl.cc | 10 +++++ .../renderer_host/render_widget_host_impl.h | 5 +++ content/public/browser/render_view_host.h | 5 +++ .../public/mojom/widget/platform_widget.mojom | 6 +++ third_party/blink/public/web/web_view.h | 5 +++ .../blink/renderer/core/exported/web_view_impl.cc | 49 ++++++++++++++++++++++ .../blink/renderer/core/exported/web_view_impl.h | 5 +++ .../renderer/core/frame/web_frame_widget_impl.cc | 10 +++++ .../renderer/core/frame/web_frame_widget_impl.h | 5 +++ third_party/blink/renderer/core/page/page.cc | 9 ++++ third_party/blink/renderer/core/page/page.h | 24 +++++++++++ .../blink/renderer/platform/widget/widget_base.cc | 10 +++++ .../blink/renderer/platform/widget/widget_base.h | 6 +++ .../renderer/platform/widget/widget_base_client.h | 5 +++ .../efl_integration/common/render_messages_ewk.h | 2 - tizen_src/ewk/efl_integration/eweb_view.cc | 21 +++------- 16 files changed, 160 insertions(+), 17 deletions(-) diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 02d6156..05c1be4 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -592,6 +592,16 @@ void RenderWidgetHostImpl::SetView(RenderWidgetHostViewBase* view) { } } +#if BUILDFLAG(IS_TIZEN) +void RenderWidgetHostImpl::PauseScheduledTasks() { + blink_widget_->PauseScheduledTasks(); +} + +void RenderWidgetHostImpl::UnPauseScheduledTasks() { + blink_widget_->UnPauseScheduledTasks(); +} +#endif + // static const base::TimeDelta RenderWidgetHostImpl::kActivationNotificationExpireTime = base::Milliseconds(300); diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index 99f88c4..937c437 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -469,6 +469,11 @@ class CONTENT_EXPORT RenderWidgetHostImpl #endif #endif +#if BUILDFLAG(IS_TIZEN) + void PauseScheduledTasks(); + void UnPauseScheduledTasks(); +#endif + // Returns true if the RenderWidget is hidden. bool is_hidden() const { return is_hidden_; } diff --git a/content/public/browser/render_view_host.h b/content/public/browser/render_view_host.h index 9979c25..821d751 100644 --- a/content/public/browser/render_view_host.h +++ b/content/public/browser/render_view_host.h @@ -71,6 +71,11 @@ class CONTENT_EXPORT RenderViewHost { // Instructs the `blink::WebView` to send back updates to the preferred size. virtual void EnablePreferredSizeMode() = 0; +#if BUILDFLAG(IS_TIZEN) + // Returns true if the RenderView is active and has not crashed. + virtual bool IsRenderViewLive() const = 0; +#endif + using TraceProto = perfetto::protos::pbzero::RenderViewHost; // Write a representation of this object into a trace. virtual void WriteIntoTrace( diff --git a/third_party/blink/public/mojom/widget/platform_widget.mojom b/third_party/blink/public/mojom/widget/platform_widget.mojom index b222ca4..1e348d4 100644 --- a/third_party/blink/public/mojom/widget/platform_widget.mojom +++ b/third_party/blink/public/mojom/widget/platform_widget.mojom @@ -143,6 +143,12 @@ interface Widget { [EnableIf=is_efl] PrintToPdf(uint32 width, uint32 height, mojo_base.mojom.FilePath filename); + [EnableIf=is_tizen] + PauseScheduledTasks(); + + [EnableIf=is_tizen] + UnPauseScheduledTasks(); + [EnableIf=is_efl] QueryInputType() => (bool input_type); diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h index 608a2ee..3f8f71a 100644 --- a/third_party/blink/public/web/web_view.h +++ b/third_party/blink/public/web/web_view.h @@ -412,6 +412,11 @@ class BLINK_EXPORT WebView { // Freezes or unfreezes the page and all the local frames. virtual void SetPageFrozen(bool frozen) = 0; +#if BUILDFLAG(IS_TIZEN) + virtual void PauseScheduledTasks() = 0; + virtual void UnpauseScheduledTasks() = 0; +#endif + // Autoplay configuration ----------------------------------------------- // Sets the autoplay flags for this webview's page. diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index ad878e5..ef2abd1 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc @@ -184,6 +184,10 @@ #include "ui/base/ui_base_features.h" #include "ui/gfx/geometry/skia_conversions.h" +#if BUILDFLAG(IS_TIZEN_TV) +#include "third_party/blink/public/platform/web_application_type.h" +#endif + #if !BUILDFLAG(IS_MAC) #include "skia/ext/legacy_display_globals.h" #include "third_party/blink/public/platform/web_font_render_style.h" @@ -1287,6 +1291,51 @@ void WebViewImpl::DidUpdateBrowserControls() { } } +#if BUILDFLAG(IS_TIZEN) +void WebViewImpl::PauseScheduledTasks() { + if (!MainFrameImpl()) + return; + + if (Page* page = GetPage()) { + page->SetIsSuspended(true); + page->SetPaused(true); + } + +#if BUILDFLAG(IS_TIZEN_TV) + // when browser/app switch to BG and did not hidden webview ,the behavior cause + // high cpu issue.So we need to suspend compositor thread. + LOG(INFO) << "APP now suspend"; + MainFrameImpl()->FrameWidgetImpl()->SetCompositorVisible(false); +#endif +} + +void WebViewImpl::UnpauseScheduledTasks() { + if (!MainFrameImpl()) + return; + Page* page = GetPage(); + if (!page) + return; +#if BUILDFLAG(IS_TIZEN_TV) + // If floating video window existed and not current page, need to prevent + // media resume + LOG(INFO) << "APP now resume"; + if (IsWebBrowser()) { + if (Client()->HasFloatingVideoWindowOn() && + page->IsFloatingPage()) { + LOG(INFO) << "Floating video window existed, but not current page"; + page->NotifyViewResumedByTabSwitching(true); + } else { + page->NotifyViewResumedByTabSwitching(false); + } + } + MainFrameImpl()->FrameWidgetImpl()->SetCompositorVisible(true); +#endif + + page->SetIsSuspended(false); + page->SetPaused(false); +} +#endif + BrowserControls& WebViewImpl::GetBrowserControls() { return GetPage()->GetBrowserControls(); } diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h index 18d4dd8..3c1075a 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h @@ -522,6 +522,11 @@ class CORE_EXPORT WebViewImpl final : public WebView, WebSettingsImpl* SettingsImpl(); +#if BUILDFLAG(IS_TIZEN) + virtual void PauseScheduledTasks(); + virtual void UnpauseScheduledTasks(); +#endif + BrowserControls& GetBrowserControls(); // Called anytime browser controls layout height or content offset have // changed. diff --git a/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc b/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc index 3f8d61b..8b057e4 100644 --- a/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc +++ b/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc @@ -4328,6 +4328,16 @@ void WebFrameWidgetImpl::OrientationChanged() { local_root_->SendOrientationChangeEvent(); } +#if BUILDFLAG(IS_TIZEN) +void WebFrameWidgetImpl::PauseScheduledTasks() { + View()->PauseScheduledTasks(); +} + +void WebFrameWidgetImpl::UnPauseScheduledTasks() { + View()->UnpauseScheduledTasks(); +} +#endif + void WebFrameWidgetImpl::DidUpdateSurfaceAndScreen( const display::ScreenInfos& previous_original_screen_infos) { display::ScreenInfo screen_info = widget_base_->GetScreenInfo(); diff --git a/third_party/blink/renderer/core/frame/web_frame_widget_impl.h b/third_party/blink/renderer/core/frame/web_frame_widget_impl.h index 833586a..b97c4a9 100644 --- a/third_party/blink/renderer/core/frame/web_frame_widget_impl.h +++ b/third_party/blink/renderer/core/frame/web_frame_widget_impl.h @@ -743,6 +743,11 @@ class CORE_EXPORT WebFrameWidgetImpl #endif #endif +#if BUILDFLAG(IS_TIZEN) + void PauseScheduledTasks() override; + void UnPauseScheduledTasks() override; +#endif + void OrientationChanged() override; void DidUpdateSurfaceAndScreen( const display::ScreenInfos& previous_original_screen_infos) override; diff --git a/third_party/blink/renderer/core/page/page.cc b/third_party/blink/renderer/core/page/page.cc index 2ad0cb0..2985dc4 100644 --- a/third_party/blink/renderer/core/page/page.cc +++ b/third_party/blink/renderer/core/page/page.cc @@ -229,6 +229,9 @@ Page::Page(base::PassKey, next_related_page_(this), prev_related_page_(this), autoplay_flags_(0), +#if BUILDFLAG(IS_TIZEN) + m_isSuspended(false), +#endif web_text_autosizer_page_info_({0, 0, 1.f}) { DCHECK(!AllPages().Contains(this)); AllPages().insert(this); @@ -1144,6 +1147,12 @@ void Page::SetVisionDeficiency(VisionDeficiency new_vision_deficiency) { } } +#if BUILDFLAG(IS_TIZEN) +void Page::SetIsSuspended(bool isSuspended) { + m_isSuspended = isSuspended; +} +#endif + void Page::Animate(base::TimeTicks monotonic_frame_begin_time) { GetAutoscrollController().Animate(); Animator().ServiceScriptedAnimations(monotonic_frame_begin_time); diff --git a/third_party/blink/renderer/core/page/page.h b/third_party/blink/renderer/core/page/page.h index e165464..0414e1f 100644 --- a/third_party/blink/renderer/core/page/page.h +++ b/third_party/blink/renderer/core/page/page.h @@ -361,6 +361,12 @@ class CORE_EXPORT Page final : public GarbageCollected, const mojom::blink::TextAutosizerPageInfo& page_info) { web_text_autosizer_page_info_ = page_info; } + +#if BUILDFLAG(IS_TIZEN) + void SetIsSuspended(bool); + bool IsSuspended() const { return m_isSuspended; }; +#endif + const mojom::blink::TextAutosizerPageInfo& TextAutosizerPageInfo() const { return web_text_autosizer_page_info_; } @@ -410,6 +416,16 @@ class CORE_EXPORT Page final : public GarbageCollected, static void PrepareForLeakDetection(); +#if BUILDFLAG(IS_TIZEN_TV) + bool IsFloatingPage() const { return is_floating_page_; } + void NotifyViewResumedByTabSwitching(bool enable) { + is_view_resumed_by_tab_switching_ = enable; + } + bool IsViewResumedByTabSwitching() const { + return is_view_resumed_by_tab_switching_; + } +#endif + // Fully invalidate paint of all local frames in this page. void InvalidatePaint(); @@ -519,6 +535,10 @@ class CORE_EXPORT Page final : public GarbageCollected, int subframe_count_; +#if BUILDFLAG(IS_TIZEN_TV) + bool is_view_resumed_by_tab_switching_ = false; +#endif + HeapHashSet> plugins_changed_observers_; // A circular, double-linked list of pages that are related to the current @@ -538,6 +558,10 @@ class CORE_EXPORT Page final : public GarbageCollected, // Emulated vision deficiency, set from DevTools. VisionDeficiency vision_deficiency_ = VisionDeficiency::kNoVisionDeficiency; +#if BUILDFLAG(IS_TIZEN) + bool m_isSuspended; +#endif + int32_t autoplay_flags_; // Accessed by frames to determine whether to expose the PortalHost object. diff --git a/third_party/blink/renderer/platform/widget/widget_base.cc b/third_party/blink/renderer/platform/widget/widget_base.cc index 63fdc24..e585cd2 100644 --- a/third_party/blink/renderer/platform/widget/widget_base.cc +++ b/third_party/blink/renderer/platform/widget/widget_base.cc @@ -552,6 +552,16 @@ void WidgetBase::WasHidden() { client_->WasHidden(); } +#if BUILDFLAG(IS_TIZEN) +void WidgetBase::PauseScheduledTasks() { + client_->PauseScheduledTasks(); +} + +void WidgetBase::UnPauseScheduledTasks() { + client_->UnPauseScheduledTasks(); +} +#endif + void WidgetBase::WasShown(bool was_evicted, mojom::blink::RecordContentToVisibleTimeRequestPtr record_tab_switch_time_request) { diff --git a/third_party/blink/renderer/platform/widget/widget_base.h b/third_party/blink/renderer/platform/widget/widget_base.h index 665bdcf..9c9b39e 100644 --- a/third_party/blink/renderer/platform/widget/widget_base.h +++ b/third_party/blink/renderer/platform/widget/widget_base.h @@ -159,6 +159,12 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget, void RequestSelectionRect(RequestSelectionRectCallback callback) override; void ResetLastInteractedElements() override; #endif + +#if BUILDFLAG(IS_TIZEN) + void PauseScheduledTasks() override; + void UnPauseScheduledTasks() override; +#endif + void WasHidden() override; void WasShown(bool was_evicted, mojom::blink::RecordContentToVisibleTimeRequestPtr diff --git a/third_party/blink/renderer/platform/widget/widget_base_client.h b/third_party/blink/renderer/platform/widget/widget_base_client.h index 4b4bd1e6..51910af 100644 --- a/third_party/blink/renderer/platform/widget/widget_base_client.h +++ b/third_party/blink/renderer/platform/widget/widget_base_client.h @@ -197,6 +197,11 @@ class WidgetBaseClient { #endif +#if BUILDFLAG(IS_TIZEN) + virtual void PauseScheduledTasks() {} + virtual void UnPauseScheduledTasks() {} +#endif + // Convert screen coordinates to device emulated coordinates (scaled // coordinates when devtools is used). This occurs for popups where their // window bounds are emulated. diff --git a/tizen_src/ewk/efl_integration/common/render_messages_ewk.h b/tizen_src/ewk/efl_integration/common/render_messages_ewk.h index b2ed7f2..b211d96 100644 --- a/tizen_src/ewk/efl_integration/common/render_messages_ewk.h +++ b/tizen_src/ewk/efl_integration/common/render_messages_ewk.h @@ -147,8 +147,6 @@ IPC_MESSAGE_ROUTED4(EwkViewMsg_DoHitTestAsync, // Tells the renderer to clear the cache. IPC_MESSAGE_ROUTED0(EwkViewMsg_UseSettingsFont) IPC_MESSAGE_ROUTED0(EwkViewMsg_SetBrowserFont) -IPC_MESSAGE_ROUTED0(EwkViewMsg_SuspendScheduledTask) -IPC_MESSAGE_ROUTED0(EwkViewMsg_ResumeScheduledTasks) IPC_MESSAGE_ROUTED2(EwkViewMsg_SetScroll, int, /* horizontal position */ diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index f3909f7..5ba9fd0 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -757,13 +757,10 @@ void EWebView::Suspend() { #if !defined(EWK_BRINGUP) // FIXME: m69 bringup rfh->BlockRequestsForFrame(); #endif -#if 0 - content::GetIOThreadTaskRunner({})->PostTask(FROM_HERE, base::BindOnce( - &content::ResourceDispatcherHost::BlockRequestsForFrameFromUI, rfh)); - - if (rvh) - rvh->Send(new EwkViewMsg_SuspendScheduledTask(rvh->GetRoutingID())); -#endif + if (rvh->IsRenderViewLive()) { + RenderWidgetHostImpl* rwhi = static_cast(rvh->GetWidget()); + rwhi->PauseScheduledTasks(); + } } void EWebView::Resume() { @@ -775,14 +772,8 @@ void EWebView::Resume() { #if !defined(EWK_BRINGUP) // FIXME: m69 bringup rfh->ResumeBlockedRequestsForFrame(); #endif -#if 0 - content::GetIOThreadTaskRunner({})->PostTask(FROM_HERE, base::BindOnce( - &content::ResourceDispatcherHost::ResumeBlockedRequestsForFrameFromUI, - rfh)); - - if (rvh) - rvh->Send(new EwkViewMsg_ResumeScheduledTasks(rvh->GetRoutingID())); -#endif + if (rvh->IsRenderViewLive() && rwhva()) + rwhva()->host()->UnPauseScheduledTasks(); } #if BUILDFLAG(IS_TIZEN_TV) -- 2.7.4 From 93499dc65a8b237c3a21e873db49bf4286fa9705 Mon Sep 17 00:00:00 2001 From: v-saha Date: Fri, 24 Mar 2023 18:32:47 +0530 Subject: [PATCH 05/16] Fix critical SVACE issue This patch fixes some critical SVACE issues. Change-Id: I48296ccf49643421f7210d8d8d0502f31f38705a Signed-off-by: v-saha --- .../renderer/xwalk_extension_renderer_controller.cc | 2 +- tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.h | 4 ++-- .../chromium_impl/content/browser/selection/selection_handle_efl.h | 2 +- .../content/browser/selection/selection_magnifier_efl.h | 6 +++--- .../content/browser/web_contents/web_contents_impl_efl.cc | 6 +++--- .../ewk/efl_integration/browser/web_view_browser_message_filter.cc | 2 ++ tizen_src/ewk/efl_integration/eweb_context.h | 2 +- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/tizen_src/chromium_impl/components/xwalk_extensions/renderer/xwalk_extension_renderer_controller.cc b/tizen_src/chromium_impl/components/xwalk_extensions/renderer/xwalk_extension_renderer_controller.cc index 71ac916..37c5198 100644 --- a/tizen_src/chromium_impl/components/xwalk_extensions/renderer/xwalk_extension_renderer_controller.cc +++ b/tizen_src/chromium_impl/components/xwalk_extensions/renderer/xwalk_extension_renderer_controller.cc @@ -210,7 +210,7 @@ int32_t XWalkExtensionRendererController::CreateInstance( return 0; } - int32_t id; + int32_t id = 0; browser_->CreateInstance(module->GetName(), &id, &jscode); instance_map_[id] = module; return id; diff --git a/tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.h b/tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.h index f11164e..532b99d 100644 --- a/tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.h +++ b/tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.h @@ -165,8 +165,8 @@ class CONTENT_EXPORT TizenRendererImpl // Identifiers to find the RenderFrameHost that created |this|. // NOTE: We store these IDs rather than a RenderFrameHost* because we do not // know when the RenderFrameHost is destroyed. - int render_process_id_; - int routing_id_; + int render_process_id_ = 0; + int routing_id_ = 0; // Temporary callback used for Initialize(). media::PipelineStatusCallback init_cb_; diff --git a/tizen_src/chromium_impl/content/browser/selection/selection_handle_efl.h b/tizen_src/chromium_impl/content/browser/selection/selection_handle_efl.h index a886fbf..5fe2795 100644 --- a/tizen_src/chromium_impl/content/browser/selection/selection_handle_efl.h +++ b/tizen_src/chromium_impl/content/browser/selection/selection_handle_efl.h @@ -85,7 +85,7 @@ class SelectionHandleEfl { SelectionControllerEfl& controller_; // Handle object - Evas_Object* handle_; + Evas_Object* handle_ = nullptr; // Is pressed bool pressed_; diff --git a/tizen_src/chromium_impl/content/browser/selection/selection_magnifier_efl.h b/tizen_src/chromium_impl/content/browser/selection/selection_magnifier_efl.h index a693783..50dd9af 100644 --- a/tizen_src/chromium_impl/content/browser/selection/selection_magnifier_efl.h +++ b/tizen_src/chromium_impl/content/browser/selection/selection_magnifier_efl.h @@ -42,16 +42,16 @@ class SelectionMagnifierEfl { SelectionControllerEfl* controller_; // Magnifier - Evas_Object* container_; + Evas_Object* container_ = nullptr; // Image displayed on popup Evas_Object* content_image_; // Magnifier Height - int height_; + int height_ = 0; // Magnifier width - int width_; + int width_ = 0; // Is magnifier showing bool shown_; diff --git a/tizen_src/chromium_impl/content/browser/web_contents/web_contents_impl_efl.cc b/tizen_src/chromium_impl/content/browser/web_contents/web_contents_impl_efl.cc index b122681..d61070d 100644 --- a/tizen_src/chromium_impl/content/browser/web_contents/web_contents_impl_efl.cc +++ b/tizen_src/chromium_impl/content/browser/web_contents/web_contents_impl_efl.cc @@ -135,9 +135,9 @@ FrameTree* WebContentsImplEfl::CreateNewWindow( if (efl_delegate_) { if (efl_delegate_->WebContentsCreateAsync(std::move(callback))) { - DCHECK(new_contents); - return &( - static_cast(new_contents)->GetPrimaryFrameTree()); + return new_contents ? &(static_cast(new_contents) + ->GetPrimaryFrameTree()) + : nullptr; } else { return nullptr; } diff --git a/tizen_src/ewk/efl_integration/browser/web_view_browser_message_filter.cc b/tizen_src/ewk/efl_integration/browser/web_view_browser_message_filter.cc index 96a0cd3..139d271 100644 --- a/tizen_src/ewk/efl_integration/browser/web_view_browser_message_filter.cc +++ b/tizen_src/ewk/efl_integration/browser/web_view_browser_message_filter.cc @@ -41,6 +41,8 @@ class WebViewBrowserMessageFilterPrivate CHECK(web_view_); } + virtual ~WebViewBrowserMessageFilterPrivate() = default; + void OnReceivedHitTestData(int render_view, const Hit_Test_Params& params) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); diff --git a/tizen_src/ewk/efl_integration/eweb_context.h b/tizen_src/ewk/efl_integration/eweb_context.h index dab08bc..eb910a2 100644 --- a/tizen_src/ewk/efl_integration/eweb_context.h +++ b/tizen_src/ewk/efl_integration/eweb_context.h @@ -216,7 +216,7 @@ class EWebContext { private: EWebContext(bool incognito, const std::string& injectedBundlePath); - ~EWebContext(); + virtual ~EWebContext(); friend class Ewk_Context; static void LocalStorageUsageForOrigin( const GURL& origin, -- 2.7.4 From b78bf4001233fc893c5ecc47db0c28fc92c81305 Mon Sep 17 00:00:00 2001 From: jingjieli Date: Mon, 13 Mar 2023 13:29:10 +0800 Subject: [PATCH 06/16] [M108 Migration][VD]Dummy Implementation for web security API ewk_settings_web_security_enabled_set/get Reference: https://review.tizen.org/gerrit/#/c/256343 Change-Id: I7bcf6fa71c953bcdbe5fc5831f09114693fa6d32 Signed-off-by: jingjieli --- tizen_src/ewk/efl_integration/public/ewk_settings.cc | 14 ++++++++++++++ .../ewk/efl_integration/public/ewk_settings_product.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/tizen_src/ewk/efl_integration/public/ewk_settings.cc b/tizen_src/ewk/efl_integration/public/ewk_settings.cc index 36284d3..0a22f8b 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_settings.cc +++ b/tizen_src/ewk/efl_integration/public/ewk_settings.cc @@ -846,6 +846,20 @@ Eina_Bool ewk_settings_viewport_meta_tag_get(const Ewk_Settings *settings) return EINA_FALSE; } +#if BUILDFLAG(IS_TIZEN_TV) +Eina_Bool ewk_settings_web_security_enabled_set(Ewk_Settings* settings, Eina_Bool enable) +{ + LOG_EWK_API_MOCKUP("Only for Tizen TV."); + return EINA_FALSE; +} + +Eina_Bool ewk_settings_web_security_enabled_get(const Ewk_Settings* settings) +{ + LOG_EWK_API_MOCKUP(); + return EINA_FALSE; +} +#endif + void ewk_settings_spatial_navigation_enabled_set(Ewk_Settings* settings, Eina_Bool enable) { #if BUILDFLAG(IS_TIZEN_TV) diff --git a/tizen_src/ewk/efl_integration/public/ewk_settings_product.h b/tizen_src/ewk/efl_integration/public/ewk_settings_product.h index 9f97dc9..387f598 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_settings_product.h +++ b/tizen_src/ewk/efl_integration/public/ewk_settings_product.h @@ -439,6 +439,7 @@ EXPORT_API void ewk_settings_disable_webgl_set(Ewk_Settings* settings, Eina_Bool /** * Enables/disables web security. + * This interface was deprecated since M94. * * By default, the web security is enabled. * @@ -454,6 +455,7 @@ EXPORT_API Eina_Bool ewk_settings_web_security_enabled_set(Ewk_Settings *setting /** * Returns whether the web security is enabled. + * This interface was deprecated since M94. * * @param settings settings object to query whether web security is enabled * -- 2.7.4 From b55d8865bf46e1bdf1a07137abd82f0b397ad043 Mon Sep 17 00:00:00 2001 From: xiafeng Date: Thu, 16 Mar 2023 11:18:27 +0800 Subject: [PATCH 07/16] [M108 Migration][VD]Implement ewk_settings_allow_file_access_from_external_url_set Some specific case in Tizen TV, we need to enable this. When hosted applications want to use tv device api, load file://opt/usr/apps/pepper/webapis.js located in local. But, they cannot access local because of security vulnerability(SOP) Policy of webapis.js is only located in local. Reference: https://review.tizen.org/gerrit/282771/ Change-Id: Id7e29a72dd5571770ae196d5387d97d98eb9d326 Signed-off-by: xiafeng --- content/browser/web_contents/web_contents_impl.cc | 5 +++++ content/renderer/render_frame_impl.cc | 6 ++++++ .../common/web_preferences/web_preferences_mojom_traits.cc | 4 ++++ .../blink/public/common/web_preferences/web_preferences.h | 6 ++++++ .../common/web_preferences/web_preferences_mojom_traits.h | 7 +++++++ .../blink/public/mojom/webpreferences/web_preferences.mojom | 3 +++ third_party/blink/public/web/web_document.h | 4 ++++ third_party/blink/public/web/web_settings.h | 5 +++++ third_party/blink/renderer/core/exported/web_document.cc | 11 +++++++++++ third_party/blink/renderer/core/exported/web_settings_impl.cc | 10 ++++++++++ third_party/blink/renderer/core/exported/web_settings_impl.h | 5 +++++ third_party/blink/renderer/core/exported/web_view_impl.cc | 5 +++++ third_party/blink/renderer/core/frame/settings.json5 | 5 +++++ tizen_src/ewk/efl_integration/public/ewk_settings.cc | 10 +++++++++- 14 files changed, 85 insertions(+), 1 deletion(-) diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 6b0ee8b..0b918d6 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -2966,6 +2966,11 @@ const blink::web_pref::WebPreferences WebContentsImpl::ComputeWebPreferences() { // GuestViews in the same StoragePartition need to find each other's frames. prefs.renderer_wide_named_frame_lookup = IsGuest(); +#if BUILDFLAG(IS_TIZEN_TV) + // Disallow file access from external urls by default. + prefs.allow_file_access_from_external_urls = false; +#endif + GetContentClient()->browser()->OverrideWebkitPrefs(this, &prefs); return prefs; } diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 242f20d..00e3526 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -3660,6 +3660,12 @@ void RenderFrameImpl::DidCommitNavigation( CHECK_EQ(NavigationCommitState::kWillCommit, navigation_commit_state_); navigation_commit_state_ = NavigationCommitState::kDidCommit; +#if BUILDFLAG(IS_TIZEN_TV) + if (GetWebView() && GetWebView()->GetSettings() + ->AllowFileAccessFromExternalURLs()) + frame_->GetDocument().GrantLoadLocalResources(); +#endif + WebDocumentLoader* document_loader = frame_->GetDocumentLoader(); DocumentState* document_state = DocumentState::FromDocumentLoader(document_loader); diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc index 7bb384f..8359c4d 100644 --- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc +++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc @@ -245,6 +245,10 @@ bool StructTraitswebxr_immersive_ar_allowed = data.webxr_immersive_ar_allowed(); out->renderer_wide_named_frame_lookup = data.renderer_wide_named_frame_lookup(); +#if BUILDFLAG(IS_TIZEN_TV) + out->allow_file_access_from_external_urls = + data.allow_file_access_from_external_urls(); +#endif return true; } diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h index 0b1b1e8..604d4f6 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences.h +++ b/third_party/blink/public/common/web_preferences/web_preferences.h @@ -408,6 +408,12 @@ struct BLINK_COMMON_EXPORT WebPreferences { // (false). Used by StrictMimetypeCheckForWorkerScriptsEnabled policy. bool strict_mime_type_check_for_worker_scripts_enabled = true; +#if BUILDFLAG(IS_TIZEN_TV) + // Hosted app need to get local access privilege when they use tv device api + // located in local path(file://usr/apps/pepper/webapis/webapis.js) + bool allow_file_access_from_external_urls = false; +#endif + // We try to keep the default values the same as the default values in // chrome, except for the cases where it would require lots of extra work for // the embedder to use the same default value. diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h index f63111c..5fd26e0 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h +++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h @@ -174,6 +174,13 @@ struct BLINK_COMMON_EXPORT StructTraitsIsSecureContext(); } +#if BUILDFLAG(IS_TIZEN_TV) +void WebDocument::GrantLoadLocalResources() { + if (Document* document = Unwrap()) + document->domWindow()->GetMutableSecurityOrigin()->GrantLoadLocalResources(); +} +#endif + WebString WebDocument::Encoding() const { return ConstUnwrap()->EncodingName(); } diff --git a/third_party/blink/renderer/core/exported/web_settings_impl.cc b/third_party/blink/renderer/core/exported/web_settings_impl.cc index ffe4a2c..f83cd48 100644 --- a/third_party/blink/renderer/core/exported/web_settings_impl.cc +++ b/third_party/blink/renderer/core/exported/web_settings_impl.cc @@ -805,6 +805,16 @@ bool WebSettingsImpl::UsesEncodingDetector() const { } #endif +#if BUILDFLAG(IS_TIZEN_TV) +void WebSettingsImpl::SetAllowFileAccessFromExternalURLs(bool allow) { + settings_->SetAllowFileAccessFromExternalURLs(allow); +} + +bool WebSettingsImpl::AllowFileAccessFromExternalURLs() { + return settings_->GetAllowFileAccessFromExternalURLs(); +} +#endif + #if defined(TIZEN_ATK_SUPPORT) void WebSettingsImpl::SetAccessibilityEnabled(bool enabled) { settings_->SetAccessibilityEnabled(enabled); diff --git a/third_party/blink/renderer/core/exported/web_settings_impl.h b/third_party/blink/renderer/core/exported/web_settings_impl.h index 3d896b7..6a506d3 100644 --- a/third_party/blink/renderer/core/exported/web_settings_impl.h +++ b/third_party/blink/renderer/core/exported/web_settings_impl.h @@ -234,6 +234,11 @@ class CORE_EXPORT WebSettingsImpl final : public WebSettings { bool UsesEncodingDetector() const override; #endif +#if BUILDFLAG(IS_TIZEN_TV) + void SetAllowFileAccessFromExternalURLs(bool) override; + bool AllowFileAccessFromExternalURLs() override; +#endif + #if defined(TIZEN_ATK_SUPPORT) void SetAccessibilityEnabled(bool) override; bool GetAccessibilityEnabled() override; diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index ef2abd1..c0ebd19 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc @@ -1752,6 +1752,11 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, settings->SetAccessibilityEnabled(prefs.atk_enabled); #endif +#if BUILDFLAG(IS_TIZEN_TV) + settings->SetAllowFileAccessFromExternalURLs( + prefs.allow_file_access_from_external_urls); +#endif + #if BUILDFLAG(IS_EFL) settings->SetTizenVersion(prefs.tizen_version_major, prefs.tizen_version_minor, diff --git a/third_party/blink/renderer/core/frame/settings.json5 b/third_party/blink/renderer/core/frame/settings.json5 index 5331ed9..0f0a46ed 100644 --- a/third_party/blink/renderer/core/frame/settings.json5 +++ b/third_party/blink/renderer/core/frame/settings.json5 @@ -1065,5 +1065,10 @@ initial: false, type: "bool" }, + { + name: "allowFileAccessFromExternalURLs", + initial: false, + type: "bool" + }, ], } diff --git a/tizen_src/ewk/efl_integration/public/ewk_settings.cc b/tizen_src/ewk/efl_integration/public/ewk_settings.cc index 0a22f8b..1ba1b66 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_settings.cc +++ b/tizen_src/ewk/efl_integration/public/ewk_settings.cc @@ -885,8 +885,16 @@ Eina_Bool ewk_settings_ime_panel_enabled_get(const Ewk_Settings *settings) Eina_Bool ewk_settings_allow_file_access_from_external_url_set(Ewk_Settings* settings, Eina_Bool allow) { - LOG_EWK_API_MOCKUP(); +#if BUILDFLAG(IS_TIZEN_TV) + LOG(INFO) << "ewk_settings_allow_file_access_from_external_url_set, allow: " << (bool)allow; + EINA_SAFETY_ON_NULL_RETURN_VAL(settings, EINA_FALSE); + settings->getPreferences().allow_file_access_from_external_urls = allow; + ewkUpdateWebkitPreferences(settings->getEvasObject()); + return EINA_TRUE; +#else + LOG_EWK_API_MOCKUP("Only for Tizen TV"); return EINA_FALSE; +#endif } Eina_Bool ewk_settings_swipe_to_refresh_enabled_set(Ewk_Settings* settings, Eina_Bool enable) -- 2.7.4 From 03f774f4642389c25b4fb9c521c2eb1f3e006fb5 Mon Sep 17 00:00:00 2001 From: pengxia Date: Fri, 17 Mar 2023 11:55:12 +0800 Subject: [PATCH 08/16] [M108 Aura Migration][NaCl][PPFW] Fix crash when get render process in UnregisterPepperExtensionDelegate. EWeb View will destruct in EvasObjectDelete callback called. If ewk_shutdown called before EvasObjectDelete, it may cause crash during get render process in UnregisterPepperExtensionDelegate, which is in EWeb View destructor. This change is for DF190114-00719 from M94 Aura Patch: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/279978/ Change-Id: I76685eb3ea0a9e2c1fcfc9aeedf476b52813ac05 Signed-off-by: pengxia --- tizen_src/ewk/efl_integration/eweb_view.cc | 27 ++++++++------------------- tizen_src/ewk/efl_integration/eweb_view.h | 3 +++ 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index 5ba9fd0..ae65b38 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -358,6 +358,9 @@ EWebView::EWebView(Ewk_Context* context, Evas_Object* object) use_early_rwi_(false), rwi_info_showed_(false), #endif +#if defined(TIZEN_PEPPER_EXTENSIONS) + render_frame_id_{0, 0}, +#endif is_initialized_(false) { LOG(INFO) << "EWebView: " << this; if (evas_object_) { @@ -3251,11 +3254,8 @@ EwkExtensionSystemDelegate* EWebView::GetExtensionDelegate() { if (!render_frame_host) return nullptr; - ExtensionSystemDelegateManager::RenderFrameID id; - id.render_process_id = render_frame_host->GetProcess()->GetID(); - id.render_frame_id = render_frame_host->GetRoutingID(); return static_cast( - ExtensionSystemDelegateManager::GetInstance()->GetDelegateForFrame(id)); + ExtensionSystemDelegateManager::GetInstance()->GetDelegateForFrame(render_frame_id_)); } void EWebView::SetWindowId() { @@ -3299,13 +3299,12 @@ void EWebView::RegisterPepperExtensionDelegate() { return; } - ExtensionSystemDelegateManager::RenderFrameID id; - id.render_process_id = render_frame_host->GetProcess()->GetID(); - id.render_frame_id = render_frame_host->GetRoutingID(); + render_frame_id_.render_process_id = render_frame_host->GetProcess()->GetID(); + render_frame_id_.render_frame_id = render_frame_host->GetRoutingID(); EwkExtensionSystemDelegate* delegate = new EwkExtensionSystemDelegate; ExtensionSystemDelegateManager::GetInstance()->RegisterDelegate( - id, std::unique_ptr{delegate}); + render_frame_id_, std::unique_ptr{delegate}); } void EWebView::UnregisterPepperExtensionDelegate() { @@ -3313,17 +3312,7 @@ void EWebView::UnregisterPepperExtensionDelegate() { LOG(WARNING) << "web_contents_ is nullptr, can't unregister delegate"; return; } - RenderFrameHost* render_frame_host = web_contents_->GetPrimaryMainFrame(); - if (!render_frame_host) { - LOG(WARNING) << "render_frame_host is nullptr, can't unregister delegate"; - return; - } - - ExtensionSystemDelegateManager::RenderFrameID id; - id.render_process_id = render_frame_host->GetProcess()->GetID(); - id.render_frame_id = render_frame_host->GetRoutingID(); - - if (!ExtensionSystemDelegateManager::GetInstance()->UnregisterDelegate(id)) + if (!ExtensionSystemDelegateManager::GetInstance()->UnregisterDelegate(render_frame_id_)) LOG(WARNING) << "Unregistering pepper extension delegate failed"; } #endif // defined(TIZEN_PEPPER_EXTENSIONS) diff --git a/tizen_src/ewk/efl_integration/eweb_view.h b/tizen_src/ewk/efl_integration/eweb_view.h index 981217e..ce0b1c1 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.h +++ b/tizen_src/ewk/efl_integration/eweb_view.h @@ -974,6 +974,9 @@ class EWebView { std::unique_ptr eweb_accessibility_; bool lazy_initialize_atk_ = false; #endif +#if defined(TIZEN_PEPPER_EXTENSIONS) + content::ExtensionSystemDelegateManager::RenderFrameID render_frame_id_; +#endif #if defined(TIZEN_VIDEO_HOLE) bool pending_video_hole_setting_ = false; #endif -- 2.7.4 From 6664264711345f8f6e0a93c91b9dbe70a2317854 Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Mon, 27 Mar 2023 17:12:53 +0530 Subject: [PATCH 09/16] Disable debug package for aarch64 build Change-Id: Ib65aa864e272f4a3ce6d1f6f93ebf1b69fc0b724 Signed-off-by: Chandan Padhi --- packaging/chromium-efl.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packaging/chromium-efl.spec b/packaging/chromium-efl.spec index 849920c..457ceec 100755 --- a/packaging/chromium-efl.spec +++ b/packaging/chromium-efl.spec @@ -16,6 +16,10 @@ License: LGPL-2.1 or BSD-2-Clause Source0: %{name}-%{version}.tar.gz Source1: content_shell.in +%ifarch aarch64 +%define _nodebug 1 +%endif + %if 0%{?_nodebug} %global __debug_install_post %{nil} %global debug_package %{nil} -- 2.7.4 From 191c6ca428b7d93bdc8cfa4a3fb6579c98b705a5 Mon Sep 17 00:00:00 2001 From: Gajendra N Date: Fri, 7 Oct 2022 14:22:44 +0530 Subject: [PATCH 10/16] [M108 Migration] Make sure device scale factor (DSF) is not less than 1.0 on any profile On RPI4 device, due to DPI value being low (120), DSF was computed as 0.75, this was causing some problems related to subpixel rendering on css related TCTs. This patch makes sure the DSF value is not lesser than 1.0. Change-Id: Ibde585f3a75793a4ac429e712a8572a0d922e488 Signed-off-by: Gajendra N (cherry picked from commit db4b64a66f803008fa66f08b156f31997ba9f385) --- tizen_src/chromium_impl/ui/display/device_display_info_efl.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tizen_src/chromium_impl/ui/display/device_display_info_efl.cc b/tizen_src/chromium_impl/ui/display/device_display_info_efl.cc index a39def2..a0a0f51 100644 --- a/tizen_src/chromium_impl/ui/display/device_display_info_efl.cc +++ b/tizen_src/chromium_impl/ui/display/device_display_info_efl.cc @@ -219,6 +219,12 @@ double DeviceDisplayInfoEfl::ComputeDIPScale(int dpi) const { double dip_scale = static_cast(GetDensityRange(dpi)); DCHECK(dip_scale); dip_scale /= kBaselineDPIDensity; + if (dip_scale < 1.0) { + // Scale factor should not be less than 1.0 on any profile. + // On RPI4, the computed dip_scale was 0.75 because of which subpixel + // rendering issue was seen on some css3 tct. + dip_scale = 1.0; + } return dip_scale; } else { // For platforms other than mobile, the user agents expect 1.0 as DIP scale -- 2.7.4 From 97d979a7d28607aea454cfcd4b86e2c2ede4faee Mon Sep 17 00:00:00 2001 From: wangjing Date: Fri, 24 Mar 2023 11:34:05 +0800 Subject: [PATCH 11/16] [M108 Migration] Check scroll area pointer before use -Check the pointer is not null before using, otherwise this causes the render process crashes. -Add some macro. reference: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/274002/ Change-Id: I617b8c7ee002e9b3e185aa27c17d19c9c90bb4e5 Signed-off-by: wangjing --- third_party/blink/public/web/web_view.h | 2 ++ .../blink/renderer/core/input/scroll_manager.cc | 23 ++++++++++++++++++++-- .../blink/renderer/core/input/scroll_manager.h | 8 ++++++-- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h index 3f8f71a..74df924 100644 --- a/third_party/blink/public/web/web_view.h +++ b/third_party/blink/public/web/web_view.h @@ -43,7 +43,9 @@ #include "third_party/blink/public/platform/cross_variant_mojo_util.h" #include "third_party/blink/public/platform/scheduler/web_agent_group_scheduler.h" #include "third_party/blink/public/platform/web_common.h" +#if BUILDFLAG(IS_TIZEN_TV) #include "third_party/blink/renderer/core/scroll/scroll_types.h" +#endif #include "third_party/skia/include/core/SkColor.h" #include "ui/display/mojom/screen_orientation.mojom-shared.h" diff --git a/third_party/blink/renderer/core/input/scroll_manager.cc b/third_party/blink/renderer/core/input/scroll_manager.cc index 850c181..6aaf27b 100644 --- a/third_party/blink/renderer/core/input/scroll_manager.cc +++ b/third_party/blink/renderer/core/input/scroll_manager.cc @@ -318,8 +318,12 @@ bool ScrollManager::CanScroll(const ScrollState& scroll_state, bool ScrollManager::LogicalScroll(mojom::blink::ScrollDirection direction, ui::ScrollGranularity granularity, Node* start_node, - Node* mouse_press_node, - float data) { + Node* mouse_press_node +#if BUILDFLAG(IS_TIZEN_TV) + , + float data +#endif + ) { Node* node = start_node; if (!node) @@ -361,6 +365,13 @@ bool ScrollManager::LogicalScroll(mojom::blink::ScrollDirection direction, ScrollableArea* scrollable_area = ScrollableArea::GetForScrolling(box); DCHECK(scrollable_area); +#if BUILDFLAG(IS_TIZEN_TV) + if (!scrollable_area) { + LOG(ERROR) << " Scrollable area is NULL"; + return false; + } +#endif + ScrollOffset delta = ToScrollDelta(physical_direction, ScrollableArea::DirectionBasedScrollDelta(granularity)); @@ -405,10 +416,18 @@ bool ScrollManager::LogicalScroll(mojom::blink::ScrollDirection direction, area->OnScrollFinished(); }, WrapWeakPersistent(scrollable_area))); +#if BUILDFLAG(IS_TIZEN_TV) ScrollResult result = scrollable_area->UserScroll( granularity, ToScrollDelta(physical_direction, data), std::move(callback)); +#else + ScrollResult result = scrollable_area->UserScroll( + granularity, + ToScrollDelta(physical_direction, + ScrollableArea::DirectionBasedScrollDelta(granularity)), + std::move(callback)); +#endif if (result.DidScroll()) return true; diff --git a/third_party/blink/renderer/core/input/scroll_manager.h b/third_party/blink/renderer/core/input/scroll_manager.h index 576d519..6d092a6 100644 --- a/third_party/blink/renderer/core/input/scroll_manager.h +++ b/third_party/blink/renderer/core/input/scroll_manager.h @@ -71,8 +71,12 @@ class CORE_EXPORT ScrollManager : public GarbageCollected, bool LogicalScroll(mojom::blink::ScrollDirection, ui::ScrollGranularity, Node* start_node, - Node* mouse_press_node, - float data = 1.0); + Node* mouse_press_node +#if BUILDFLAG(IS_TIZEN_TV) + , + float data = 1.0 +#endif + ); // Performs a logical scroll that chains, crossing frames, starting from // the given node or a reasonable default (focus/last clicked). -- 2.7.4 From 3df9948f2d0ecc817c1b0723f9264f3c141eaa6e Mon Sep 17 00:00:00 2001 From: "yanting.hong" Date: Mon, 27 Mar 2023 11:18:30 +0800 Subject: [PATCH 12/16] [M108 Aura Migration] Setting demuxer memory limit Migrated from: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/280160/ Change-Id: Ib78ab63a36ac9744313524baf884ac5cd6d5e1e6 Signed-off-by: yanting.hong --- media/base/BUILD.gn | 2 ++ media/base/demuxer_memory_limit.h | 10 ++++++ media/base/demuxer_memory_limit_product_tv.cc | 46 +++++++++++++++++++++++++++ media/filters/source_buffer_stream.cc | 4 +++ 4 files changed, 62 insertions(+) create mode 100644 media/base/demuxer_memory_limit_product_tv.cc diff --git a/media/base/BUILD.gn b/media/base/BUILD.gn index 42dfa5d..40d4f92 100644 --- a/media/base/BUILD.gn +++ b/media/base/BUILD.gn @@ -454,6 +454,8 @@ source_set("base") { sources += [ "demuxer_memory_limit_android.cc" ] } else if (is_castos) { sources += [ "demuxer_memory_limit_cast.cc" ] + } else if (tizen_product_tv) { + sources += [ "demuxer_memory_limit_product_tv.cc" ] } else if (is_fuchsia || tizen_multimedia) { sources += [ "demuxer_memory_limit_low.cc" ] } else { diff --git a/media/base/demuxer_memory_limit.h b/media/base/demuxer_memory_limit.h index 10f67400..9bf2262 100644 --- a/media/base/demuxer_memory_limit.h +++ b/media/base/demuxer_memory_limit.h @@ -23,6 +23,11 @@ MEDIA_EXPORT size_t GetDemuxerStreamVideoMemoryLimit(Demuxer::DemuxerTypes demuxer_type, const VideoDecoderConfig* video_config); +#if BUILDFLAG(IS_TIZEN_TV) +MEDIA_EXPORT size_t +UpdateDemuxerStreamVideoMemoryLimit(const VideoDecoderConfig* video_config); +#endif + // The maximum amount of data (in bytes) a demuxer can keep in memory overall. MEDIA_EXPORT size_t GetDemuxerMemoryLimit(Demuxer::DemuxerTypes demuxer_type); @@ -30,6 +35,11 @@ namespace internal { // These values should not be used directly, they are selected by functions // above based on platform capabilities. +#if BUILDFLAG(IS_TIZEN_TV) +constexpr size_t kDemuxerStreamVideoMemoryLimitTvUHD = 80 * 1024 * 1024; +constexpr size_t kDemuxerStreamVideoMemoryLimitTvDefault = 40 * 1024 * 1024; +constexpr size_t kDemuxerStreamAudioMemoryLimitTvDefault = 8 * 1024 * 1024; +#endif // Default audio memory limit: 12MB (5 minutes of 320Kbps content). // Medium audio memory limit: 5MB. diff --git a/media/base/demuxer_memory_limit_product_tv.cc b/media/base/demuxer_memory_limit_product_tv.cc new file mode 100644 index 0000000..f480ce3 --- /dev/null +++ b/media/base/demuxer_memory_limit_product_tv.cc @@ -0,0 +1,46 @@ +// Copyright 2019 Samsung Electronics Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "media/base/demuxer_memory_limit.h" +#include "media/base/video_decoder_config.h" + +namespace media { + +size_t UpdateDemuxerStreamVideoMemoryLimit( + const VideoDecoderConfig* video_config) { + static size_t demuxer_stream_video_memory_limit = + internal::kDemuxerStreamVideoMemoryLimitTvDefault; + + if (!video_config) + return demuxer_stream_video_memory_limit; + + const int kFHDWidth = 1920; + const int kFHDHeight = 1080; + bool isUHDResolution = video_config->coded_size().width() > kFHDWidth || + video_config->coded_size().height() > kFHDHeight; + if (isUHDResolution) { + demuxer_stream_video_memory_limit = + internal::kDemuxerStreamVideoMemoryLimitTvUHD; + } + + return demuxer_stream_video_memory_limit; +} + +size_t GetDemuxerStreamVideoMemoryLimit( + Demuxer::DemuxerTypes /*demuxer_type*/, + const VideoDecoderConfig* video_config) { + return UpdateDemuxerStreamVideoMemoryLimit(video_config); +} + +size_t GetDemuxerStreamAudioMemoryLimit( + const AudioDecoderConfig* /*audio_config*/) { + return internal::kDemuxerStreamAudioMemoryLimitTvDefault; +} + +size_t GetDemuxerMemoryLimit(Demuxer::DemuxerTypes demuxer_type) { + return GetDemuxerStreamAudioMemoryLimit(nullptr) + + GetDemuxerStreamVideoMemoryLimit(demuxer_type, nullptr); +} + +} // namespace media diff --git a/media/filters/source_buffer_stream.cc b/media/filters/source_buffer_stream.cc index 123a941..6c74451 100644 --- a/media/filters/source_buffer_stream.cc +++ b/media/filters/source_buffer_stream.cc @@ -1864,6 +1864,10 @@ bool SourceBufferStream::UpdateVideoConfig(const VideoDecoderConfig& config, DVLOG(2) << "New video config - index: " << append_config_index_; video_configs_.resize(video_configs_.size() + 1); video_configs_[append_config_index_] = config; +#if BUILDFLAG(IS_TIZEN_TV) + size_t updated_memory_limit = UpdateDemuxerStreamVideoMemoryLimit(&config); + memory_limit_ = std::max(memory_limit_, updated_memory_limit); +#endif return true; } -- 2.7.4 From 28d51e5c0290ba22098bda7c17fbc85ab2d00a39 Mon Sep 17 00:00:00 2001 From: luyq Date: Fri, 24 Mar 2023 14:57:00 +0800 Subject: [PATCH 13/16] [M108 Migration][MPEG-H][Hbbtv][MSE] Add proper demuxing for MPEG-H codec Migration from https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/272960/ Change-Id: Ibf667810251a6fd0425dd3f9ce197162518ef122 Signed-off-by: luyq --- media/filters/source_buffer_range.cc | 64 ++++++++++++++++++++++++++++++++++ media/filters/source_buffer_range.h | 6 ++++ media/filters/source_buffer_stream.cc | 10 ++++++ media/formats/mp4/mp4_stream_parser.cc | 53 +++++++++++++++++++++++++++- media/formats/mp4/mp4_stream_parser.h | 6 ++++ 5 files changed, 138 insertions(+), 1 deletion(-) diff --git a/media/filters/source_buffer_range.cc b/media/filters/source_buffer_range.cc index 07ec131..c424931 100644 --- a/media/filters/source_buffer_range.cc +++ b/media/filters/source_buffer_range.cc @@ -7,6 +7,7 @@ #include #include #include +#include #include "base/logging.h" #include "media/base/stream_parser_buffer.h" @@ -182,6 +183,69 @@ void SourceBufferRange::Seek(base::TimeDelta timestamp) { CHECK_LT(next_buffer_index_, static_cast(buffers_.size())) << next_buffer_index_ << ", size = " << buffers_.size(); } +#if BUILDFLAG(IS_TIZEN_TV) +void SourceBufferRange::ModifyFirstFrameForMpeghCodec() { + DVLOG(1) << __func__; + DVLOG(4) << ToStringForDebugging(); + // MPEGH codec starting sequence + std::vector start_sequence = {0x01, 0x00, 0x00, 0x00, 0x18, + 0x00, 0x00, 0x00, 0x00}; + + if (buffers_.size() <= next_buffer_index_) + return; + + auto old_data_ = buffers_[next_buffer_index_]->data(); + auto old_data_size = buffers_[next_buffer_index_]->data_size(); + + // This is used to check whether we do not try to add starting sequence to + // frame that already had it added while demuxing ie. first uploaded frame + bool is_starting_sequence_already_present = true; + for (int i = 0; i < start_sequence.size() && i < old_data_size; i++) { + if (start_sequence[i] != old_data_[i]) { + is_starting_sequence_already_present = false; + break; + } + } + + if (is_starting_sequence_already_present && + old_data_size > start_sequence.size()) + return; + + // New container for old data with added starting sequence + std::vector new_data = + std::vector(old_data_size + start_sequence.size()); + + // Starting sequence inserted in front of new data + // new_data.insert(new_data.begin(),start_sequence.begin(),start_sequence.end()); + for (int i = 0; i < start_sequence.size(); i++) + new_data[i] = start_sequence[i]; + + // Loop copying old data to new container + for (int i = 0; i < old_data_size; i++) + new_data[i + start_sequence.size()] = old_data_[i]; + + // Creating new buffer based on changed data + auto new_buffer = StreamParserBuffer::CopyFrom( + &(new_data.front()), new_data.size(), + buffers_[next_buffer_index_]->side_data(), + buffers_[next_buffer_index_]->side_data_size(), + buffers_[next_buffer_index_]->is_key_frame(), + buffers_[next_buffer_index_]->type(), + buffers_[next_buffer_index_]->track_id()); + + // Setting other necessary data not copied by previous function + new_buffer->SetConfigId(buffers_[next_buffer_index_]->GetConfigId()); + new_buffer->SetDecodeTimestamp( + buffers_[next_buffer_index_]->GetDecodeTimestamp()); + new_buffer->set_is_duration_estimated( + buffers_[next_buffer_index_]->is_duration_estimated()); + new_buffer->set_duration(buffers_[next_buffer_index_]->duration()); + new_buffer->set_timestamp(buffers_[next_buffer_index_]->timestamp()); + + // Swapping old buffer to new buffer. Old buffer is discarded. + buffers_[next_buffer_index_].swap(new_buffer); +} +#endif bool SourceBufferRange::CanSeekTo(base::TimeDelta timestamp) const { DVLOG(1) << __func__; diff --git a/media/filters/source_buffer_range.h b/media/filters/source_buffer_range.h index 9a2f95dd..2770dc6 100644 --- a/media/filters/source_buffer_range.h +++ b/media/filters/source_buffer_range.h @@ -247,6 +247,12 @@ class MEDIA_EXPORT SourceBufferRange { base::TimeDelta end, BufferQueue* buffers) const; +#if BUILDFLAG(IS_TIZEN_TV) + // Adds neccessary staring codes to first frames. This starting codes are + // neccessary for propper decoding of mpeg-h coded audio content. + void ModifyFirstFrameForMpeghCodec(); +#endif + size_t size_in_bytes() const { return size_in_bytes_; } private: diff --git a/media/filters/source_buffer_stream.cc b/media/filters/source_buffer_stream.cc index 6c74451..0ee1f5c0 100644 --- a/media/filters/source_buffer_stream.cc +++ b/media/filters/source_buffer_stream.cc @@ -1506,6 +1506,16 @@ void SourceBufferStream::Seek(base::TimeDelta timestamp) { } SeekAndSetSelectedRange(itr->get(), timestamp); +#if BUILDFLAG(IS_TIZEN_TV) + // After seeking on audio stream coded with mpeg-h codec, there is a need to + // one more time inject starting sequence to first frame. + if (!audio_configs_.empty()) { + const auto& config = audio_configs_[(*itr)->GetConfigIdAtTime(timestamp)]; + if (config.codec() == AudioCodec::kMpegHAudio) { + (*itr)->ModifyFirstFrameForMpeghCodec(); + } + } +#endif seek_pending_ = false; } diff --git a/media/formats/mp4/mp4_stream_parser.cc b/media/formats/mp4/mp4_stream_parser.cc index e8ad908..52e6374 100644 --- a/media/formats/mp4/mp4_stream_parser.cc +++ b/media/formats/mp4/mp4_stream_parser.cc @@ -75,7 +75,8 @@ MP4StreamParser::MP4StreamParser(const std::set& audio_object_types, has_flac_(has_flac), num_empty_samples_skipped_(0), num_invalid_conversions_(0), - num_video_keyframe_mismatches_(0) {} + num_video_keyframe_mismatches_(0), + mpegh_first_audio_frame_(true) {} MP4StreamParser::~MP4StreamParser() = default; @@ -705,6 +706,47 @@ bool MP4StreamParser::PrepareAACBuffer( } #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) +#if BUILDFLAG(ENABLE_PLATFORM_MPEG_H_AUDIO) +bool MP4StreamParser::PrepareMPEGHBuffer( + std::vector* frame_buf, + std::vector* subsamples) { + // As above, adjust subsample information to account for the headers. AAC is + // not required to use subsample encryption, so we may need to add an entry. + uint32_t sample_size = frame_buf->size(); + + std::vector sample_size_buf = {static_cast(sample_size), + static_cast(sample_size >> 8), + static_cast(sample_size >> 16), + static_cast(sample_size >> 24)}; + + frame_buf->insert(frame_buf->begin(), sample_size_buf.begin(), + sample_size_buf.end()); + + if (mpegh_first_audio_frame_) { + std::vector start_code = {0x01, 0x00, 0x00, 0x00, 0x18, + 0x00, 0x00, 0x00, 0x00}; + frame_buf->insert(frame_buf->begin(), start_code.begin(), start_code.end()); + if (subsamples->empty()) { + subsamples->push_back(SubsampleEntry( + start_code.size() + sample_size_buf.size(), + frame_buf->size() - (start_code.size() + sample_size_buf.size()))); + } else { + (*subsamples)[0].clear_bytes += + start_code.size() + sample_size_buf.size(); + } + mpegh_first_audio_frame_ = false; + } else { + if (subsamples->empty()) { + subsamples->push_back(SubsampleEntry( + sample_size_buf.size(), frame_buf->size() - sample_size_buf.size())); + } else { + (*subsamples)[0].clear_bytes += sample_size_buf.size(); + } + } + return true; +} +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) + ParseResult MP4StreamParser::EnqueueSample(BufferQueueMap* buffers) { DCHECK_EQ(state_, kEmittingSamples); @@ -869,6 +911,15 @@ ParseResult MP4StreamParser::EnqueueSample(BufferQueueMap* buffers) { return ParseResult::kError; #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) } +#if BUILDFLAG(ENABLE_PLATFORM_MPEG_H_AUDIO) + if (audio_format == FOURCC_MHM1 || audio_format == FOURCC_MHA1) { + if (!PrepareMPEGHBuffer(&frame_buf, &subsamples)) { + MEDIA_LOG(ERROR, media_log_) + << "Failed to prepare MPEG-H sample for decode"; + return ParseResult::kError; + } + } +#endif // BUILDFLAG(ENABLE_PLATFORM_MPEG_H_AUDIO) } if (decrypt_config) { diff --git a/media/formats/mp4/mp4_stream_parser.h b/media/formats/mp4/mp4_stream_parser.h index 486fd47..ae26fbc 100644 --- a/media/formats/mp4/mp4_stream_parser.h +++ b/media/formats/mp4/mp4_stream_parser.h @@ -92,6 +92,10 @@ class MEDIA_EXPORT MP4StreamParser : public StreamParser { std::vector* frame_buf, std::vector* subsamples) const; #endif +#if BUILDFLAG(ENABLE_PLATFORM_MPEG_H_AUDIO) + bool PrepareMPEGHBuffer(std::vector* frame_buf, + std::vector* subsamples); +#endif ParseResult EnqueueSample(BufferQueueMap* buffers); bool SendAndFlushSamples(BufferQueueMap* buffers); @@ -153,6 +157,8 @@ class MEDIA_EXPORT MP4StreamParser : public StreamParser { // Tracks the number of MEDIA_LOGS for video keyframe MP4<->frame mismatch. int num_video_keyframe_mismatches_; + + bool mpegh_first_audio_frame_; }; } // namespace media::mp4 -- 2.7.4 From 93f2b2e9c30856717fedc19c0629022d1dd02d22 Mon Sep 17 00:00:00 2001 From: jinbei09 Date: Fri, 10 Mar 2023 10:21:34 +0800 Subject: [PATCH 14/16] [M108 Aura Migration][NaCl][PPAPI]Fix PPAPI unittest error This patch fixes below PPAPI unittest error: [1] var_value_converter_unittest.cc build error [2] MediaStreamBufferManager unittest execute error error[1] was already fixed in patch: [M108 Aura Migration][NaCl][PPFW] Enable VD Trusted Plugins functionality https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/289527/ Ported patch from tizen_7.0: https://review.tizen.org/gerrit/#/c/270688/ Change-Id: Id837625846669d5622da9ae167ac7071a97ef5e8 --- .../media_stream_buffer_manager_unittest.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ppapi/shared_impl/media_stream_buffer_manager_unittest.cc b/ppapi/shared_impl/media_stream_buffer_manager_unittest.cc index 3e177c5..ed3b3fa 100644 --- a/ppapi/shared_impl/media_stream_buffer_manager_unittest.cc +++ b/ppapi/shared_impl/media_stream_buffer_manager_unittest.cc @@ -29,6 +29,23 @@ namespace ppapi { class MockDelegate : public MediaStreamBufferManager::Delegate { public: MockDelegate() : new_buffer_enqueue_counter_(0) {} + +#if !(defined(OFFICIAL_BUILD) && defined(NDEBUG)) + static bool HandleStandardLogMessage(int severity, + const char* file, + int line, + size_t message_start, + const std::string& str) { + if (severity == logging::LOG_FATAL) { + fprintf(stderr, str.c_str()); + } + // This function only used to monitor LogMessage, and should not + // block LogMessage from the original output destination. + // Return false to guarantee LogMessage reach original destination. + return false; + } +#endif //!(defined(OFFICIAL_BUILD) && defined(NDEBUG)) + void OnNewBufferEnqueued() override { new_buffer_enqueue_counter_++; } @@ -88,9 +105,14 @@ TEST(MediaStreamBufferManager, General) { EXPECT_DEATH(manager.EnqueueBuffer(-1), ""); EXPECT_DEATH(manager.EnqueueBuffer(kNumberOfBuffers), ""); #else + auto previous_handler = logging::GetLogMessageHandler(); + logging::SetLogMessageHandler(&MockDelegate::HandleStandardLogMessage); + EXPECT_DEATH(manager.EnqueueBuffer(-1), ".*Check failed: index >= 0.*"); EXPECT_DEATH(manager.EnqueueBuffer(kNumberOfBuffers), ".*Check failed: index < number_of_buffers_.*"); + + logging::SetLogMessageHandler(previous_handler); #endif } -- 2.7.4 From d093bf7a21ae808190bd8b91017f510c41a645cc Mon Sep 17 00:00:00 2001 From: jinbei09 Date: Fri, 10 Mar 2023 19:18:12 +0800 Subject: [PATCH 15/16] [M108 Aura Migration][NaCl][PPAPI] Crash during PPB_MessageLoop destruction When MessageLoop for PPAPI is destroyed it may happen that there are some unrun callbacks. Dtor of such callback tries to acquire global proxy lock. If such destroy is called from during call to method exposed via PPAPI to the plugin then deadlock occurs as global proxy lock is held EnterResource object form Thunk layer. Ported patch from Tizen 7.0: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/280223/ Change-Id: If50242a099ce4c95f42148cd38c565314558359c Signed-off-by: jinbei09 --- ppapi/proxy/ppb_message_loop_proxy.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ppapi/proxy/ppb_message_loop_proxy.cc b/ppapi/proxy/ppb_message_loop_proxy.cc index 06aded8..e695734 100644 --- a/ppapi/proxy/ppb_message_loop_proxy.cc +++ b/ppapi/proxy/ppb_message_loop_proxy.cc @@ -124,7 +124,11 @@ int32_t MessageLoopResource::Run() { if (should_destroy_ && nested_invocations_ == 0) { task_runner_.reset(); - single_thread_task_executor_.reset(); + { + // Message Loop dtor may try to aquire lock. + ProxyAutoUnlock lock; + single_thread_task_executor_.reset(); + } destroyed_ = true; } return PP_OK; -- 2.7.4 From 4638554b13ccc2f4776efcd7723706cc2402c76c Mon Sep 17 00:00:00 2001 From: jinbei09 Date: Thu, 23 Mar 2023 13:46:47 +0800 Subject: [PATCH 16/16] [M108 Aura Migration][NaCl][PPAPI]Fix compilation warnings in media related components. * content/renderer/pepper/video_decoder_shim.cc In some scenarios IsCodecSupported did not returned any value. Now it returns false by default. Ported patch from: Fix compilation warnings in media related components https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/280521/ Change-Id: I6ccc63073536fd1ab1cbb60d49933680e59451c4 Signed-off-by: jinbei09 --- content/renderer/pepper/video_decoder_shim.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/renderer/pepper/video_decoder_shim.cc b/content/renderer/pepper/video_decoder_shim.cc index 09449e1..d987fa2 100644 --- a/content/renderer/pepper/video_decoder_shim.cc +++ b/content/renderer/pepper/video_decoder_shim.cc @@ -52,10 +52,10 @@ bool IsCodecSupported(media::VideoCodec codec) { #endif #if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) - return media::FFmpegVideoDecoder::IsCodecSupported(codec); -#else - return false; + if (media::FFmpegVideoDecoder::IsCodecSupported(codec)) + return true; #endif + return false; } } // namespace -- 2.7.4