From 45ae09dd7db18242bbd677132b766f05f6b0d3e0 Mon Sep 17 00:00:00 2001 From: Sun-woo Nam Date: Thu, 7 Mar 2024 20:44:15 -0800 Subject: [PATCH 01/16] [MM] Report BufferingState based on the actual buffering status. Report BufferingState based on actual espp buffering status. If it can play when buffered timestamp is 500ms greater than current timestamp then report BUFFERING_HAVE_ENOUGH. If current timestamp is greater than buffered timestamp or buffer is flushed then report BUFFERING_HAVE_NOTHING. Reporting BufferingState affects setting WebMediaPlayer::ReadyState. Change-Id: Ice1a8a42a576d62b8b1e837847e5853dcd5156de Signed-off-by: Sun-woo Nam --- .../media/filters/media_player_esplusplayer.cc | 50 +++++++++++----------- .../media/filters/media_player_esplusplayer.h | 7 +-- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc index 9c7290d..e091b85 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc +++ b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc @@ -289,13 +289,11 @@ void MediaPlayerESPlusPlayer::Release() { SetShouldFeed(DemuxerStream::AUDIO, false); SetIsValid(DemuxerStream::AUDIO, false); SetReadRequested(DemuxerStream::AUDIO, false); - SetBufferingState(DemuxerStream::AUDIO, BUFFERING_HAVE_NOTHING); SetIsEos(DemuxerStream::VIDEO, false); SetShouldFeed(DemuxerStream::VIDEO, false); SetIsValid(DemuxerStream::VIDEO, false); SetReadRequested(DemuxerStream::VIDEO, false); - SetBufferingState(DemuxerStream::VIDEO, BUFFERING_HAVE_NOTHING); esplusplayer_set_ready_to_prepare_cb(esplayer_, nullptr, this); esplusplayer_set_prepare_async_done_cb(esplayer_, nullptr, this); @@ -310,6 +308,8 @@ void MediaPlayerESPlusPlayer::Release() { buffer_observer_->ResetBufferStatus(); buffer_observer_->ResetBufferStatusCallbacks(); + reported_buffering_state_ = BUFFERING_HAVE_NOTHING; + volume_ = 1.0; playback_rate_ = 0.0; is_prepared_ = false; @@ -523,6 +523,10 @@ void MediaPlayerESPlusPlayer::Flush(base::OnceClosure flush_cb) { return; } LOG(INFO) << "(" << static_cast(this) << ") " << __func__; + + ReportBufferingStateIfNeeded(BUFFERING_HAVE_NOTHING, + BUFFERING_CHANGE_REASON_UNKNOWN); + last_frames_.get().first = media::kNoTimestamp; last_frames_.get().first = media::kNoTimestamp; @@ -533,8 +537,6 @@ void MediaPlayerESPlusPlayer::Flush(base::OnceClosure flush_cb) { SetShouldFeed(DemuxerStream::VIDEO, false); GetBufferQueue(DemuxerStream::VIDEO).clear(); GetBufferQueue(DemuxerStream::AUDIO).clear(); - SetBufferingState(DemuxerStream::AUDIO, BUFFERING_HAVE_NOTHING); - SetBufferingState(DemuxerStream::VIDEO, BUFFERING_HAVE_NOTHING); buffer_observer_->ResetBufferStatus(); std::move(flush_cb).Run(); @@ -926,13 +928,23 @@ void MediaPlayerESPlusPlayer::OnBufferingStatusChanged(DemuxerStream::Type type, } if (status != kBufferNone) { - if (GetBufferingState(type) != BUFFERING_HAVE_ENOUGH) { - SetBufferingState(type, BUFFERING_HAVE_ENOUGH); - GetMediaPlayerClient()->OnBufferingStateChange( - BUFFERING_HAVE_ENOUGH, BUFFERING_CHANGE_REASON_UNKNOWN); - } + if (GetOperationForData() == OperationForData::PLAY) + ReportBufferingStateIfNeeded(BUFFERING_HAVE_ENOUGH, + BUFFERING_CHANGE_REASON_UNKNOWN); } else { - SetBufferingState(type, BUFFERING_HAVE_NOTHING); + ReportBufferingStateIfNeeded(BUFFERING_HAVE_NOTHING, + BUFFERING_CHANGE_REASON_UNKNOWN); + } +} + +void MediaPlayerESPlusPlayer::ReportBufferingStateIfNeeded( + BufferingState buffering_state, + BufferingStateChangeReason reason) { + if (reported_buffering_state_ != buffering_state) { + LOG(INFO) << __func__ << " Report BufferingState : " << buffering_state + << ", reason : " << reason; + reported_buffering_state_ = buffering_state; + GetMediaPlayerClient()->OnBufferingStateChange(buffering_state, reason); } } @@ -989,18 +1001,18 @@ MediaPlayerESPlusPlayer::GetOperationForData() { // If data has been pushed enough (>= kMinWaitTimeForPlayback) if (time_diff >= kMinWaitTimeForPlayback) { LOG(INFO) << __func__ << " Data is enough to play,"; + ReportBufferingStateIfNeeded(BUFFERING_HAVE_ENOUGH, + BUFFERING_CHANGE_REASON_UNKNOWN); return OperationForData::PLAY; } } else { bool should_pause = false; if (has_video_media_type && current_position >= last_frames_.get().first) { - SetBufferingState(DemuxerStream::VIDEO, BUFFERING_HAVE_NOTHING); should_pause = true; } if (has_audio_media_type && current_position >= last_frames_.get().first) { - SetBufferingState(DemuxerStream::AUDIO, BUFFERING_HAVE_NOTHING); should_pause = true; } @@ -1008,8 +1020,8 @@ MediaPlayerESPlusPlayer::GetOperationForData() { LOG(INFO) << __func__ << " Not enough data to play."; // If pushing pts smaller than current_position, should report // BUFFERING_HAVE_NOTHING to replace BUFFERING_HAVE_ENOUGH - GetMediaPlayerClient()->OnBufferingStateChange( - BUFFERING_HAVE_NOTHING, BUFFERING_CHANGE_REASON_UNKNOWN); + ReportBufferingStateIfNeeded(BUFFERING_HAVE_NOTHING, + BUFFERING_CHANGE_REASON_UNKNOWN); return OperationForData::PAUSE; } } @@ -1355,16 +1367,6 @@ void MediaPlayerESPlusPlayer::SetReadRequested(DemuxerStream::Type type, GetElementryStream(type).read_requested_ = value; } -BufferingState MediaPlayerESPlusPlayer::GetBufferingState( - DemuxerStream::Type type) { - return GetElementryStream(type).buffering_state_; -} - -void MediaPlayerESPlusPlayer::SetBufferingState(DemuxerStream::Type type, - BufferingState state) { - GetElementryStream(type).buffering_state_ = state; -} - DemuxerStream* MediaPlayerESPlusPlayer::GetDemuxerStream( DemuxerStream::Type type) const { return GetElementryStream(type).input_stream_; diff --git a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.h b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.h index 8c3a416..a8e9c59 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.h +++ b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.h @@ -158,7 +158,6 @@ class MEDIA_EXPORT MediaPlayerESPlusPlayer : public MediaPlayerTizen { bool is_eos_ = false; bool should_feed_ = false; bool read_requested_ = false; - BufferingState buffering_state_ = BUFFERING_HAVE_NOTHING; DemuxerStream* input_stream_ = nullptr; base::circular_deque> pending_buffers_; }; @@ -175,6 +174,9 @@ class MEDIA_EXPORT MediaPlayerESPlusPlayer : public MediaPlayerTizen { void SeekInternal(base::TimeDelta time); void UpdateBufferedDtsDifference(); + void ReportBufferingStateIfNeeded(BufferingState buffering_state, + BufferingStateChangeReason reason); + void PerformOperationForData(); OperationForData GetOperationForData(); void StartOperationForDataTimer(); @@ -183,8 +185,6 @@ class MEDIA_EXPORT MediaPlayerESPlusPlayer : public MediaPlayerTizen { ElementryStream& GetElementryStream(DemuxerStream::Type type); const ElementryStream& GetElementryStream(DemuxerStream::Type type) const; void SetReadRequested(DemuxerStream::Type type, bool value); - BufferingState GetBufferingState(DemuxerStream::Type type); - void SetBufferingState(DemuxerStream::Type type, BufferingState state); DemuxerStream* GetDemuxerStream(DemuxerStream::Type type) const; void SetDemuxerStream(DemuxerStream::Type type, DemuxerStream* stream); Queue& GetBufferQueue(DemuxerStream::Type type); @@ -207,6 +207,7 @@ class MEDIA_EXPORT MediaPlayerESPlusPlayer : public MediaPlayerTizen { bool should_set_playback_rate_ = false; bool is_paused_by_buffering_ = false; + BufferingState reported_buffering_state_ = BUFFERING_HAVE_NOTHING; #if defined(TIZEN_VIDEO_HOLE) gfx::Rect viewport_rect_; -- 2.7.4 From 6df50111eeb7d94c2f3114dab865650bc31feefc Mon Sep 17 00:00:00 2001 From: "venu.musham" Date: Tue, 19 Mar 2024 14:08:50 +0530 Subject: [PATCH 02/16] fixup! Support gcc build for chromium-efl. Fix build warnings related to gcc build. Change-Id: I00faab2082bd08db7c6a6769e98a262cb4cbbb33 Signed-off-by: venu.musham --- content/browser/fenced_frame/fenced_frame_reporter.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/content/browser/fenced_frame/fenced_frame_reporter.h b/content/browser/fenced_frame/fenced_frame_reporter.h index 901492f..38d98bb 100644 --- a/content/browser/fenced_frame/fenced_frame_reporter.h +++ b/content/browser/fenced_frame/fenced_frame_reporter.h @@ -40,10 +40,8 @@ class RenderFrameHostImpl; struct DestinationEnumEvent { std::string type; std::string data; - DestinationEnumEvent(std::string type, std::string data) { - type = type; - data = data; - } + DestinationEnumEvent(std::string type, std::string data) + : type(type), data(data) {} }; // An event to be sent to a custom url. @@ -51,9 +49,8 @@ struct DestinationEnumEvent { // Macros are substituted using the `ReportingMacros`. struct DestinationURLEvent { GURL url; - DestinationURLEvent(GURL url) { - url = url; - } + DestinationURLEvent(GURL url) + : url(url) {} }; // Class that receives report events from fenced frames, and uses a -- 2.7.4 From ea47a8f698065c0338f980af8264525e6c48901e Mon Sep 17 00:00:00 2001 From: jinbei09 Date: Tue, 26 Mar 2024 15:23:06 +0800 Subject: [PATCH 03/16] [M120 Migration][NaCl][PPFWK] Change plugin process name Migrated from tizen 8.0: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/297941/ Change-Id: I59ba9d24bcc42c721fa35ff05c5f204d3d1e4f47 Signed-off-by: jinbei09 --- content/ppapi_plugin/ppapi_thread.cc | 37 ++++++++++++++++++++++++++++++++++++ packaging/chromium-efl.spec | 4 ---- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc index 524a255..de959d9 100644 --- a/content/ppapi_plugin/ppapi_thread.cc +++ b/content/ppapi_plugin/ppapi_thread.cc @@ -56,6 +56,12 @@ #include "sandbox/win/src/sandbox.h" #endif +#if defined(TIZEN_PEPPER_EXTENSIONS) +#include +#include "base/files/file_path.h" +#include "content/common/set_process_title_linux.h" +#endif + #if BUILDFLAG(IS_MAC) #include "sandbox/mac/seatbelt_exec.h" #endif @@ -73,6 +79,33 @@ static void WarmupWindowsLocales(const ppapi::PpapiPermissions& permissions) { namespace content { +#if defined(TIZEN_PEPPER_EXTENSIONS) +namespace { + +void UpdateProcessTitle(const std::u16string& plugin_name) { + constexpr char kPepperPluginProcessName[] = "efl_pluginprocess"; + constexpr char kLibPrefix[] = "lib"; + constexpr int kLibPrefixLength = sizeof(kLibPrefix) - 1; + + auto command_line = base::CommandLine::ForCurrentProcess(); + auto program_dir = command_line->GetProgram().DirName(); + auto updated_program_path = program_dir.Append(kPepperPluginProcessName); + + auto plugin_name_utf8 = base::UTF16ToUTF8(plugin_name); + if (plugin_name_utf8.length() > kLibPrefixLength && + plugin_name_utf8.compare(0, kLibPrefixLength, kLibPrefix) == 0) { + plugin_name_utf8 = plugin_name_utf8.substr(kLibPrefixLength); + } + + prctl(PR_SET_NAME, plugin_name_utf8.c_str()); + setproctitle("-%s %s %s", updated_program_path.value().c_str(), + plugin_name_utf8.c_str(), + command_line->GetArgumentsString().c_str()); +} + +} // namespace +#endif + PpapiThread::PpapiThread(base::RepeatingClosure quit_closure, const base::CommandLine& command_line) : ChildThreadImpl(std::move(quit_closure)), @@ -379,6 +412,10 @@ bool PpapiThread::SetupChannel(base::ProcessId renderer_pid, void PpapiThread::SavePluginName(const base::FilePath& path) { ppapi::proxy::PluginGlobals::Get()->set_plugin_name( path.BaseName().AsUTF8Unsafe()); + +#if defined(TIZEN_PEPPER_EXTENSIONS) + UpdateProcessTitle(path.BaseName().RemoveExtension().LossyDisplayName()); +#endif } } // namespace content diff --git a/packaging/chromium-efl.spec b/packaging/chromium-efl.spec index aace036..cf4502c 100644 --- a/packaging/chromium-efl.spec +++ b/packaging/chromium-efl.spec @@ -1231,10 +1231,6 @@ rm -rf %{CHROMIUM_TPK_DIR}/%{_tpk_file_name}.tpk /opt/usr/resources/* %endif -%if "%{chromium_efl_tizen_profile}" == "tv" -ln -s %{CHROMIUM_EXE_DIR}/efl_webprocess %{buildroot}%{CHROMIUM_EXE_DIR}/efl_pluginprocess -%endif - %if 0%{?build_tizen_ppapi_extension_unittests} %files tizen_ppapi_extension_unittests %defattr(-,root,root,-) -- 2.7.4 From 99fcb1aae5c3ee629975ccbf4109ee45923e609b Mon Sep 17 00:00:00 2001 From: Akshay Kanagali Date: Thu, 29 Feb 2024 13:14:09 +0530 Subject: [PATCH 04/16] [M120 Migration] Enable input picker for chrome 1) Color Picker 2) Select Picker 3) Date Picker This patch introduces runtime flag --use-internal-popup-menu to switch between internal and external popup implementation as per Browser preference. Reference: https://review.tizen.org/gerrit/303101/ https://review.tizen.org/gerrit/304039/ https://review.tizen.org/gerrit/306960/ Change-Id: I2ae42054c90d9f33d46c479fd3ee8f5d36dc2667 Signed-off-by: Akshay Kanagali --- content/browser/renderer_host/render_process_host_impl.cc | 1 + content/child/runtime_features.cc | 6 ++++-- content/renderer/render_thread_impl.cc | 7 +++++++ third_party/blink/common/switches.cc | 4 ++++ third_party/blink/public/common/switches.h | 4 ++++ third_party/blink/renderer/core/exported/web_view_impl.cc | 4 ++++ third_party/blink/renderer/core/page/chrome_client_impl.cc | 7 ------- 7 files changed, 24 insertions(+), 9 deletions(-) diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index ec8e9ec..d9e145f 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -3564,6 +3564,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( #endif #if BUILDFLAG(IS_EFL) autofill::switches::kDisableAutofill, + blink::switches::kUseInternalPopupMenu, #endif #if BUILDFLAG(IS_TIZEN) switches::kDiscardableMemoryLimit, diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index 42ba66d..ef52962 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc @@ -119,8 +119,10 @@ void SetRuntimeFeatureDefaultsForPlatform( #if BUILDFLAG(IS_EFL) // No plan to support complex UI for date/time INPUT types. - WebRuntimeFeatures::EnableInputMultipleFieldsUI(false); - + if (!base::CommandLine::ForCurrentProcess()->HasSwitch( + blink::switches::kUseInternalPopupMenu)) { + WebRuntimeFeatures::EnableInputMultipleFieldsUI(false); + } // Small accelerated 2d canvas has tct issues, which are known in // upstream version also. WebRuntimeFeatures::EnableAcceleratedSmallCanvases(false); diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index a77485d..2ea05a9 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -547,6 +547,13 @@ void RenderThreadImpl::Init() { render_thread = this; g_main_task_runner.Get() = base::SingleThreadTaskRunner::GetCurrentDefault(); +#if BUILDFLAG(IS_EFL) + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + blink::switches::kUseInternalPopupMenu)) { + blink::WebView::SetUseExternalPopupMenus(false); + } +#endif + // Register this object as the main thread. ChildProcess::current()->set_main_thread(this); diff --git a/third_party/blink/common/switches.cc b/third_party/blink/common/switches.cc index a903de0..6ac42ab 100644 --- a/third_party/blink/common/switches.cc +++ b/third_party/blink/common/switches.cc @@ -195,5 +195,9 @@ extern const char kSendMouseEventsDisabledFormControlsPolicy_ForceDisable[] = extern const char kSendMouseEventsDisabledFormControlsPolicy_ForceEnable[] = "1"; +// Enables internal popup menu +#if BUILDFLAG(IS_EFL) +const char kUseInternalPopupMenu[] = "use-internal-popup-menu"; +#endif } // namespace switches } // namespace blink diff --git a/third_party/blink/public/common/switches.h b/third_party/blink/public/common/switches.h index d2c2b0f..2612806 100644 --- a/third_party/blink/public/common/switches.h +++ b/third_party/blink/public/common/switches.h @@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_SWITCHES_H_ #define THIRD_PARTY_BLINK_PUBLIC_COMMON_SWITCHES_H_ +#include "build/build_config.h" #include "third_party/blink/public/common/common_export.h" namespace blink { @@ -75,6 +76,9 @@ BLINK_COMMON_EXPORT extern const char BLINK_COMMON_EXPORT extern const char kTouchTextSelectionStrategy[]; BLINK_COMMON_EXPORT extern const char kTouchTextSelectionStrategy_Character[]; BLINK_COMMON_EXPORT extern const char kTouchTextSelectionStrategy_Direction[]; +#if BUILDFLAG(IS_EFL) +BLINK_COMMON_EXPORT extern const char kUseInternalPopupMenu[]; +#endif BLINK_COMMON_EXPORT extern const char kWebSQLAccess[]; } // namespace switches 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 684ef49..b476c64 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc @@ -1799,6 +1799,10 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, web_view_impl->SetIgnoreViewportTagScaleLimits(prefs.force_enable_zoom); settings->SetLoadWithOverviewMode(prefs.shrinks_viewport_contents_to_fit); settings->SetUsesEncodingDetector(prefs.uses_encoding_detector); + if (!base::CommandLine::ForCurrentProcess()->HasSwitch( + blink::switches::kUseInternalPopupMenu)) { + RuntimeEnabledFeatures::SetPagePopupEnabled(false); + } #endif #if BUILDFLAG(IS_TIZEN) diff --git a/third_party/blink/renderer/core/page/chrome_client_impl.cc b/third_party/blink/renderer/core/page/chrome_client_impl.cc index bb971315..2e1c196 100644 --- a/third_party/blink/renderer/core/page/chrome_client_impl.cc +++ b/third_party/blink/renderer/core/page/chrome_client_impl.cc @@ -711,12 +711,6 @@ ColorChooser* ChromeClientImpl::OpenColorChooser( NotifyPopupOpeningObservers(); ColorChooserUIController* controller = nullptr; -#if defined(USE_EFL) - // EFL port's color picker implementation is based on - // ColorChooserUIController, similar to Android's impl. - controller = - MakeGarbageCollected(frame, chooser_client); -#else if (RuntimeEnabledFeatures::PagePopupEnabled()) { controller = MakeGarbageCollected( frame, this, chooser_client); @@ -727,7 +721,6 @@ ColorChooser* ChromeClientImpl::OpenColorChooser( controller = MakeGarbageCollected(frame, chooser_client); } -#endif controller->OpenUI(); return controller; } -- 2.7.4 From 6f43701712bf72d22c5e4f07a3c0d19beb972f5e Mon Sep 17 00:00:00 2001 From: Chandan Padhi Date: Thu, 21 Mar 2024 20:39:49 +0530 Subject: [PATCH 05/16] Fix autofill related crash/freeze issues Some of the websites using autofill such as pinterest.com, linkedin.com, instagram.com, etc. crash/freeze at launch or on login. As per the changes in upstream chromium at [1], empty form url will result in CHECK failure. |url| in autofill::FormData was empty in M120 chromium-efl resulting in crash/freeze issues. This commit sets the |url| for FormData to avoid CHECK failure. [1] https://chromium-review.googlesource.com/4955825 Change-Id: Ib4582effbd001c52611b89f8206b7f2b256e6cfa Signed-off-by: Chandan Padhi --- .../password_manager_client_efl.cc | 45 +++++++++++++--------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/tizen_src/ewk/efl_integration/browser/password_manager/password_manager_client_efl.cc b/tizen_src/ewk/efl_integration/browser/password_manager/password_manager_client_efl.cc index dbf1f06..c67a2f1 100644 --- a/tizen_src/ewk/efl_integration/browser/password_manager/password_manager_client_efl.cc +++ b/tizen_src/ewk/efl_integration/browser/password_manager/password_manager_client_efl.cc @@ -14,7 +14,7 @@ #include "browser/autofill_popup_view_efl.h" #include "browser/password_manager/password_store_factory.h" #include "components/password_manager/content/browser/bad_message.h" -#include "components/password_manager/content/browser/content_password_manager_driver.h" +#include "components/password_manager/content/browser/form_meta_data.h" #include "components/password_manager/core/browser/password_feature_manager.h" #include "components/password_manager/core/browser/password_form_manager.h" #include "components/password_manager/core/browser/password_manager.h" @@ -215,45 +215,54 @@ bool PasswordManagerClientEfl::IsNewTabPage() const { } void PasswordManagerClientEfl::PasswordFormsParsed( - const std::vector& forms) { - for (const auto& form : forms) { + const std::vector& raw_forms) { + content::RenderFrameHost* rfh = + password_manager_driver_bindings_.GetCurrentTargetFrame(); + std::vector forms = raw_forms; + for (auto& form : forms) { if (!bad_message::CheckChildProcessSecurityPolicyForURL( - password_manager_driver_bindings_.GetCurrentTargetFrame(), form.url, - BadMessageReason::CPMD_BAD_ORIGIN_FORMS_PARSED_OBSOLETE)) + rfh, form.url, + BadMessageReason::CPMD_BAD_ORIGIN_FORMS_PARSED_OBSOLETE)) { return; + } + SetFrameAndFormMetaData(rfh, form); } password_manager::PasswordManagerDriver* driver = - driver_factory_->GetDriverForFrame( - password_manager_driver_bindings_.GetCurrentTargetFrame()); + driver_factory_->GetDriverForFrame(rfh); GetPasswordManager()->OnPasswordFormsParsed(driver, forms); } void PasswordManagerClientEfl::PasswordFormsRendered( const std::vector& visible_forms) { - for (const auto& form : visible_forms) { + content::RenderFrameHost* rfh = + password_manager_driver_bindings_.GetCurrentTargetFrame(); + std::vector forms = visible_forms; + for (auto& form : forms) { if (!bad_message::CheckChildProcessSecurityPolicyForURL( - password_manager_driver_bindings_.GetCurrentTargetFrame(), form.url, - BadMessageReason::CPMD_BAD_ORIGIN_FORMS_RENDERED_OBSOLETE)) + rfh, form.url, + BadMessageReason::CPMD_BAD_ORIGIN_FORMS_RENDERED_OBSOLETE)) { return; + } + SetFrameAndFormMetaData(rfh, form); } password_manager::PasswordManagerDriver* driver = - driver_factory_->GetDriverForFrame( - password_manager_driver_bindings_.GetCurrentTargetFrame()); - GetPasswordManager()->OnPasswordFormsRendered(driver, visible_forms); + driver_factory_->GetDriverForFrame(rfh); + GetPasswordManager()->OnPasswordFormsRendered(driver, forms); } void PasswordManagerClientEfl::PasswordFormSubmitted( const autofill::FormData& password_form) { + content::RenderFrameHost* rfh = + password_manager_driver_bindings_.GetCurrentTargetFrame(); if (!bad_message::CheckChildProcessSecurityPolicyForURL( - password_manager_driver_bindings_.GetCurrentTargetFrame(), - password_form.url, + rfh, password_form.url, BadMessageReason::CPMD_BAD_ORIGIN_FORM_SUBMITTED)) { return; } password_manager::PasswordManagerDriver* driver = - driver_factory_->GetDriverForFrame( - password_manager_driver_bindings_.GetCurrentTargetFrame()); - GetPasswordManager()->OnPasswordFormSubmitted(driver, password_form); + driver_factory_->GetDriverForFrame(rfh); + GetPasswordManager()->OnPasswordFormSubmitted( + driver, GetFormWithFrameAndFormMetaData(rfh, password_form)); } void PasswordManagerClientEfl::HideManualFallbackForSaving() { -- 2.7.4 From 22180cb03d930bfad7be9d833f7f0d5258b3d5db Mon Sep 17 00:00:00 2001 From: v-saha Date: Thu, 7 Mar 2024 17:10:40 +0530 Subject: [PATCH 06/16] Remove EWK_BRINGUPS for M120 #3 This commit removes some EWK_BRINGUPs added during M120 upversion. Change-Id: I5bbbf3a01b60563bb1a9fde662cf302824b39c47 Signed-off-by: v-saha --- cc/paint/paint_op_writer.h | 33 ---------------------- chrome/browser/extensions/pref_mapping.cc | 2 +- chrome/browser/ui/tabs/supports_handles.h | 2 +- .../generic_sensor/frame_sensor_provider_proxy.cc | 4 --- .../eigen3/src/Eigen/src/Core/util/Memory.h | 2 +- third_party/eigen3/src/Eigen/src/Core/util/Meta.h | 4 ++- .../core/fpdfapi/render/cpdf_renderstatus.cpp | 4 --- v8/src/objects/object-macros.h | 26 ----------------- 8 files changed, 6 insertions(+), 71 deletions(-) diff --git a/cc/paint/paint_op_writer.h b/cc/paint/paint_op_writer.h index 1eae1b9..afcca08 100644 --- a/cc/paint/paint_op_writer.h +++ b/cc/paint/paint_op_writer.h @@ -111,24 +111,8 @@ class CC_PAINT_EXPORT PaintOpWriter { static constexpr size_t kDefaultAlignment = alignof(uint32_t); private: -#if !defined(EWK_BRINGUP) // FIXME: m120 bringup template static constexpr size_t SerializedSizeSimple(); -#else - template - static constexpr size_t SerializedSizeSimple() { - static_assert(!std::is_pointer_v); - if constexpr (std::is_same_v) { - // size_t is always serialized as two uint32_ts to make the serialized - // result portable between 32bit and 64bit processes. - return base::bits::AlignUp(2 * sizeof(uint32_t), kDefaultAlignment); - } else { - static_assert(!std::is_pointer_v); - return base::bits::AlignUp(sizeof(T), kDefaultAlignment); - } - } - -#endif public: // SerializedSize() returns the maximum serialized size of the given type or // the given parameter. For a buffer to contain serialization of multiple @@ -137,23 +121,10 @@ class CC_PAINT_EXPORT PaintOpWriter { // easier to keep serialized size calculation in sync with serialization and // deserialization, and make it possible to allow dynamic sizing for some // data types (see the specialized/overloaded functions). -#if !defined(EWK_BRINGUP) // FIXME: m120 bringup template static constexpr size_t SerializedSize(); template static constexpr size_t SerializedSize(const T& data); -#else - template - static constexpr size_t SerializedSize() { - static_assert(std::is_arithmetic_v || std::is_enum_v); - return SerializedSizeSimple(); - } - template - static constexpr size_t SerializedSize(const T& data) { - return SerializedSizeSimple(); - } - -#endif static size_t SerializedSize(const PaintImage& image); static size_t SerializedSize(const PaintRecord& record); @@ -466,7 +437,6 @@ class CC_PAINT_EXPORT PaintOpWriter { const bool enable_security_constraints_; }; -#if !defined(EWK_BRINGUP) // FIXME: m120 bringup template constexpr size_t PaintOpWriter::SerializedSizeSimple() { static_assert(!std::is_pointer_v); @@ -479,7 +449,6 @@ template <> constexpr size_t PaintOpWriter::SerializedSizeSimple() { return base::bits::AlignUp(2 * sizeof(uint32_t), kDefaultAlignment); } -#endif template <> constexpr size_t PaintOpWriter::SerializedSize() { @@ -493,7 +462,6 @@ constexpr size_t PaintOpWriter::SerializedSize() { SerializedSizeSimple(); // fBaseImageType } -#if !defined(EWK_BRINGUP) // FIXME: m120 bringup template constexpr size_t PaintOpWriter::SerializedSize() { static_assert(std::is_arithmetic_v || std::is_enum_v); @@ -503,7 +471,6 @@ template constexpr size_t PaintOpWriter::SerializedSize(const T& data) { return SerializedSizeSimple(); } -#endif } // namespace cc diff --git a/chrome/browser/extensions/pref_mapping.cc b/chrome/browser/extensions/pref_mapping.cc index 86bdda3..84b9559 100644 --- a/chrome/browser/extensions/pref_mapping.cc +++ b/chrome/browser/extensions/pref_mapping.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#if !defined(EWK_BRINGUP) // FIXME: m120 bringup +#if !defined(BUILD_CHROME) #include // std::size. #endif diff --git a/chrome/browser/ui/tabs/supports_handles.h b/chrome/browser/ui/tabs/supports_handles.h index 7180f07..5ae15bf 100644 --- a/chrome/browser/ui/tabs/supports_handles.h +++ b/chrome/browser/ui/tabs/supports_handles.h @@ -56,7 +56,7 @@ // TODO(dfried, tbergquist): move this file down to c/b/ui if it's used outside // of the tabstrip. -#if !defined(EWK_BRINGUP) // FIXME: m120 bringup +#if !BUILDFLAG(IS_TIZEN) #include #endif #include diff --git a/content/browser/generic_sensor/frame_sensor_provider_proxy.cc b/content/browser/generic_sensor/frame_sensor_provider_proxy.cc index ed2e3f9..703cbd2 100644 --- a/content/browser/generic_sensor/frame_sensor_provider_proxy.cc +++ b/content/browser/generic_sensor/frame_sensor_provider_proxy.cc @@ -19,11 +19,7 @@ using device::mojom::SensorType; namespace content { namespace { -#if !defined(EWK_BRINGUP) // FIXME: m120 bringup -constexpr std::vector -#else std::vector -#endif SensorTypeToPermissionsPolicyFeatures(SensorType type) { switch (type) { case SensorType::AMBIENT_LIGHT: diff --git a/third_party/eigen3/src/Eigen/src/Core/util/Memory.h b/third_party/eigen3/src/Eigen/src/Core/util/Memory.h index 7df87ec..f819bde 100644 --- a/third_party/eigen3/src/Eigen/src/Core/util/Memory.h +++ b/third_party/eigen3/src/Eigen/src/Core/util/Memory.h @@ -1242,7 +1242,7 @@ inline int queryTopLevelCacheSize() * This wraps C++20's std::construct_at, using placement new instead if it is not available. */ -#if EIGEN_COMP_CXXVER >= 20 && !defined(EWK_BRINGUP) // FIXME: m120 bringup +#if EIGEN_COMP_CXXVER >= 20 && !BUILDFLAG(IS_TIZEN) using std::construct_at; #else template diff --git a/third_party/eigen3/src/Eigen/src/Core/util/Meta.h b/third_party/eigen3/src/Eigen/src/Core/util/Meta.h index ec8baa4..e051139 100644 --- a/third_party/eigen3/src/Eigen/src/Core/util/Meta.h +++ b/third_party/eigen3/src/Eigen/src/Core/util/Meta.h @@ -8,6 +8,8 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include "build/build_config.h" + #ifndef EIGEN_META_H #define EIGEN_META_H @@ -249,7 +251,7 @@ EIGEN_CONSTEXPR std::ptrdiff_t index_list_size(const T (&)[N]) { return N; } #else template EIGEN_CONSTEXPR auto index_list_size(T&& x) { -#if !defined(EWK_BRINGUP) // FIXME: m120 bringup +#if !BUILDFLAG(IS_TIZEN) using std::ssize; return ssize(std::forward(x)); #else diff --git a/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp b/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp index 32ca970..d86c2f6 100644 --- a/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -491,11 +491,7 @@ void CPDF_RenderStatus::ProcessClipPath(const CPDF_ClipPath& ClipPath, } else { m_pDevice->SetClip_PathFill( *pPath, &mtObj2Device, -#if !defined(EWK_BRINGUP) // FIXME: m120 bringup CFX_FillRenderOptions(ClipPath.GetClipType(i))); -#else - {.fill_type = ClipPath.GetClipType(i)}); -#endif } } diff --git a/v8/src/objects/object-macros.h b/v8/src/objects/object-macros.h index e849dd8..def9caf 100644 --- a/v8/src/objects/object-macros.h +++ b/v8/src/objects/object-macros.h @@ -602,7 +602,6 @@ #define SEQ_CST_COMPARE_AND_SWAP_FIELD(p, offset, expected, value) \ TaggedField::SeqCst_CompareAndSwap(p, offset, expected, value) -#if !defined(EWK_BRINGUP) // FIXME: m120 bringup #ifdef V8_DISABLE_WRITE_BARRIERS #define WRITE_BARRIER(object, offset, value) #else @@ -626,31 +625,6 @@ value, UPDATE_WRITE_BARRIER); \ } while (false) #endif -#else -#ifdef V8_DISABLE_WRITE_BARRIERS -#define WRITE_BARRIER(object, offset, value) -#else -#define WRITE_BARRIER(object, offset, value) \ - do { \ - DCHECK_NOT_NULL(GetHeapFromWritableObject(object)); \ - static_assert(kTaggedCanConvertToRawObjects); \ - CombinedWriteBarrier(object, (object)->RawField(offset), value, \ - UPDATE_WRITE_BARRIER); \ - } while (false) -#endif - -#ifdef V8_DISABLE_WRITE_BARRIERS -#define WEAK_WRITE_BARRIER(object, offset, value) -#else -#define WEAK_WRITE_BARRIER(object, offset, value) \ - do { \ - DCHECK_NOT_NULL(GetHeapFromWritableObject(object)); \ - static_assert(kTaggedCanConvertToRawObjects); \ - CombinedWriteBarrier(object, (object)->RawMaybeWeakField(offset), value, \ - UPDATE_WRITE_BARRIER); \ - } while (false) -#endif -#endif #ifdef V8_DISABLE_WRITE_BARRIERS #define EPHEMERON_KEY_WRITE_BARRIER(object, offset, value) -- 2.7.4 From bd07ead9a9e75bb4b6cc8c0fa5d36944edab8992 Mon Sep 17 00:00:00 2001 From: jiangyuwei Date: Tue, 26 Mar 2024 16:04:31 +0800 Subject: [PATCH 07/16] [M120 Migration] Introduces network loading API 1. ewk_view_resume_network_loading 2. ewk_view_suspend_network_loading 3. Fix send mojo call issue on window.open case The api called when webbrowser launched. Reference: - https://review.tizen.org/gerrit/291318/ - https://review.tizen.org/gerrit/297667/ Change-Id: I474c919975efbe0301d82acd1ce73cca9a3c797c Signed-off-by: jiangyuwei --- .../renderer_host/render_widget_host_impl.cc | 138 +++++++++++++++++++-- .../renderer_host/render_widget_host_impl.h | 29 ++++- .../public/mojom/widget/platform_widget.mojom | 6 + third_party/blink/public/web/web_view.h | 8 ++ .../blink/renderer/core/exported/web_view_impl.cc | 18 ++- .../blink/renderer/core/exported/web_view_impl.h | 7 +- .../renderer/core/frame/web_frame_widget_impl.cc | 12 +- .../renderer/core/frame/web_frame_widget_impl.h | 2 + third_party/blink/renderer/core/page/page.cc | 16 +++ third_party/blink/renderer/core/page/page.h | 2 + .../blink/renderer/platform/widget/widget_base.cc | 12 +- .../blink/renderer/platform/widget/widget_base.h | 2 + tizen_src/ewk/efl_integration/eweb_view.cc | 19 +++ tizen_src/ewk/efl_integration/eweb_view.h | 2 + tizen_src/ewk/efl_integration/public/ewk_view.cc | 20 ++- .../ewk/efl_integration/public/ewk_view_product.h | 4 +- 16 files changed, 274 insertions(+), 23 deletions(-) diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 43ed9e9..474dd2d 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -832,6 +832,20 @@ void RenderWidgetHostImpl::Init() { // run them here after we clear it. SendScreenRects(); SynchronizeVisualProperties(); +#if BUILDFLAG(IS_TIZEN_TV) + if (pending_suspend_network_loading_closure_) + std::move(pending_suspend_network_loading_closure_).Run(); + + if (pending_resume_network_loading_closure_) + std::move(pending_resume_network_loading_closure_).Run(); + + if (pending_set_active_closure_) + std::move(pending_set_active_closure_).Run(); + + if (pending_set_page_focus_closure_) + std::move(pending_set_page_focus_closure_).Run(); +#endif + // Show/Hide state is not given to the renderer while we are // `waiting_for_init_`, but Init() signals that the renderer is ready to // receive them. This call will inform the renderer that the widget is shown. @@ -931,6 +945,10 @@ void RenderWidgetHostImpl::WasShown( DCHECK(!pending_show_params_); if (!waiting_for_init_) { + if (!blink_widget_) { + LOG(ERROR) << "Bind WidgetInterfaces still not finish"; + return; + } blink_widget_->WasShown(view_->is_evicted(), std::move(record_tab_switch_time_request)); } else { @@ -1138,8 +1156,60 @@ void RenderWidgetHostImpl::ResetLastInteractedElements() { void RenderWidgetHostImpl::SetFloatVideoWindowState(bool enabled) { blink_widget_->SetFloatVideoWindowState(enabled); } -#endif -#endif + +void RenderWidgetHostImpl::SuspendNetworkLoading() { + if (!waiting_for_init_) { + if (!blink_widget_) { + LOG(ERROR) << "Bind WidgetInterfaces still not finish"; + return; + } + blink_widget_->SuspendNetworkLoading(); + + if (pending_suspend_network_loading_closure_) + pending_suspend_network_loading_closure_.Reset(); + } else { + LOG(INFO) << "set pending SuspendNetworkLoading"; + pending_suspend_network_loading_closure_ = + base::BindOnce(&RenderWidgetHostImpl::RunPendingSuspendNetworkLoading, + base::Unretained(this)); + } +} + +void RenderWidgetHostImpl::RunPendingSuspendNetworkLoading() { + if (!blink_widget_) { + LOG(ERROR) << "Bind WidgetInterfaces still not finish"; + return; + } + blink_widget_->SuspendNetworkLoading(); +} + +void RenderWidgetHostImpl::ResumeNetworkLoading() { + if (!waiting_for_init_) { + if (!blink_widget_) { + LOG(ERROR) << "Bind WidgetInterfaces still not finish"; + return; + } + blink_widget_->ResumeNetworkLoading(); + + if (pending_resume_network_loading_closure_) + pending_resume_network_loading_closure_.Reset(); + } else { + LOG(INFO) << "set pending ResumeNetworkLoading"; + pending_resume_network_loading_closure_ = + base::BindOnce(&RenderWidgetHostImpl::RunPendingResumeNetworkLoading, + base::Unretained(this)); + } +} + +void RenderWidgetHostImpl::RunPendingResumeNetworkLoading() { + if (!blink_widget_) { + LOG(ERROR) << "Bind WidgetInterfaces still not finish"; + return; + } + blink_widget_->ResumeNetworkLoading(); +} +#endif // IS_TIZEN_TV +#endif // IS_EFL blink::VisualProperties RenderWidgetHostImpl::GetInitialVisualProperties() { blink::VisualProperties initial_props = GetVisualProperties(); @@ -1511,6 +1581,17 @@ void RenderWidgetHostImpl::FlushForTesting() { } } +void RenderWidgetHostImpl::SetFocusInternal(bool focused) { + blink::mojom::FocusState focus_state = + blink::mojom::FocusState::kNotFocusedAndNotActive; + if (focused) + focus_state = blink::mojom::FocusState::kFocused; + else if (is_active_) + focus_state = blink::mojom::FocusState::kNotFocusedAndActive; + + GetWidgetInputHandler()->SetFocus(focus_state); +} + void RenderWidgetHostImpl::SetPageFocus(bool focused) { OPTIONAL_TRACE_EVENT1("content", "RenderWidgetHostImpl::SetPageFocus", "is_focused", focused); @@ -1545,15 +1626,22 @@ void RenderWidgetHostImpl::SetPageFocus(bool focused) { LockKeyboard(); } - blink::mojom::FocusState focus_state = - blink::mojom::FocusState::kNotFocusedAndNotActive; - if (focused) { - focus_state = blink::mojom::FocusState::kFocused; - } else if (is_active_) { - focus_state = blink::mojom::FocusState::kNotFocusedAndActive; - } +#if BUILDFLAG(IS_TIZEN_TV) + if (!waiting_for_init_) { + SetFocusInternal(focused); - GetWidgetInputHandler()->SetFocus(focus_state); + if (pending_set_page_focus_closure_) + pending_set_page_focus_closure_.Reset(); + + } else { + LOG(INFO) << "set Pending SetPageFocus"; + pending_set_page_focus_closure_ = + base::BindOnce(&RenderWidgetHostImpl::RunPendingSetPageFocus, + base::Unretained(this), focused); + } +#else + SetFocusInternal(focused); +#endif // Also send page-level focus state to other SiteInstances involved in // rendering the current FrameTree, if this widget is for a main frame. @@ -1567,6 +1655,12 @@ void RenderWidgetHostImpl::SetPageFocus(bool focused) { } } +#if BUILDFLAG(IS_TIZEN_TV) +void RenderWidgetHostImpl::RunPendingSetPageFocus(bool focused) { + SetFocusInternal(focused); +} +#endif + void RenderWidgetHostImpl::LostCapture() { if (auto* touch_emulator = GetExistingTouchEmulator()) { touch_emulator->CancelTouch(); @@ -1575,7 +1669,31 @@ void RenderWidgetHostImpl::LostCapture() { GetWidgetInputHandler()->MouseCaptureLost(); } +#if BUILDFLAG(IS_TIZEN_TV) +void RenderWidgetHostImpl::RunPendingSetActive(bool active) { + SetActiveInternal(active); +} +#endif + void RenderWidgetHostImpl::SetActive(bool active) { +#if BUILDFLAG(IS_TIZEN_TV) + if (!waiting_for_init_) { + SetActiveInternal(active); + + if (pending_set_active_closure_) + pending_set_active_closure_.Reset(); + } else { + LOG(INFO) << "set pending setActive"; + pending_set_active_closure_ = + base::BindOnce(&RenderWidgetHostImpl::RunPendingSetActive, + base::Unretained(this), active); + } +#else + SetActiveInternal(active); +#endif +} + +void RenderWidgetHostImpl::SetActiveInternal(bool active) { is_active_ = active; if (blink_frame_widget_) { blink_frame_widget_->SetActive(active); diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index d895491..d9abcd9 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -482,8 +482,10 @@ class CONTENT_EXPORT RenderWidgetHostImpl void ResetLastInteractedElements(); #if BUILDFLAG(IS_TIZEN_TV) void SetFloatVideoWindowState(bool enabled); -#endif -#endif + void SuspendNetworkLoading(); + void ResumeNetworkLoading(); +#endif // IS_TIZEN_TV +#endif // IS_EFL #if BUILDFLAG(IS_TIZEN) void PauseScheduledTasks(); @@ -518,6 +520,8 @@ class CONTENT_EXPORT RenderWidgetHostImpl // update. Users other than WebContents and RenderWidgetHost should use // Focus()/Blur(). void SetPageFocus(bool focused); + void SetFocusInternal(bool focused); + void SetActiveInternal(bool active); // Returns true if the RenderWidgetHost thinks it is active. This // is different than `is_focused` but must always be true if `is_focused` @@ -1239,6 +1243,20 @@ class CONTENT_EXPORT RenderWidgetHostImpl void AddPendingUserActivation(const blink::WebInputEvent& event); void ClearPendingUserActivation(); +#if BUILDFLAG(IS_TIZEN_TV) + // Calls the pending blink::mojom::Widget::SuspendNetworkLoading. + void RunPendingSuspendNetworkLoading(); + + // Calls the pending blink::mojom::Widget::ResumeNetworkLoading. + void RunPendingResumeNetworkLoading(); + + // Calls the pending blink::mojom::FrameWidget::setActive. + void RunPendingSetActive(bool active); + + // Calls the pending blink::mojom::WidgetInputHandler::SetPageFocus. + void RunPendingSetPageFocus(bool focused); +#endif + // Dispatch any buffered FrameSink requests from the renderer if the widget // has a view and is the owner for the FrameSinkId assigned to it. void MaybeDispatchBufferedFrameSinkRequest(); @@ -1540,6 +1558,13 @@ class CONTENT_EXPORT RenderWidgetHostImpl InputRouterImpl::RequestMouseLockCallback request_mouse_callback_; +#if BUILDFLAG(IS_TIZEN_TV) + base::OnceClosure pending_suspend_network_loading_closure_; + base::OnceClosure pending_resume_network_loading_closure_; + base::OnceClosure pending_set_active_closure_; + base::OnceClosure pending_set_page_focus_closure_; +#endif + // Parameters to pass to blink::mojom::Widget::WasShown after // `waiting_for_init_` becomes true. These are stored in a struct instead of // storing a callback so that they can be updated if diff --git a/third_party/blink/public/mojom/widget/platform_widget.mojom b/third_party/blink/public/mojom/widget/platform_widget.mojom index 72a92f1..0f8367e 100644 --- a/third_party/blink/public/mojom/widget/platform_widget.mojom +++ b/third_party/blink/public/mojom/widget/platform_widget.mojom @@ -179,6 +179,12 @@ interface Widget { [EnableIf=is_tizen_tv] SetFloatVideoWindowState(bool enabled); + [EnableIf=is_tizen_tv] + SuspendNetworkLoading(); + + [EnableIf=is_tizen_tv] + ResumeNetworkLoading(); + // 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 f637d7f..e12739b 100644 --- a/third_party/blink/public/web/web_view.h +++ b/third_party/blink/public/web/web_view.h @@ -533,6 +533,14 @@ class BLINK_EXPORT WebView { // Returns the selection rect encompassing text and images. virtual gfx::Rect CurrentSelectionRect() const = 0; + +#if BUILDFLAG(IS_TIZEN_TV) + // Suspends loaders for the main frame and all sub-frames. + virtual void SuspendNetworkLoading() = 0; + + // Resumes perviously suspended frame loaders. + virtual void ResumeNetworkLoading() = 0; +#endif // IS_TIZEN_TV #endif #if BUILDFLAG(IS_TIZEN_TV) 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 b476c64..3045cba 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc @@ -4579,7 +4579,23 @@ void WebViewImpl::SetScrollOffset(float x, float y) { if (auto* focused_frame = FocusedFrame()) focused_frame->SetScrollOffset(gfx::PointF(x, y)); } -#endif + +#if BUILDFLAG(IS_TIZEN_TV) +void WebViewImpl::SuspendNetworkLoading() { + if (!GetPage()) + return; + + GetPage()->SetDefersLoading(true); +} + +void WebViewImpl::ResumeNetworkLoading() { + if (!GetPage()) + return; + + GetPage()->SetDefersLoading(false); +} +#endif // IS_TIZEN_TV +#endif // IS_EFL #if defined(TIZEN_VIDEO_HOLE) bool WebViewImpl::IsVideoHoleForRender() const { 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 af2b529..195da37 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h @@ -253,7 +253,12 @@ class CORE_EXPORT WebViewImpl final : public WebView, void ScrollFocusedNodeIntoView() override; void SetScrollOffset(float x, float y) override; gfx::Rect CurrentSelectionRect() const override; -#endif + +#if BUILDFLAG(IS_TIZEN_TV) + void SuspendNetworkLoading() override; + void ResumeNetworkLoading() override; +#endif // IS_TIZEN_TV +#endif // IS_EFL // Functions to add and remove observers for this object. void AddObserver(WebViewObserver* observer); 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 49630e7..beb29d0 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 @@ -4727,8 +4727,16 @@ bool WebFrameWidgetImpl::RequestMainFrameScrollbarVisible(bool& visible) { void WebFrameWidgetImpl::SetFloatVideoWindowState(bool enabled) { View()->SetFloatVideoWindowState(enabled); } -#endif -#endif + +void WebFrameWidgetImpl::SuspendNetworkLoading() { + View()->SuspendNetworkLoading(); +} + +void WebFrameWidgetImpl::ResumeNetworkLoading() { + View()->ResumeNetworkLoading(); +} +#endif // IS_TIZEN_TV +#endif // IS_EFL #if BUILDFLAG(IS_TIZEN) void WebFrameWidgetImpl::SetMaxRefreshRate(uint32_t max_refresh_rate) { 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 2f28251..c327506 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 @@ -803,6 +803,8 @@ class CORE_EXPORT WebFrameWidgetImpl gfx::Rect RequestSelectionRect() override; #if BUILDFLAG(IS_TIZEN_TV) void SetFloatVideoWindowState(bool enabled) override; + void SuspendNetworkLoading() override; + void ResumeNetworkLoading() override; #endif #endif diff --git a/third_party/blink/renderer/core/page/page.cc b/third_party/blink/renderer/core/page/page.cc index ba4259a..7828edb 100644 --- a/third_party/blink/renderer/core/page/page.cc +++ b/third_party/blink/renderer/core/page/page.cc @@ -1216,6 +1216,22 @@ void Page::UpdateLifecycle(LocalFrame& root, void Page::SetLongPollingGlobalTimeout(uint64_t timeout) { long_polling_global_timeout_ = timeout; } + +void Page::SetDefersLoading(bool defers) { + LOG(INFO) << "defers : " << defers + << " defers_loading_ : " << defers_loading_; + if (defers == defers_loading_) + return; + + defers_loading_ = defers; + for (Frame* frame = MainFrame(); frame; + frame = frame->Tree().TraverseNext()) { + if (auto* local_frame = DynamicTo(frame)) { + local_frame->Loader().SetDefersLoading(defers ? LoaderFreezeMode::kStrict + : LoaderFreezeMode::kNone); + } + } +} #endif const base::UnguessableToken& Page::BrowsingContextGroupToken() { diff --git a/third_party/blink/renderer/core/page/page.h b/third_party/blink/renderer/core/page/page.h index 47b52b8..ca98bfb 100644 --- a/third_party/blink/renderer/core/page/page.h +++ b/third_party/blink/renderer/core/page/page.h @@ -348,6 +348,7 @@ class CORE_EXPORT Page final : public GarbageCollected, uint64_t GetLongPollingGlobalTimeout() { return long_polling_global_timeout_; } + void SetDefersLoading(bool defers); #endif void AddAutoplayFlags(int32_t flags); @@ -655,6 +656,7 @@ class CORE_EXPORT Page final : public GarbageCollected, WebScopedVirtualTimePauser history_navigation_virtual_time_pauser_; #if BUILDFLAG(IS_EFL) uint64_t long_polling_global_timeout_ = 0; + bool defers_loading_ = false; #endif // IS_EFL Member diff --git a/third_party/blink/renderer/platform/widget/widget_base.cc b/third_party/blink/renderer/platform/widget/widget_base.cc index 02db385..5cd531a 100644 --- a/third_party/blink/renderer/platform/widget/widget_base.cc +++ b/third_party/blink/renderer/platform/widget/widget_base.cc @@ -564,7 +564,17 @@ void WidgetBase::SelectFocusedLink() { void WidgetBase::RequestSelectionRect(RequestSelectionRectCallback callback) { std::move(callback).Run(client_->RequestSelectionRect()); } -#endif + +#if BUILDFLAG(IS_TIZEN_TV) +void WidgetBase::SuspendNetworkLoading() { + client_->SuspendNetworkLoading(); +} + +void WidgetBase::ResumeNetworkLoading() { + client_->ResumeNetworkLoading(); +} +#endif // IS_TIZEN_TV +#endif // IS_EFL #if BUILDFLAG(IS_TIZEN_TV) void WidgetBase::SetFloatVideoWindowState(bool enabled) { diff --git a/third_party/blink/renderer/platform/widget/widget_base.h b/third_party/blink/renderer/platform/widget/widget_base.h index 9f3e2b1..d385fc7 100644 --- a/third_party/blink/renderer/platform/widget/widget_base.h +++ b/third_party/blink/renderer/platform/widget/widget_base.h @@ -156,6 +156,8 @@ class PLATFORM_EXPORT WidgetBase : public mojom::blink::Widget, RequestMainFrameScrollbarVisibleCallback callback) override; #if BUILDFLAG(IS_TIZEN_TV) void SetFloatVideoWindowState(bool enabled) override; + void SuspendNetworkLoading() override; + void ResumeNetworkLoading() override; #endif // IS_TIZEN_TV void QueryInputType(QueryInputTypeCallback) override; void SelectClosestWord(uint32_t x, uint32_t y) override; diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index ab7fac0..82980e4 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -781,6 +781,20 @@ void EWebView::SetFloatVideoWindowState(bool enabled) { rwhi->SetFloatVideoWindowState(enabled); } + +void EWebView::SuspendNetworkLoading() { + RenderWidgetHostImpl* rwhi = static_cast( + web_contents_->GetRenderViewHost()->GetWidget()); + + rwhi->SuspendNetworkLoading(); +} + +void EWebView::ResumeNetworkLoading() { + RenderWidgetHostImpl* rwhi = static_cast( + web_contents_->GetRenderViewHost()->GetWidget()); + + rwhi->ResumeNetworkLoading(); +} #endif // IS_TIZEN_TV double EWebView::GetTextZoomFactor() const { @@ -3085,6 +3099,11 @@ void EWebView::SendDelayedMessages(RenderViewHost* render_view_host) { return; } +#if BUILDFLAG(IS_TIZEN_TV) + if (pending_setfocus_closure_) + std::move(pending_setfocus_closure_).Run(); +#endif + for (auto iter = delayed_messages_.begin(); iter != delayed_messages_.end(); ++iter) { IPC::Message* message = *iter; diff --git a/tizen_src/ewk/efl_integration/eweb_view.h b/tizen_src/ewk/efl_integration/eweb_view.h index 6d7f069..040fc89 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.h +++ b/tizen_src/ewk/efl_integration/eweb_view.h @@ -401,6 +401,8 @@ class EWebView { int player_id, const char* url, const char* mime_type); + void SuspendNetworkLoading(); + void ResumeNetworkLoading(); #endif // IS_TIZEN_TV void SetSessionTimeout(uint64_t timeout); double GetTextZoomFactor() const; diff --git a/tizen_src/ewk/efl_integration/public/ewk_view.cc b/tizen_src/ewk/efl_integration/public/ewk_view.cc index 97c6c20..d30fc43 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_view.cc +++ b/tizen_src/ewk/efl_integration/public/ewk_view.cc @@ -1645,14 +1645,26 @@ void ewk_view_widget_pepper_extension_info_set(Evas_Object* ewk_view, Ewk_Value #endif } -void ewk_view_resume_network_loading(Evas_Object* ewkView) +void ewk_view_resume_network_loading(Evas_Object* ewk_view) { - LOG_EWK_API_MOCKUP(); +#if BUILDFLAG(IS_TIZEN_TV) + LOG(INFO) << "view : " << ewk_view; + EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl); + impl->ResumeNetworkLoading(); +#else + LOG_EWK_API_MOCKUP("Only for Tizen TV Browser"); +#endif } -void ewk_view_suspend_network_loading(Evas_Object* ewkView) +void ewk_view_suspend_network_loading(Evas_Object* ewk_view) { - LOG_EWK_API_MOCKUP(); +#if BUILDFLAG(IS_TIZEN_TV) + LOG(INFO) << "view : " << ewk_view; + EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl); + impl->SuspendNetworkLoading(); +#else + LOG_EWK_API_MOCKUP("Only for Tizen TV Browser"); +#endif } void ewk_view_offscreen_rendering_enabled_set(Evas_Object* o, Eina_Bool enabled) diff --git a/tizen_src/ewk/efl_integration/public/ewk_view_product.h b/tizen_src/ewk/efl_integration/public/ewk_view_product.h index 9b0eb63..2b760ac 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_view_product.h +++ b/tizen_src/ewk/efl_integration/public/ewk_view_product.h @@ -513,7 +513,7 @@ EXPORT_API Evas_Object* ewk_view_favicon_get(const Evas_Object* ewkView); * @param item view object to resume new url loading * */ -EXPORT_API void ewk_view_resume_network_loading(Evas_Object* ewkView); +EXPORT_API void ewk_view_resume_network_loading(Evas_Object* ewk_view); EXPORT_API void ewk_view_poweroff_suspend(Evas_Object *item); @@ -523,7 +523,7 @@ EXPORT_API void ewk_view_poweroff_suspend(Evas_Object *item); * @param item view object to suspend url loading * */ -EXPORT_API void ewk_view_suspend_network_loading(Evas_Object* ewkView); +EXPORT_API void ewk_view_suspend_network_loading(Evas_Object* ewk_view); /** * This function should be use for browser edge scroll. -- 2.7.4 From c6953fe97e9b1bae2ec2a0276d40d5ab10e4d246 Mon Sep 17 00:00:00 2001 From: Jing Wang Date: Tue, 26 Mar 2024 11:13:14 +0800 Subject: [PATCH 08/16] [M120 Migration] Implement rotation for Aura Pass rotation information to make rotate working. Ref: https://review.tizen.org/gerrit/#/c/291386/ Change-Id: Ia2576c8521a7fc78330ac6630c6d6f9dcc3e1382 Signed-off-by: Jing Wang --- .../renderer_host/render_widget_host_view_aura.cc | 22 ++++++++++++++++++++++ .../renderer_host/render_widget_host_view_aura.h | 9 +++++++++ .../browser/web_contents/web_contents_view_aura.cc | 13 +++++++++++++ .../renderer_host/rwhv_aura_common_helper_efl.h | 2 ++ .../rwhv_aura_offscreen_helper_efl.cc | 5 +++++ .../renderer_host/rwhv_aura_offscreen_helper_efl.h | 3 --- .../ui/display/device_display_info_efl.cc | 3 +++ tizen_src/ewk/efl_integration/eweb_view.cc | 12 ++++++++++++ 8 files changed, 66 insertions(+), 3 deletions(-) diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index b22ac2a..067d0ae 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -145,6 +145,10 @@ #include "base/base_switches.h" #endif +#if BUILDFLAG(IS_TIZEN) +#include "ui/display/device_display_info_efl.h" +#endif + using gfx::RectToSkIRect; using gfx::SkIRectToRect; @@ -315,6 +319,13 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura( ? std::make_unique(this, &web_contents) : std::make_unique(this, &web_contents); #endif +#if BUILDFLAG(IS_TIZEN) + display::DeviceDisplayInfoEfl display_info; + rotation_ = display_info.GetRotationDegrees(); + LOG(INFO) << "Rotation_ " << rotation_; + if (aura_efl_helper()) + aura_efl_helper()->SetOrientation(rotation_); +#endif } //////////////////////////////////////////////////////////////////////////////// @@ -441,6 +452,17 @@ void RenderWidgetHostViewAura::Hide() { HideImpl(); } +#if BUILDFLAG(IS_TIZEN) +void RenderWidgetHostViewAura::UpdateRotationDegrees(int rotation_degrees) { + rotation_ = rotation_degrees; + LOG(INFO) << "Rotation_degrees " << rotation_degrees; + TRACE_EVENT1("viz", "RenderWidgetHostViewAura::UpdateRotationDegrees", + "rotation_", rotation_); + if (aura_efl_helper()) + aura_efl_helper()->SetOrientation(rotation_); +} +#endif + void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { // For a SetSize operation, we don't care what coordinate system the origin // of the window is in, it's only important to make sure that the origin diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h index 92245f7..28061eb 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h @@ -193,6 +193,10 @@ class CONTENT_EXPORT RenderWidgetHostViewAura void VideoPlayingStatusReceived(bool is_playing, int callback_id) override; #endif bool IsKeyboardLocked() override; +#if BUILDFLAG(IS_TIZEN) + // Sets rotation degrees. Expected values are one of { 0, 90, 180, 270 }. + void UpdateRotationDegrees(int rotation_degrees); +#endif base::flat_map GetKeyboardLayoutMap() override; void InvalidateLocalSurfaceIdAndAllocationGroup() override; void ClearFallbackSurfaceForCommitPending() override; @@ -768,6 +772,11 @@ class CONTENT_EXPORT RenderWidgetHostViewAura class EventObserverForPopupExit; std::unique_ptr event_observer_for_popup_exit_; +#if BUILDFLAG(IS_TIZEN) + // rotation degree + int rotation_ = 0; +#endif + // True when content is being loaded. Used to show an hourglass cursor. bool is_loading_; diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc index ca6e320..1bbd090 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc @@ -105,6 +105,10 @@ #include "ui/compositor/compositor.h" #endif +#if BUILDFLAG(IS_TIZEN) +#include "ui/display/device_display_info_efl.h" +#endif + namespace content { std::unique_ptr CreateWebContentsView( @@ -929,6 +933,9 @@ void WebContentsViewAura::Focus() { void WebContentsViewAura::SetOrientation(int orientation) { LOG(INFO) << __FUNCTION__ << " " << orientation; + display::DeviceDisplayInfoEfl display_info; + display_info.SetRotationDegrees(orientation); + RenderWidgetHostViewAura* rwhv_aura = static_cast( web_contents_->GetRenderWidgetHostView()); if (rwhv_aura) { @@ -939,6 +946,12 @@ void WebContentsViewAura::SetOrientation(int orientation) { display_info.SetRotationDegrees(orientation); } #endif + WebContentsImpl& contents_impl = + static_cast(*web_contents_); + + rwhv_aura->UpdateScreenInfo(); + contents_impl.OnScreenOrientationChange(); + rwhv_aura->UpdateRotationDegrees(orientation); } TRACE_EVENT1("viz", "WebContentsViewAura::SetOrientation", "orientation", orientation); diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.h b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.h index f2a5da0..8af89b6 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.h +++ b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.h @@ -155,6 +155,7 @@ class CONTENT_EXPORT RWHVAuraCommonHelperEfl { void VideoPlayingStatusReceived(bool is_playing, int callback_id); #endif + void SetOrientation(int orientation) { rotation_ = orientation; } void OnGestureEvent(ui::GestureEvent* event); void DidChangeInputType(bool is_password_field); void BackgroundColorReceived(int callback_id, SkColor bg_color); @@ -179,6 +180,7 @@ class CONTENT_EXPORT RWHVAuraCommonHelperEfl { gfx::Size custom_viewport_size_; base::IDMap> screen_capture_cb_map_; + int rotation_ = 0; private: ui::EflEventHandler* GetEventHandler(); 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 07a53ba..b80674e 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 @@ -8,6 +8,7 @@ #include #include "base/base_switches.h" +#include "base/trace_event/trace_event.h" #include "content/browser/renderer_host/edge_effect.h" #include "content/browser/renderer_host/render_widget_host_view_aura.h" #include "content/browser/selection/selection_controller_efl.h" @@ -421,6 +422,10 @@ void RWHVAuraOffscreenHelperEfl::PaintTextureToSurface(GLuint texture_id) { evas_gl_api_->glActiveTexture(GL_TEXTURE0); evas_gl_api_->glBindTexture(GL_TEXTURE_2D, texture_id); evas_gl_api_->glUniform1i(source_texture_location_, 0); + + TRACE_EVENT2("viz", "RWHVAuraOffscreenHelperEfl::PaintTextureToSurface", + "this", (void*)this, "rotation", rotation_); + if (rotation_ == 0) { evas_gl_api_->glUniform2f(rotate_position_attrib_, 0, -1); } else if (rotation_ == 90) { diff --git a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.h b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.h index 30202b2..a7644fe 100644 --- a/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.h +++ b/tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_offscreen_helper_efl.h @@ -57,7 +57,6 @@ class CONTENT_EXPORT RWHVAuraOffscreenHelperEfl void SetHorizontalPanningHold(bool hold) { horizontal_panning_hold_ = hold; } bool GetVerticalPanningHold() const { return vertical_panning_hold_; } void SetVerticalPanningHold(bool hold) { vertical_panning_hold_ = hold; } - #if BUILDFLAG(IS_TIZEN_TV) void DrawLabel(Evas_Object* image, Eina_Rectangle rect); void ClearLabels(); @@ -146,8 +145,6 @@ class CONTENT_EXPORT RWHVAuraOffscreenHelperEfl GLuint index_buffer_obj_; gfx::NativeView aura_parent_window_ = nullptr; - int rotation_ = 0; - #if BUILDFLAG(IS_TIZEN_TV) bool radio_or_checkbox_focused_ = false; int password_input_minlength_ = -1; 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 a0a0f51..9c53f95 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 @@ -6,6 +6,7 @@ #include "base/logging.h" #include "base/observer_list.h" +#include "base/trace_event/trace_event.h" #include "tizen/system_info.h" #include "ui/display/device_display_info_observer_efl.h" @@ -137,6 +138,8 @@ bool DeviceDisplayInfoEflImpl::Update(int display_width, void DeviceDisplayInfoEflImpl::SetRotationDegrees(int rotation_degrees) { { + TRACE_EVENT1("viz", "DeviceDisplayInfoEfl::SetRotationDegrees", + "rotation_degrees", rotation_degrees); base::AutoLock autolock(rotation_accessor_); rotation_degrees_ = rotation_degrees; } diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index 82980e4..ef84a2c 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -853,6 +853,8 @@ void EWebView::EnterDragState() { #endif void EWebView::SetOrientation(int orientation) { + LOG(INFO) << "New ori " << orientation << " GetOrientation " + << GetOrientation(); if (GetOrientation() == orientation) return; @@ -860,6 +862,12 @@ void EWebView::SetOrientation(int orientation) { orientation == 270) { #if !defined(USE_AURA) GetWebContentsViewEfl()->SetOrientation(orientation); +#else +#if BUILDFLAG(IS_TIZEN) + TRACE_EVENT2("viz", "EWebView::SetOrientation", "orientation", orientation, + "this", (void*)this); + wcva()->SetOrientation(orientation); +#endif #endif int width = 0; int height = 0; @@ -880,8 +888,12 @@ int EWebView::GetOrientation() { #if !defined(USE_AURA) return GetWebContentsViewEfl()->GetOrientation(); #else +#if BUILDFLAG(IS_TIZEN) + return wcva()->GetOrientation(); +#else return 0; #endif +#endif } void EWebView::Show() { -- 2.7.4 From c735da9d196abf0737e3dc77fc9d1e26d551f009 Mon Sep 17 00:00:00 2001 From: fang fengrong Date: Tue, 26 Mar 2024 16:37:29 +0800 Subject: [PATCH 09/16] [M120 Migration][HBBTV] Implement ewk_context_register_jsplugin_mime_types remove EWK_BRINGUP add fixup code refer: https://review.tizen.org/gerrit/#/c/290762 Change-Id: Iedd44b169d45a2063d385649d7266c5947cfa689 Signed-off-by: fang fengrong --- third_party/blink/common/mime_util/mime_util.cc | 3 --- tizen_src/ewk/efl_integration/content_browser_client_efl.cc | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/third_party/blink/common/mime_util/mime_util.cc b/third_party/blink/common/mime_util/mime_util.cc index 1264d3d..ad06180 100644 --- a/third_party/blink/common/mime_util/mime_util.cc +++ b/third_party/blink/common/mime_util/mime_util.cc @@ -204,13 +204,10 @@ bool MimeUtil::IsSupportedMimeType(const std::string& mime_type) const { #if BUILDFLAG(IS_TIZEN_TV) void MimeUtil::RegisterJavascriptPluginMimeTypes( const std::string& mime_types) { - LOG(ERROR) << " Remove EWK_BRINGUP "; -#if !defined(EWK_BRINGUP) std::stringstream stream(mime_types); std::string mime_type; while (std::getline(stream, mime_type, ',')) javascript_plugin_types_.insert(base::ToLowerASCII(mime_type)); -#endif } bool MimeUtil::IsSupportedJavascriptPluginMimeType( 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 f1b887e..8dd4543 100644 --- a/tizen_src/ewk/efl_integration/content_browser_client_efl.cc +++ b/tizen_src/ewk/efl_integration/content_browser_client_efl.cc @@ -144,6 +144,10 @@ void AppendExtraCommandLineSwitchesInternal(base::CommandLine* command_line, cors_enabled_url_schemes); } + const std::string& mime_types = HbbtvWidgetHost::Get().GetJSPluginMimeTypes(); + if (!mime_types.empty()) + command_line->AppendSwitchASCII(switches::kJSPluginMimeTypes, mime_types); + const double time_offset = static_cast(host->GetBrowserContext()) ->GetTimeOffset(); -- 2.7.4 From ecc660156cb3c32fb33e7c1ac15a6eb98712d4e1 Mon Sep 17 00:00:00 2001 From: "zhishun.zhou" Date: Tue, 26 Mar 2024 17:04:50 +0800 Subject: [PATCH 10/16] [M120 Migration][MM] Ensure player is destroyed before IEMEDrmBridge Issue: when app use EME, chromium pass encrytped frame and key handle to MM, and then MM decrypt frames. When WebMediaPlayerImpl is destroyed, PipelineController::Stop will destroy player by mojom IPC in browser process. But IEMEDrmBridge is destroyed in render process. If IEMEDrmBridge is destroyed before player, MM still use key handle to decrypt, then it will crash. Solution: Use a sync IPC to ensure player is destroyed before IEMEDrmBridge Patches from: https://review.tizen.org/gerrit/#/c/299374/ https://review.tizen.org/gerrit/#/c/300392/ https://review.tizen.org/gerrit/#/c/302624/ Change-Id: I20b77e1c53d3dca685aaf0f355b3b8a149ccc056 Signed-off-by: wuxiaoliang Signed-off-by: zhishun.zhou --- media/base/pipeline.h | 1 + media/base/pipeline_impl.cc | 38 +++++++++++++ media/base/pipeline_impl.h | 1 + media/base/renderer.h | 1 + media/filters/pipeline_controller.cc | 9 +++ media/filters/pipeline_controller.h | 1 + media/mojo/clients/mojo_renderer.cc | 20 +++++++ media/mojo/clients/mojo_renderer.h | 9 +++ media/mojo/clients/mojo_renderer_wrapper.cc | 9 +++ media/mojo/clients/mojo_renderer_wrapper.h | 1 + media/mojo/mojom/renderer.mojom | 3 + media/mojo/services/mojo_renderer_service.cc | 18 ++++++ media/mojo/services/mojo_renderer_service.h | 4 ++ .../platform/media/web_media_player_impl.cc | 29 ++++++++++ .../platform/media/web_media_player_impl.h | 4 ++ .../content/browser/media/tizen_renderer_impl.cc | 11 ++++ .../content/browser/media/tizen_renderer_impl.h | 1 + .../media/filters/media_player_esplusplayer.cc | 65 +++++++++++++++++++--- .../media/filters/media_player_esplusplayer.h | 4 ++ .../media/filters/media_player_esplusplayer_tv.cc | 13 +++++ .../media/filters/media_player_tizen.h | 3 + 21 files changed, 236 insertions(+), 9 deletions(-) diff --git a/media/base/pipeline.h b/media/base/pipeline.h index 0a1260e..d0bbafb 100644 --- a/media/base/pipeline.h +++ b/media/base/pipeline.h @@ -320,6 +320,7 @@ class MEDIA_EXPORT Pipeline { virtual void SetActiveAudioTrack(int index) = 0; virtual void SetActiveVideoTrack(int index) = 0; virtual void SetPreferTextLanguage(const std::string& lang) = 0; + virtual void DestroyPlayerSync(base::OnceClosure cb) = 0; #endif }; diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc index 05d72c1..49553d2 100644 --- a/media/base/pipeline_impl.cc +++ b/media/base/pipeline_impl.cc @@ -121,6 +121,7 @@ class PipelineImpl::RendererWrapper final : public DemuxerHost, void SetActiveAudioTrack(int index); void SetActiveVideoTrack(int index); void SetPreferTextLanguage(const std::string& lang); + void DestroyPlayerSync(base::OnceClosure cb); #endif // |enabled_track_ids| contains track ids of enabled audio tracks. @@ -192,6 +193,7 @@ class PipelineImpl::RendererWrapper final : public DemuxerHost, #if BUILDFLAG(IS_TIZEN_TV) void NotifyTrackInfoToBrowser(int active_track_id) final; void AddTrackInfo(media::MediaTrackInfo trackinfo); + void PlayerDestroyed(); #endif void OnBufferingStateChange(BufferingState state, BufferingStateChangeReason reason) final; @@ -294,6 +296,7 @@ class PipelineImpl::RendererWrapper final : public DemuxerHost, #if BUILDFLAG(IS_TIZEN_TV) std::string mime_type_; std::unique_ptr decrypting_media_resource_{nullptr}; + base::OnceClosure player_destroy_cb_; #endif // Whether we've received the audio/video ended events. @@ -789,6 +792,31 @@ void PipelineImpl::RendererWrapper:: base::BindRepeating(&RendererWrapper::OnWaiting, weak_factory_.GetWeakPtr())); } +void PipelineImpl::RendererWrapper::DestroyPlayerSync(base::OnceClosure cb) { + DCHECK(media_task_runner_->RunsTasksInCurrentSequence()); + LOG(INFO) << "(" << static_cast(this) << ") ;" << __func__; + + // If we destory during starting/seeking/suspending/resuming we don't want to + // leave outstanding callbacks around + pending_callbacks_.reset(); + + player_destroy_cb_ = std::move(cb); + if (shared_state_.renderer) { + shared_state_.renderer->DestroyPlayerSync(base::BindOnce( + &RendererWrapper::PlayerDestroyed, weak_factory_.GetWeakPtr())); + } else { + LOG(INFO) << "(" << static_cast(this) << ") ;" << __func__ + << ", shared_state_.renderer is null"; + std::move(player_destroy_cb_).Run(); + } +} + +void PipelineImpl::RendererWrapper::PlayerDestroyed() { + LOG(INFO) << "(" << static_cast(this) << ") ;" + << "signal: player is destroyed"; + // signal + std::move(player_destroy_cb_).Run(); +} #endif void PipelineImpl::RendererWrapper::CreateRendererInternal( @@ -1898,6 +1926,16 @@ void PipelineImpl::SetCdm(CdmContext* cdm_context, base::BindPostTaskToCurrentDefault(std::move(cdm_attached_cb)))); } +#if BUILDFLAG(IS_TIZEN_TV) +void PipelineImpl::DestroyPlayerSync(base::OnceClosure cb) { + DCHECK(thread_checker_.CalledOnValidThread()); + media_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&RendererWrapper::DestroyPlayerSync, + base::Unretained(renderer_wrapper_.get()), std::move(cb))); +} +#endif + #if defined(TIZEN_MULTIMEDIA) void PipelineImpl::ToggleFullscreenMode(bool is_fullscreen, ToggledFullscreenCB cb) { diff --git a/media/base/pipeline_impl.h b/media/base/pipeline_impl.h index c933533..dfe55b6 100644 --- a/media/base/pipeline_impl.h +++ b/media/base/pipeline_impl.h @@ -183,6 +183,7 @@ class MEDIA_EXPORT PipelineImpl : public Pipeline { void SetActiveAudioTrack(int index) override; void SetActiveVideoTrack(int index) override; void SetPreferTextLanguage(const std::string& lang) override; + void DestroyPlayerSync(base::OnceClosure cb) override; #endif void OnBufferingStateChange(BufferingState state, BufferingStateChangeReason reason); diff --git a/media/base/renderer.h b/media/base/renderer.h index bde538a..6884f6a 100644 --- a/media/base/renderer.h +++ b/media/base/renderer.h @@ -114,6 +114,7 @@ class MEDIA_EXPORT Renderer { virtual void SetActiveAudioTrack(int index) {} virtual void SetActiveVideoTrack(int index) {} virtual void SetPreferTextLanguage(const std::string& lang) {} + virtual void DestroyPlayerSync(base::OnceClosure cb) {} #endif // Starts rendering from |time|. diff --git a/media/filters/pipeline_controller.cc b/media/filters/pipeline_controller.cc index eed47f6..1128216 100644 --- a/media/filters/pipeline_controller.cc +++ b/media/filters/pipeline_controller.cc @@ -521,5 +521,14 @@ void PipelineController::SetPreferTextLanguage(const std::string& lang) { } pipeline_->SetPreferTextLanguage(lang); } + +void PipelineController::DestroyPlayerSync(base::OnceClosure cb) { + if (pipeline_) { + pipeline_->DestroyPlayerSync(std::move(cb)); + } else { + LOG(ERROR) << "pipeline_ is null"; + std::move(cb).Run(); + } +} #endif } // namespace media diff --git a/media/filters/pipeline_controller.h b/media/filters/pipeline_controller.h index 113d8bb..6e678c1 100644 --- a/media/filters/pipeline_controller.h +++ b/media/filters/pipeline_controller.h @@ -170,6 +170,7 @@ class MEDIA_EXPORT PipelineController { void SetActiveAudioTrack(int index); void SetActiveVideoTrack(int index); void SetPreferTextLanguage(const std::string& lang); + void DestroyPlayerSync(base::OnceClosure cb); #endif private: // Attempts to make progress from the current state to the target state. diff --git a/media/mojo/clients/mojo_renderer.cc b/media/mojo/clients/mojo_renderer.cc index 55c5084..4f4f7f2 100644 --- a/media/mojo/clients/mojo_renderer.cc +++ b/media/mojo/clients/mojo_renderer.cc @@ -400,6 +400,26 @@ void MojoRenderer::SetPreferTextLanguage(const std::string& lang) { } remote_renderer_->SetPreferTextLanguage(lang); } + +void MojoRenderer::DestroyPlayerSync(base::OnceClosure cb) { + DVLOG(2) << __func__; + DCHECK(task_runner_->RunsTasksInCurrentSequence()); + DCHECK(remote_renderer_.is_bound()); + DCHECK(cb); + DCHECK(!player_destroy_cb_); + + player_destroy_cb_ = std::move(cb); + remote_renderer_->DestroyPlayerSync( + base::BindOnce(&MojoRenderer::OnPlayerDestroyed, base::Unretained(this))); +} + +void MojoRenderer::OnPlayerDestroyed() { + LOG(INFO) << "OnPlayerDestroyed"; + DCHECK(task_runner_->RunsTasksInCurrentSequence()); + DCHECK(player_destroy_cb_); + + std::move(player_destroy_cb_).Run(); +} #endif void MojoRenderer::OnWaiting(WaitingReason reason) { diff --git a/media/mojo/clients/mojo_renderer.h b/media/mojo/clients/mojo_renderer.h index aa08217..53c9754 100644 --- a/media/mojo/clients/mojo_renderer.h +++ b/media/mojo/clients/mojo_renderer.h @@ -83,6 +83,7 @@ class MojoRenderer : public Renderer, public mojom::RendererClient { void SetActiveAudioTrack(int index) override; void SetActiveVideoTrack(int index) override; void SetPreferTextLanguage(const std::string& lang) override; + void DestroyPlayerSync(base::OnceClosure cb) override; #endif private: @@ -138,6 +139,10 @@ class MojoRenderer : public Renderer, public mojom::RendererClient { void OnSeekCompleted(); #endif +#if BUILDFLAG(IS_TIZEN_TV) + void OnPlayerDestroyed(); +#endif + void CancelPendingCallbacks(); // |task_runner| on which all methods are invoked, except for GetMediaTime(), @@ -189,6 +194,10 @@ class MojoRenderer : public Renderer, public mojom::RendererClient { base::OnceClosure seek_cb_; #endif +#if BUILDFLAG(IS_TIZEN_TV) + base::OnceClosure player_destroy_cb_; +#endif + float volume_ = 1.0f; // Lock used to serialize access for |time_interpolator_|. diff --git a/media/mojo/clients/mojo_renderer_wrapper.cc b/media/mojo/clients/mojo_renderer_wrapper.cc index 4f1c591..548e650 100644 --- a/media/mojo/clients/mojo_renderer_wrapper.cc +++ b/media/mojo/clients/mojo_renderer_wrapper.cc @@ -111,6 +111,15 @@ void MojoRendererWrapper::SetPreferTextLanguage(const std::string& lang) { if (mojo_renderer_) mojo_renderer_->SetPreferTextLanguage(lang); } + +void MojoRendererWrapper::DestroyPlayerSync(base::OnceClosure cb) { + if (mojo_renderer_) { + mojo_renderer_->DestroyPlayerSync(std::move(cb)); + } else { + LOG(ERROR) << "mojo_renderer_ is null"; + std::move(cb).Run(); + } +} #endif } // namespace media diff --git a/media/mojo/clients/mojo_renderer_wrapper.h b/media/mojo/clients/mojo_renderer_wrapper.h index fb68130..719b0e1 100644 --- a/media/mojo/clients/mojo_renderer_wrapper.h +++ b/media/mojo/clients/mojo_renderer_wrapper.h @@ -55,6 +55,7 @@ class MojoRendererWrapper : public Renderer { void SetActiveVideoTrack(int index) override; void SetActiveAudioTrack(int index) override; void SetPreferTextLanguage(const std::string& lang) override; + void DestroyPlayerSync(base::OnceClosure cb) override; #endif base::TimeDelta GetMediaTime() override; diff --git a/media/mojo/mojom/renderer.mojom b/media/mojo/mojom/renderer.mojom index 71979eb..7c83186 100644 --- a/media/mojo/mojom/renderer.mojom +++ b/media/mojo/mojom/renderer.mojom @@ -85,6 +85,9 @@ interface Renderer { [EnableIf=is_tizen_tv] SetPreferTextLanguage(string lang); + + [EnableIf=is_tizen_tv] + DestroyPlayerSync() => (); }; // A Mojo equivalent of media::RendererClient. See media/mojo/README.md diff --git a/media/mojo/services/mojo_renderer_service.cc b/media/mojo/services/mojo_renderer_service.cc index 5537033..43333c8 100644 --- a/media/mojo/services/mojo_renderer_service.cc +++ b/media/mojo/services/mojo_renderer_service.cc @@ -259,6 +259,24 @@ void MojoRendererService::SetPreferTextLanguage(const std::string& lang) { } renderer_->SetPreferTextLanguage(lang); } + +void MojoRendererService::OnPlayerDestroyed(base::OnceClosure destroy_cb) { + LOG(INFO) << "OnPlayerDestroyed"; + std::move(destroy_cb).Run(); +} + +void MojoRendererService::DestroyPlayerSync(base::OnceClosure destroy_cb) { + DVLOG(2) << __func__; + + if (renderer_) { + renderer_->DestroyPlayerSync( + base::BindOnce(&MojoRendererService::OnPlayerDestroyed, weak_this_, + std::move(destroy_cb))); + } else { + LOG(ERROR) << "renderer_ is null"; + std::move(destroy_cb).Run(); + } +} #endif void MojoRendererService::OnBufferingStateChange( diff --git a/media/mojo/services/mojo_renderer_service.h b/media/mojo/services/mojo_renderer_service.h index afc535a..0dda352 100644 --- a/media/mojo/services/mojo_renderer_service.h +++ b/media/mojo/services/mojo_renderer_service.h @@ -89,6 +89,7 @@ class MEDIA_MOJO_EXPORT MojoRendererService final : public mojom::Renderer, void SetActiveAudioTrack(int index) final; void SetActiveVideoTrack(int index) final; void SetPreferTextLanguage(const std::string& lang) final; + void DestroyPlayerSync(base::OnceClosure destroy_cb) final; #endif private: @@ -105,6 +106,9 @@ class MEDIA_MOJO_EXPORT MojoRendererService final : public mojom::Renderer, void OnFallback(PipelineStatus status) final; void OnEnded() final; void OnStatisticsUpdate(const PipelineStatistics& stats) final; +#if BUILDFLAG(IS_TIZEN_TV) + void OnPlayerDestroyed(base::OnceClosure destroy_cb); +#endif void OnBufferingStateChange(BufferingState state, BufferingStateChangeReason reason) final; void OnWaiting(WaitingReason reason) final; diff --git a/third_party/blink/renderer/platform/media/web_media_player_impl.cc b/third_party/blink/renderer/platform/media/web_media_player_impl.cc index b632c01..2e8bdd1 100644 --- a/third_party/blink/renderer/platform/media/web_media_player_impl.cc +++ b/third_party/blink/renderer/platform/media/web_media_player_impl.cc @@ -34,6 +34,7 @@ #include "build/build_config.h" #include "cc/layers/video_layer.h" #include "components/viz/common/gpu/raster_context_provider.h" +#include "content/public/common/content_switches.h" #include "media/audio/null_audio_sink.h" #include "media/base/audio_renderer_sink.h" #include "media/base/cdm_context.h" @@ -609,6 +610,25 @@ WebMediaPlayerImpl::~WebMediaPlayerImpl() { std::move(media_thread_mem_dumper_)); main_thread_mem_dumper_.reset(); +#if BUILDFLAG(IS_TIZEN_TV) + // for app eme case, we must ensure player is destroyed before IEMEDrmBridge + // PipelineController::Stop will destroy player by mojom IPC and destroy + // finish time is not fixed Now we split the original PipelineController::Stop + // fuction to 2 parts: + // 1. DestroyPlayerSync only destroy MediaPlayerESPlusPlayer + // 2. Stop is the same with the original logic except 1, such as destroy + // MediaPlayerRendererClient/MojoRendererWrapper/MojoRenderer/MojoRendererService + // /TizenRendererImpl + if (IsSyncDestroyPlayerNeeded()) { + LOG(INFO) << "need destroy player sync..."; + base::WaitableEvent waiter(base::WaitableEvent::ResetPolicy::AUTOMATIC, + base::WaitableEvent::InitialState::NOT_SIGNALED); + pipeline_controller_->DestroyPlayerSync(base::BindOnce( + &base::WaitableEvent::Signal, base::Unretained(&waiter))); + waiter.Wait(); + } +#endif + // The underlying Pipeline must be stopped before it is destroyed. // // Note: This destruction happens synchronously on the media thread and @@ -2261,6 +2281,15 @@ void WebMediaPlayerImpl::SetActiveVideoTrack(int index) { void WebMediaPlayerImpl::SetPreferTextLanguage(const std::string& lang) { pipeline_controller_->SetPreferTextLanguage(lang); } + +bool WebMediaPlayerImpl::IsSyncDestroyPlayerNeeded() { + bool single_process_mode = base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kSingleProcess); + bool isMSE = load_type_ == kLoadTypeMediaSource; + if (isMSE && single_process_mode && cdm_context_ref_) + return true; + return false; +} #endif bool WebMediaPlayerImpl::CanPlayThrough() { diff --git a/third_party/blink/renderer/platform/media/web_media_player_impl.h b/third_party/blink/renderer/platform/media/web_media_player_impl.h index e4b2115..834286d 100644 --- a/third_party/blink/renderer/platform/media/web_media_player_impl.h +++ b/third_party/blink/renderer/platform/media/web_media_player_impl.h @@ -533,6 +533,10 @@ class PLATFORM_EXPORT WebMediaPlayerImpl // Can return a nullptr. scoped_refptr GetCurrentFrameFromCompositor() const; +#if BUILDFLAG(IS_TIZEN_TV) + bool IsSyncDestroyPlayerNeeded(); +#endif + // Sets CdmContext from |cdm| on the pipeline and calls OnCdmAttached() // when done. void SetCdmInternal(WebContentDecryptionModule* cdm); diff --git a/tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.cc b/tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.cc index a09bc9f..53c0d5a 100644 --- a/tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.cc +++ b/tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.cc @@ -577,6 +577,17 @@ void TizenRendererImpl::SetParentalRatingResult(bool is_pass) { LOG_ID(ERROR, player_id_) << "media_player_ is null"; } +void TizenRendererImpl::DestroyPlayerSync(base::OnceClosure destroy_cb) { + if (media_player_) { + media::MediaPlayerRegistry::GetInstance()->DeactivateMediaPlayer( + player_id_, !resource_conflicted_); + media_player_->DestroyPlayerSync(std::move(destroy_cb)); + } else { + LOG_ID(INFO, player_id_) << "media_player_ is nullptr"; + std::move(destroy_cb).Run(); + } +} + bool TizenRendererImpl::PlaybackNotificationEnabled() { content::WebContents* web_contents = GetWebContents(); if (!web_contents) { 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 8208990..bc29db0 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 @@ -159,6 +159,7 @@ class CONTENT_EXPORT TizenRendererImpl #if BUILDFLAG(IS_TIZEN_TV) void SetContentMimeType(const std::string& mime_type) override; void SetParentalRatingResult(bool is_pass) override; + void DestroyPlayerSync(base::OnceClosure destroy_cb) override; #endif private: diff --git a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc index e091b85..6b1d9f3 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc +++ b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.cc @@ -128,7 +128,15 @@ MediaPlayerESPlusPlayer::MediaPlayerESPlusPlayer() { } MediaPlayerESPlusPlayer::~MediaPlayerESPlusPlayer() { - LOG(INFO) << "(" << static_cast(this) << ") " << __func__; +#if BUILDFLAG(IS_TIZEN_TV) + if (!esplayer_) { + LOG_ID(INFO, player_id_) << "player is already destroyed:" << (void*)this; + return; + } +#endif + + LOG_ID(INFO, player_id_) << "(" << static_cast(this) << ") " + << __func__; weak_factory_.InvalidateWeakPtrs(); // Player should be released before destroyed. @@ -142,6 +150,32 @@ MediaPlayerESPlusPlayer::~MediaPlayerESPlusPlayer() { esplayer_ = nullptr; } +#if BUILDFLAG(IS_TIZEN_TV) +void MediaPlayerESPlusPlayer::DestroyPlayerSync(base::OnceClosure destroy_cb) { + if (!esplayer_) { + LOG_ID(INFO, player_id_) << "player is already destroyed:" << (void*)this; + std::move(destroy_cb).Run(); + return; + } + + LOG_ID(INFO, player_id_) << "(" << static_cast(this) << ") " + << __func__; + weak_factory_.InvalidateWeakPtrs(); + + Release(); + + int error = esplusplayer_destroy(esplayer_); + if (error != ESPLUSPLAYER_ERROR_TYPE_NONE) + LOG_ID(ERROR, player_id_) + << "esplusplayer_destroy failed, error #" + << esplusplayer_get_error_string( + static_cast(error)); + esplayer_ = nullptr; + + std::move(destroy_cb).Run(); +} +#endif + bool MediaPlayerESPlusPlayer::CreatePlayer(int player_id) { player_id_ = player_id; @@ -174,10 +208,11 @@ bool MediaPlayerESPlusPlayer::CreatePlayer(int player_id) { } void MediaPlayerESPlusPlayer::Initialize(VideoRendererSink* sink) { - LOG(INFO) << "(" << static_cast(this) << ") " << __func__; + LOG_ID(INFO, player_id_) << "(" << static_cast(this) << ") " + << __func__; if (!esplayer_) { - LOG(INFO) << "(" << static_cast(this) << ") " + LOG_ID(INFO, player_id_) << "(" << static_cast(this) << ") " << "esplayer is null."; return; } @@ -239,8 +274,14 @@ void MediaPlayerESPlusPlayer::SetStreamInfo(DemuxerStream::Type type, void MediaPlayerESPlusPlayer::Prepare() { LOG(INFO) << "(" << static_cast(this) << ") " << __func__; - if (!esplayer_ || is_prepared_ || is_preparing_) + if (!esplayer_ || is_prepared_ || is_preparing_) { + LOG_ID(ERROR, player_id_) + << "(" << static_cast(this) << ") " << __func__ + << ", esplayer_: " << static_cast(esplayer_) + << ", is_prepared_: " << is_prepared_ + << ", is_preparing_: " << is_preparing_; return; + } if (GetPlayerState() != ESPLUSPLAYER_STATE_IDLE) { LOG(ERROR) << "(" << static_cast(this) << ") " << __func__ @@ -274,7 +315,7 @@ bool MediaPlayerESPlusPlayer::IsPrepared() { } bool MediaPlayerESPlusPlayer::CanPrepare() { - return !IsPrepared() && !is_preparing_; + return esplayer_ && !IsPrepared() && !is_preparing_; } void MediaPlayerESPlusPlayer::Release() { @@ -1403,7 +1444,7 @@ void MediaPlayerESPlusPlayer::SetMediaGeometry(const gfx::Rect& viewport_rect, << " rect : " << rect.ToString(); if (!esplayer_ || !video_plane_controller_) { - LOG(INFO) + LOG_ID(INFO, player_id_) << "(" << static_cast(this) << ") " << "player is destroyed, or video plane controller not exist."; return; @@ -1413,10 +1454,16 @@ void MediaPlayerESPlusPlayer::SetMediaGeometry(const gfx::Rect& viewport_rect, } void MediaPlayerESPlusPlayer::PrepareVideoHole() { - LOG(INFO) << "(" << static_cast(this) << ") " << __func__; - if (!esplayer_ || is_prepared_ || is_preparing_) + LOG_ID(INFO, player_id_) << "(" << static_cast(this) << ") " + << __func__; + if (!esplayer_ || is_prepared_ || is_preparing_) { + LOG_ID(ERROR, player_id_) + << "(" << static_cast(this) << ") " << __func__ + << ", esplayer_: " << static_cast(esplayer_) + << ", is_prepared_: " << is_prepared_ + << ", is_preparing_: " << is_preparing_; return; - + } if (GetPlayerState() != ESPLUSPLAYER_STATE_IDLE) { LOG(ERROR) << "(" << static_cast(this) << ") " << __func__ << " Prepare called on invalid state : " diff --git a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.h b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.h index a8e9c59..ec62e6b 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.h +++ b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer.h @@ -85,6 +85,10 @@ class MEDIA_EXPORT MediaPlayerESPlusPlayer : public MediaPlayerTizen { void DestroyMediaPacket(void* media_packet) override; #endif +#if BUILDFLAG(IS_TIZEN_TV) + void DestroyPlayerSync(base::OnceClosure destroy_cb) override; +#endif + // Callback handler void OnReadyToPrepare(const esplusplayer_stream_type stream_type); virtual void OnPrepareComplete(bool result); diff --git a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.cc b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.cc index 84361c1..c781940 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.cc +++ b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.cc @@ -30,6 +30,13 @@ MediaPlayerESPlusPlayerTV::~MediaPlayerESPlusPlayerTV() { void MediaPlayerESPlusPlayerTV::Initialize(VideoRendererSink* sink) { LOG(INFO) << "(" << static_cast(this) << ") " << __func__; + + if (!esplayer_) { + LOG_ID(INFO, player_id_) << "(" << static_cast(this) << ") " + << "esplayer is null."; + return; + } + single_process_mode_ = base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kSingleProcess); MediaPlayerESPlusPlayer::Initialize(sink); @@ -41,6 +48,12 @@ void MediaPlayerESPlusPlayerTV::InitializeStreamConfig( DemuxerStream::Type type) { LOG(INFO) << "(" << static_cast(this) << ") " << __func__; + if (!esplayer_) { + LOG_ID(INFO, player_id_) << "(" << static_cast(this) << ") " + << "esplayer is null."; + return; + } + MediaPlayerESPlusPlayer::InitializeStreamConfig(type); } diff --git a/tizen_src/chromium_impl/media/filters/media_player_tizen.h b/tizen_src/chromium_impl/media/filters/media_player_tizen.h index d24ffc6..0fbfcb6 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_tizen.h +++ b/tizen_src/chromium_impl/media/filters/media_player_tizen.h @@ -116,6 +116,9 @@ class MEDIA_EXPORT MediaPlayerTizen { virtual void SetActiveVideoTrack(int index) {} virtual void SetPreferTextLanguage(const std::string& lang) {} virtual void UpdateEventData(std::string data) {} +#if BUILDFLAG(IS_TIZEN_TV) + virtual void DestroyPlayerSync(base::OnceClosure destroy_cb) {} +#endif }; } // namespace media -- 2.7.4 From 1d960402b90ded5d575195c9758c95fa4f2c717b Mon Sep 17 00:00:00 2001 From: fangfengrong Date: Wed, 27 Mar 2024 08:55:10 +0800 Subject: [PATCH 11/16] [M120 Migration][VD] Add schemes for Tizen TV product Fix hbbtv schemes don't call in IsURLHandledByNetworkService refer: https://review.tizen.org/gerrit/#/c/292964 Change-Id: I8e65d60c46e8d585642047661580147bf9e178eb Signed-off-by: fangfengrong --- services/network/public/cpp/url_util.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/network/public/cpp/url_util.cc b/services/network/public/cpp/url_util.cc index 04ec563..bb2cfd7 100644 --- a/services/network/public/cpp/url_util.cc +++ b/services/network/public/cpp/url_util.cc @@ -9,14 +9,13 @@ namespace network { bool IsURLHandledByNetworkService(const GURL& url) { - return (url.SchemeIsHTTPOrHTTPS() || url.SchemeIsWSOrWSS()); - #if BUILDFLAG(IS_TIZEN_TV) if (url.SchemeIs(url::kDvbScheme) || url.SchemeIs(url::kMmfScheme) || url.SchemeIs(url::kTVKeyScheme) || url.SchemeIs(url::kOpAppScheme) || url.SchemeIs(url::kHbbTVCarouselScheme) || url.SchemeIs(url::kCIScheme)) return true; #endif + return (url.SchemeIsHTTPOrHTTPS() || url.SchemeIsWSOrWSS()); } } // namespace network -- 2.7.4 From afe75ece047987427ae35953b50acf8f0c3e3f29 Mon Sep 17 00:00:00 2001 From: jiangyuwei Date: Mon, 25 Mar 2024 15:13:55 +0800 Subject: [PATCH 12/16] [M120 Migration][VD][Accessibility] TV customization of accessibility 1. TTS does not output for blur and focus on the same node 2. Ignore uncheck event for radio button 3. Do not emit children-changed::remove when subtree will be deleted 4. Avoid description and name completely same 5. Set focus ring color to blue on tizen TV 6. Show focus ring on tv browser References: - https://review.tizen.org/gerrit/#/c/291477/ Change-Id: I183f4702cd43744f8f4bc7fb12a40bcdb74f2b7a Signed-off-by: jiangyuwei --- .../accessibility/browser_accessibility_manager.cc | 11 ++++++++ .../blink/renderer/core/exported/web_view_impl.cc | 8 ++++++ .../blink/renderer/core/layout/layout_theme.cc | 20 +++++++++++++ .../renderer/modules/accessibility/ax_object.cc | 8 ++++++ .../modules/accessibility/ax_object_cache_impl.cc | 8 ++++++ .../accessibility/platform/ax_platform_node_efl.cc | 33 ++++++++++++---------- .../platform/ax_platform_node_auralinux.cc | 18 ++++++++++++ 7 files changed, 91 insertions(+), 15 deletions(-) diff --git a/content/browser/accessibility/browser_accessibility_manager.cc b/content/browser/accessibility/browser_accessibility_manager.cc index 95a81ac1..5bd0206 100644 --- a/content/browser/accessibility/browser_accessibility_manager.cc +++ b/content/browser/accessibility/browser_accessibility_manager.cc @@ -406,6 +406,17 @@ bool BrowserAccessibilityManager::OnAccessibilityEvents( if (!use_custom_device_scale_factor_for_testing_) UpdateDeviceScaleFactor(); +#if BUILDFLAG(IS_TIZEN_TV) + // if blur event, last_focused_node_ should be set to root or nullptr + // for next focus change event. And it may be already set to nullptr + // in OnAtomicUpdateFinished, do not reset it here in this case. + // for case: blur -> change content -> refocus on the same node + for (const ui::AXEvent& event : details.events) { + if (event.event_type == ax::mojom::Event::kBlur && GetLastFocusedNode()) + SetLastFocusedNode(GetRoot()); + } +#endif + // Optionally merge multiple tree updates into fewer updates. const std::vector* tree_updates = &details.updates; std::vector merged_tree_updates; 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 3045cba..6db04fe 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc @@ -3642,7 +3642,11 @@ void WebViewImpl::UpdateRendererPreferences( #if defined(USE_AURA) if (renderer_preferences_.use_custom_colors) { +#if !BUILDFLAG(IS_TIZEN_TV) + // It will set focus ring color to default, but for tizen TV, + // focus ring color will be set in layout_theme_chromium_tizen.cc. SetFocusRingColor(renderer_preferences_.focus_ring_color); +#endif SetSelectionColors(renderer_preferences_.active_selection_bg_color, renderer_preferences_.active_selection_fg_color, renderer_preferences_.inactive_selection_bg_color, @@ -3651,9 +3655,13 @@ void WebViewImpl::UpdateRendererPreferences( } #endif +#if !BUILDFLAG(IS_TIZEN_TV) + // It will set focus ring color to default, but for tizen TV, + // focus ring color will be set in layout_theme_chromium_tizen.cc. if (renderer_preferences_.use_custom_colors) { SetFocusRingColor(renderer_preferences_.focus_ring_color); } +#endif if (old_accept_languages != renderer_preferences_.accept_languages) AcceptLanguagesChanged(); diff --git a/third_party/blink/renderer/core/layout/layout_theme.cc b/third_party/blink/renderer/core/layout/layout_theme.cc index 8213d02..7573328 100644 --- a/third_party/blink/renderer/core/layout/layout_theme.cc +++ b/third_party/blink/renderer/core/layout/layout_theme.cc @@ -63,6 +63,10 @@ #include "ui/base/ui_base_features.h" #include "ui/native_theme/native_theme.h" +#if BUILDFLAG(IS_TIZEN_TV) +#include "third_party/blink/public/platform/web_application_type.h" +#endif + // The methods in this file are shared by all themes on every platform. namespace blink { @@ -421,6 +425,22 @@ bool LayoutTheme::IsControlStyled(ControlPart part, bool LayoutTheme::ShouldDrawDefaultFocusRing(const Node* node, const ComputedStyle& style) const { +#if BUILDFLAG(IS_TIZEN) + bool should_draw = false; + if (node) { + LocalFrame* frame = node->GetDocument().GetFrame(); + Settings* settings = nullptr; + if (frame) + settings = frame->GetSettings(); +#if BUILDFLAG(IS_TIZEN_TV) + if (IsWebBrowser() && settings && settings->GetSpatialNavigationEnabled()) + should_draw = true; +#endif + } + if (!should_draw) + return false; +#endif + if (!node) return true; if (!style.HasEffectiveAppearance() && !node->IsLink()) diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.cc b/third_party/blink/renderer/modules/accessibility/ax_object.cc index 8793fc9..0f08deb 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object.cc @@ -1828,7 +1828,15 @@ void AXObject::SerializeNameAndDescriptionAttributes( AXObjectVector description_objects; String description = Description(name_from, description_from, &description_objects); +#if BUILDFLAG(IS_TIZEN_TV) + // If description string is identical with name string, abandon it. + // Delete leading and trailing white space characters before comparing. + if (!description.empty() && + base::TrimWhitespaceASCII(description.Utf8(), base::TRIM_ALL) != + base::TrimWhitespaceASCII(name.Utf8(), base::TRIM_ALL)) { +#else if (!description.empty()) { +#endif DCHECK(description_from != ax::mojom::blink::DescriptionFrom::kNone); TruncateAndAddStringAttribute( node_data, ax::mojom::blink::StringAttribute::kDescription, diff --git a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc index 6f604e7..11c1b7a 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc @@ -4298,6 +4298,14 @@ void AXObjectCacheImpl::HandleFocusedUIElementChanged( if (old_focused_element) { DeferTreeUpdate(TreeUpdateReason::kNodeLostFocus, old_focused_element); } +#if BUILDFLAG(IS_TIZEN_TV) + else { + // If old_focused_element's ax object is nullptr, set it to root, + // or else the blur event can not be sent to browser process. + // for case: blur -> change content -> refocus on the same node + PostNotification(Root(), ax::mojom::Event::kBlur); + } +#endif UpdateActiveAriaModalDialog(new_focused_element); diff --git a/tizen_src/chromium_impl/ui/accessibility/platform/ax_platform_node_efl.cc b/tizen_src/chromium_impl/ui/accessibility/platform/ax_platform_node_efl.cc index 5f784a7..c200a80 100644 --- a/tizen_src/chromium_impl/ui/accessibility/platform/ax_platform_node_efl.cc +++ b/tizen_src/chromium_impl/ui/accessibility/platform/ax_platform_node_efl.cc @@ -102,11 +102,10 @@ void AXPlatformNodeEfl::SetInterfaceMaskFromObject( // AX_ATTR_NAME attribute value which contains link or heading contents will // be read by screen-reader anyway as it is returned from get_name atk // interface. - switch (GetData().role) { - case ax::mojom::Role::kHeading: - case ax::mojom::Role::kLink: - return; - } + if (GetData().role == ax::mojom::Role::kHeading || + GetData().role == ax::mojom::Role::kLink) + return; + if (IsTextObjectType() || IsColorWell() || IsSection()) interface_mask.Add(ImplementedAtkInterfaces::Value::kText); @@ -197,7 +196,7 @@ std::string AXPlatformNodeEfl::GetObjectValue() const { GetData().GetStringAttribute(ax::mojom::StringAttribute::kValue); if (!value.empty()) return value; - for (uint32_t i = 0; i < GetChildCount(); i++) { + for (int i = 0; i < GetChildCount(); i++) { AXPlatformNodeEfl* obj = ToAXPlatformNodeEfl( AXPlatformNode::FromNativeViewAccessible(ChildAtIndex(i))); if (obj) { @@ -295,8 +294,9 @@ bool AXPlatformNodeEfl::IsDocument() const { case ax::mojom::Role::kRootWebArea: case ax::mojom::Role::kPdfRoot: return true; + default: + return false; } - return false; } bool AXPlatformNodeEfl::IsAccessible() const { @@ -371,7 +371,7 @@ std::string AXPlatformNodeEfl::GetSupplementaryText() const { std::string AXPlatformNodeEfl::GetChildrenText() const { std::string text; - for (uint32_t i = 0; i < GetChildCount(); i++) { + for (int i = 0; i < GetChildCount(); i++) { AXPlatformNodeEfl* obj = ToAXPlatformNodeEfl( AXPlatformNode::FromNativeViewAccessible(ChildAtIndex(i))); if (obj) { @@ -397,7 +397,7 @@ std::string AXPlatformNodeEfl::GetChildrenText() const { } bool AXPlatformNodeEfl::HasOnlyTextChildren() const { - for (uint32_t i = 0; i < GetChildCount(); i++) { + for (int i = 0; i < GetChildCount(); i++) { AXPlatformNodeEfl* obj = ToAXPlatformNodeEfl( AXPlatformNode::FromNativeViewAccessible(ChildAtIndex(i))); if (obj && !obj->IsTextObjectType()) @@ -407,7 +407,7 @@ bool AXPlatformNodeEfl::HasOnlyTextChildren() const { } bool AXPlatformNodeEfl::HasOnlyTextAndImageChildren() const { - for (uint32_t i = 0; i < GetChildCount(); i++) { + for (int i = 0; i < GetChildCount(); i++) { AXPlatformNodeEfl* obj = ToAXPlatformNodeEfl( AXPlatformNode::FromNativeViewAccessible(ChildAtIndex(i))); if (obj && !obj->IsTextObjectType() && @@ -468,10 +468,7 @@ std::string AXPlatformNodeEfl::GetSubTreeSpeechContent() const { std::string result; // if name from contents, will get it from children - if (static_cast( - GetData().GetIntAttribute(ax::mojom::IntAttribute::kNameFrom)) != - ax::mojom::NameFrom::kContents && - !GetData() + if (!GetData() .GetStringAttribute(ax::mojom::StringAttribute::kName) .empty()) { result.append( @@ -487,7 +484,13 @@ std::string AXPlatformNodeEfl::GetSubTreeSpeechContent() const { result.append(" "); } - for (uint32_t i = 0; i < GetChildCount(); i++) { + // if name from contents, children contents have already been merged in name + if (static_cast( + GetData().GetIntAttribute(ax::mojom::IntAttribute::kNameFrom)) == + ax::mojom::NameFrom::kContents) + return result; + + for (int i = 0; i < GetChildCount(); i++) { AXPlatformNodeEfl* obj = ToAXPlatformNodeEfl( AXPlatformNode::FromNativeViewAccessible(ChildAtIndex(i))); if (obj) { diff --git a/ui/accessibility/platform/ax_platform_node_auralinux.cc b/ui/accessibility/platform/ax_platform_node_auralinux.cc index a4da26f..e115a5c 100644 --- a/ui/accessibility/platform/ax_platform_node_auralinux.cc +++ b/ui/accessibility/platform/ax_platform_node_auralinux.cc @@ -3517,6 +3517,15 @@ void AXPlatformNodeAuraLinux::OnCheckedStateChanged() { if (!obj) return; +#if BUILDFLAG(IS_TIZEN_TV) + // Checking one radio button alway happened when uncheck another button, + // Sometimes the uncheck event comes after the check event and interrupt + // the reading of check event (see browser setting page), so ignore it + if (ax::mojom::Role::kRadioButton == GetData().role && + GetData().GetCheckedState() == ax::mojom::CheckedState::kFalse) + return; +#endif + atk_object_notify_state_change( ATK_OBJECT(obj), GetAtkStateTypeForCheckableNode(), GetData().GetCheckedState() != ax::mojom::CheckedState::kFalse); @@ -3768,8 +3777,10 @@ void AXPlatformNodeAuraLinux::OnFocused() { return; } +#if !BUILDFLAG(IS_TIZEN_TV) if (atk_object == g_current_focused) return; +#endif SetActiveViewsDialog(); @@ -4093,6 +4104,12 @@ void AXPlatformNodeAuraLinux::OnSubtreeCreated() { } void AXPlatformNodeAuraLinux::OnSubtreeWillBeDeleted() { +#if BUILDFLAG(IS_TIZEN_TV) + // Tizen screen reader not support children-changed event and after + // "children-changed::remove" sent, ATK have a callback to get state + // that could cause crash in GetFocusFromThisOrDescendantFrame + return; +#else // There is a chance there won't be a parent as we're in the deletion process. // We also don't want to notify if this is an ignored node if (!GetParent() || GetData().IsIgnored()) @@ -4108,6 +4125,7 @@ void AXPlatformNodeAuraLinux::OnSubtreeWillBeDeleted() { : -1; g_signal_emit_by_name(GetParent(), "children-changed::remove", index_gint, atk_object); +#endif } void AXPlatformNodeAuraLinux::OnParentChanged() { -- 2.7.4 From 0210b5eaf911ebd7b0c05be18ce5ae1e203181e2 Mon Sep 17 00:00:00 2001 From: jinbei09 Date: Mon, 18 Mar 2024 21:12:15 +0800 Subject: [PATCH 13/16] [M120 Migration][NaCl][PPFwk] Enable VD Trusted Plugins functionality Migrated from tizen 8.0: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/289527/ Change-Id: Idd760f65428cade6f2efa9df96dd8e15871fe795 Signed-off-by: jinbei09 --- chrome/renderer/chrome_content_renderer_client.cc | 21 +--- content/public/renderer/content_renderer_client.cc | 2 - content/renderer/BUILD.gn | 9 -- .../renderer/pepper/pepper_video_decoder_host.cc | 2 +- content/renderer/pepper/ppb_graphics_3d_impl.cc | 28 ----- ppapi/proxy/var_value_converter.cc | 55 +++------- tizen_src/build/gn_chromiumefl.sh | 3 +- .../common/trusted_pepper_plugin_info_cache.cc | 121 +++++++++------------ .../ewk_extension_system_delegate.cc | 12 +- tizen_src/ewk/efl_integration/public/ewk_value.cc | 81 +++++++------- 10 files changed, 118 insertions(+), 216 deletions(-) diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index db900e7..a923e46 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -1492,26 +1492,7 @@ bool ChromeContentRendererClient::IsExternalPepperPlugin( bool ChromeContentRendererClient::IsOriginIsolatedPepperPlugin( const base::FilePath& plugin_path) { - // Hosting plugins in-process is inherently incompatible with attempting to - // process-isolate plugins from different origins. - auto* cmdline = base::CommandLine::ForCurrentProcess(); - if (cmdline->HasSwitch(switches::kPpapiInProcess)) { - // The kPpapiInProcess switch should only be used by tests. In particular, - // we expect that the PDF plugin should always be isolated in the product - // (and that the switch won't interfere with PDF isolation). - CHECK_NE(ChromeContentClient::kPDFInternalPluginPath, plugin_path.value()); - - return false; - } - -#if BUILDFLAG(ENABLE_NACL) - // Don't isolate the NaCl plugin (preserving legacy behavior). - if (plugin_path.value() == nacl::kInternalNaClPluginFileName) - return false; -#endif - - // Isolate all the other plugins (including the PDF plugin + test plugins). - return true; + return plugin_path.value() == ChromeContentClient::kPDFInternalPluginPath; } #if BUILDFLAG(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS) diff --git a/content/public/renderer/content_renderer_client.cc b/content/public/renderer/content_renderer_client.cc index 85a765e..87b9bfe 100644 --- a/content/public/renderer/content_renderer_client.cc +++ b/content/public/renderer/content_renderer_client.cc @@ -4,12 +4,10 @@ #include "content/public/renderer/content_renderer_client.h" -#include "base/command_line.h" #include "base/task/sequenced_task_runner.h" #include "base/task/single_thread_task_runner.h" #include "build/build_config.h" #include "build/chromecast_buildflags.h" -#include "content/public/common/content_switches.h" #include "media/base/demuxer.h" #include "media/base/renderer_factory.h" #include "third_party/blink/public/common/security/protocol_handler_security_level.h" diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn index e5442c4..1cdb209 100644 --- a/content/renderer/BUILD.gn +++ b/content/renderer/BUILD.gn @@ -538,15 +538,6 @@ target(link_target_type, "renderer") { "//ui/base/cursor", "//ui/base/cursor/mojom:cursor_type", ] - - if (is_tizen) { - sources -= [ - "pepper/video_decoder_shim.cc", - "pepper/video_decoder_shim.h", - "pepper/video_encoder_shim.cc", - "pepper/video_encoder_shim.h", - ] - } } if (is_win) { diff --git a/content/renderer/pepper/pepper_video_decoder_host.cc b/content/renderer/pepper/pepper_video_decoder_host.cc index 36cd787..471ff14 100644 --- a/content/renderer/pepper/pepper_video_decoder_host.cc +++ b/content/renderer/pepper/pepper_video_decoder_host.cc @@ -272,8 +272,8 @@ int32_t PepperVideoDecoderHost::OnHostMsgInitialize( context->reply_msg = PpapiPluginMsg_VideoDecoder_InitializeReply(use_shared_images_); return PP_OK; -#endif } +#endif decoder_.reset(); if (acceleration == PP_HARDWAREACCELERATION_ONLY) return PP_ERROR_NOTSUPPORTED; diff --git a/content/renderer/pepper/ppb_graphics_3d_impl.cc b/content/renderer/pepper/ppb_graphics_3d_impl.cc index 2a73734..d074107 100644 --- a/content/renderer/pepper/ppb_graphics_3d_impl.cc +++ b/content/renderer/pepper/ppb_graphics_3d_impl.cc @@ -47,29 +47,6 @@ using blink::WebString; namespace content { -namespace { - -#if BUILDFLAG(IS_TIZEN_TV) -const int32_t kMaxTextureSamples = 4; -#endif - -bool UseSharedImagesSwapChainForPPAPI() { - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kDisablePPAPISharedImagesSwapChain)) { - // This log is to make diagnosing any outages for Enterprise customers - // easier. - LOG(WARNING) << "NaCL SwapChain: Disabled by policy"; - return false; - } - - auto enabled = - base::FeatureList::IsEnabled(features::kPPAPISharedImagesSwapChain); - // This log is to make diagnosing any outages for Enterprise customers easier. - LOG(WARNING) << "NaCL SwapChain: Feature Controled: " << enabled; - return enabled; -} - -} // namespace // This class encapsulates ColorBuffer for the plugin. It wraps corresponding // SharedImage that we draw to and that we send to display compositor. @@ -371,11 +348,6 @@ bool PPB_Graphics3D_Impl::InitRaw( gpu::ContextCreationAttribs attrib_helper; attrib_helper.context_type = gpu::CONTEXT_TYPE_OPENGLES2; -#if BUILDFLAG(IS_TIZEN_TV) - if (attrib_helper.samples > 1 && attrib_helper.sample_buffers > 1) - attrib_helper.samples = std::min(attrib_helper.samples, kMaxTextureSamples); -#endif - gpu::CommandBufferProxyImpl* share_buffer = nullptr; UMA_HISTOGRAM_BOOLEAN("Pepper.Graphics3DHasShareGroup", !!share_context); if (share_context) { diff --git a/ppapi/proxy/var_value_converter.cc b/ppapi/proxy/var_value_converter.cc index b4381e2..2d5a504 100644 --- a/ppapi/proxy/var_value_converter.cc +++ b/ppapi/proxy/var_value_converter.cc @@ -15,29 +15,24 @@ namespace proxy { namespace { -std::unique_ptr ValueFromVarArray(const PP_Var& var) { -#if !defined(EWK_BRINGUP) - LOG(ERROR) << " Remove EWK_BRINGUP "; +std::unique_ptr ValueFromVarArray(const PP_Var& var) { if (var.type == PP_VARTYPE_ARRAY) { scoped_refptr array = scoped_refptr(ArrayVar::FromPPVar(var)); if (!array) { return std::make_unique(); } - auto ret = std::make_unique(); + base::Value::List ret; for (size_t i = 0; i < array->GetLength(); ++i) { ScopedPPVar var(ScopedPPVar::PassRef(), array->Get(i)); - ret->Append(std::move(*ValueFromVar(var.get()))); + ret.Append(std::move(*ValueFromVar(var.get()))); } - return std::move(ret); + return std::make_unique(std::move(ret)); } -#endif - return std::make_unique(); + return std::make_unique(); } -std::unique_ptr ValueFromVarDictionary(const PP_Var& var) { -#if !defined(EWK_BRINGUP) - LOG(ERROR) << " Remove EWK_BRINGUP "; +std::unique_ptr ValueFromVarDictionary(const PP_Var& var) { if (var.type == PP_VARTYPE_DICTIONARY) { scoped_refptr dict = scoped_refptr(DictionaryVar::FromPPVar(var)); @@ -51,7 +46,7 @@ std::unique_ptr ValueFromVarDictionary(const PP_Var& var) { return std::make_unique(); } - auto ret = std::make_unique(); + base::Value::Dict ret; for (size_t i = 0; i < keys->GetLength(); ++i) { ScopedPPVar var_k(ScopedPPVar::PassRef(), keys->Get(i)); scoped_refptr key = @@ -64,50 +59,43 @@ std::unique_ptr ValueFromVarDictionary(const PP_Var& var) { ScopedPPVar var_v(ScopedPPVar::PassRef(), dict->Get(var_k.get())); // SetWithoutPathExpansion is used instead of Set here to allow // e.g. URLs to be used as keys. Set method treats '.' as keys separator. - ret->SetKey(key_string, std::move(*ValueFromVar(var_v.get()))); + ret.Set(key_string, std::move(*ValueFromVar(var_v.get()))); } - return std::move(ret); + return std::make_unique(std::move(ret)); } -#endif - return std::make_unique(); + return std::make_unique(); } ScopedPPVar VarFromValueArray(const base::Value* value) { -#if !defined(EWK_BRINGUP) - LOG(ERROR) << " Remove EWK_BRINGUP "; if (!value) return ScopedPPVar(); if (value->type() == base::Value::Type::LIST) { scoped_refptr ret(new ArrayVar); - const base::ListValue* list = static_cast(value); - size_t size = list->GetList().size(); + const base::Value::List* list = value->GetIfList(); + size_t size = list->size(); ret->SetLength(size); for (size_t i = 0; i < size; ++i) { const base::Value* val; - val = const_cast(&(list->GetList().operator[](i))); + val = const_cast(&(list->operator[](i))); ScopedPPVar var = VarFromValue(val); ret->Set(i, var.get()); } return ScopedPPVar(ScopedPPVar::PassRef(), ret->GetPPVar()); } -#endif return ScopedPPVar(); } ScopedPPVar VarFromValueDictionary(const base::Value* value) { -#if !defined(EWK_BRINGUP) - LOG(ERROR) << " Remove EWK_BRINGUP "; if (!value) return ScopedPPVar(); - if (value->type() == base::Value::Type::DICTIONARY) { + if (value->type() == base::Value::Type::DICT) { scoped_refptr ret(new DictionaryVar); - const base::DictionaryValue* dict; - value->GetAsDictionary(&dict); - base::detail::const_dict_iterator it = dict->DictItems().begin(); - while (it!=dict->DictItems().end()) { + const base::Value::Dict* dict = value->GetIfDict(); + base::detail::const_dict_iterator it = dict->begin(); + while (it!=dict->end()) { ScopedPPVar var_k(ScopedPPVar::PassRef(), StringVar::StringToPPVar(it->first)); ScopedPPVar var_v = VarFromValue(&(it->second)); @@ -116,15 +104,12 @@ ScopedPPVar VarFromValueDictionary(const base::Value* value) { } return ScopedPPVar(ScopedPPVar::PassRef(), ret->GetPPVar()); } -#endif return ScopedPPVar(); } } // namespace std::unique_ptr ValueFromVar(const PP_Var& var) { -#if !defined(EWK_BRINGUP) - LOG(ERROR) << " Remove EWK_BRINGUP "; switch (var.type) { case PP_VARTYPE_BOOL: return std::make_unique(PP_ToBool(var.value.as_bool)); @@ -145,13 +130,10 @@ std::unique_ptr ValueFromVar(const PP_Var& var) { default: return std::make_unique(); } -#endif return std::make_unique(); } ScopedPPVar VarFromValue(const base::Value* value) { -#if !defined(EWK_BRINGUP) - LOG(ERROR) << " Remove EWK_BRINGUP "; if (!value) return ScopedPPVar(); @@ -174,12 +156,11 @@ ScopedPPVar VarFromValue(const base::Value* value) { } case base::Value::Type::LIST: return VarFromValueArray(value); - case base::Value::Type::DICTIONARY: + case base::Value::Type::DICT: return VarFromValueDictionary(value); default: return ScopedPPVar(); } -#endif return ScopedPPVar(); } diff --git a/tizen_src/build/gn_chromiumefl.sh b/tizen_src/build/gn_chromiumefl.sh index ec70017..bc8e429 100755 --- a/tizen_src/build/gn_chromiumefl.sh +++ b/tizen_src/build/gn_chromiumefl.sh @@ -122,7 +122,6 @@ COMMON_GN_PARAMETERS="use_libjpeg_turbo=true use_cups=false depth=\"${TOPDIR}\" use_libpci=false - enable_ppapi=false " add_desktop_flags() { @@ -255,7 +254,7 @@ add_tizen_flags() { " if [ "$tizen_product_tv" == "true" ]; then - ADDITIONAL_GN_PARAMETERS+="tizen_pepper_extensions=false + ADDITIONAL_GN_PARAMETERS+="tizen_pepper_extensions=true " fi diff --git a/tizen_src/ewk/efl_integration/common/trusted_pepper_plugin_info_cache.cc b/tizen_src/ewk/efl_integration/common/trusted_pepper_plugin_info_cache.cc index 08986db..8a30865 100644 --- a/tizen_src/ewk/efl_integration/common/trusted_pepper_plugin_info_cache.cc +++ b/tizen_src/ewk/efl_integration/common/trusted_pepper_plugin_info_cache.cc @@ -72,10 +72,10 @@ const char kPepperManifestMimesExtensionsKey[] = "extensions"; using Hash = std::hash; using FilesContainer = std::unordered_set; -bool GetStringValue(const base::DictionaryValue* dict, +bool GetStringValue(const base::Value::Dict* dict, const std::string& key, std::string* out_value) { - const std::string* val = dict->FindStringPath(key); + const std::string* val = dict->FindStringByDottedPath(key); if (nullptr != val && !val->empty()) { *out_value = *val; return true; @@ -84,10 +84,10 @@ bool GetStringValue(const base::DictionaryValue* dict, return false; } -bool GetStringValue(const base::ListValue* list, +bool GetStringValue(const base::Value::List* list, size_t i, std::string* out_value) { - std::string val = list->GetList().operator[](i).GetString(); + std::string val = list->operator[](i).GetString(); if (!val.empty()) { *out_value = val; return true; @@ -96,49 +96,36 @@ bool GetStringValue(const base::ListValue* list, return false; } -bool GetListValue(const base::DictionaryValue* dict, - const std::string& key, - const base::ListValue** out_value) { - const base::ListValue* val = static_cast(dict->FindListKey(key)); - if (val) { - *out_value = val; - return true; - } +const base::Value::List* GetListValue(const base::Value::Dict* dict, + const std::string& key) { + const base::Value::List* val = dict->FindList(key); - return false; + return val ? val : nullptr; } -bool GetDictionaryValue(const base::DictionaryValue* dict, - const std::string& key, - const base::DictionaryValue** out_value) { - const base::DictionaryValue* val = static_cast(dict->FindDictKey(key)); - if (val) { - *out_value = val; - return true; - } +const base::Value::Dict* GetDictionaryValue(const base::Value::Dict* dict, + const std::string& key) { + const base::Value::Dict* val = dict->FindDict(key); - return false; + return val ? val : nullptr; } -bool GetDictionaryValue(const base::ListValue* list, - size_t i, - const base::DictionaryValue** out_value) { - const base::Value* val; - val = const_cast(&(list->GetList().operator[](i))); - +const base::Value::Dict* GetDictionaryValue(const base::Value::List* list, + size_t i) { + const base::Value* val = const_cast(&(list->operator[](i))); + if(val && val->is_dict()) { - *out_value = static_cast(val); - return true; + return val->GetIfDict(); } - return false; + return nullptr; } -void GetMimeTypeExtensions(const base::DictionaryValue* dict, +void GetMimeTypeExtensions(const base::Value::Dict* dict, std::vector* out_exensions) { - const base::ListValue* list; + const base::Value::List* list = GetListValue(dict, kPepperManifestMimesExtensionsKey); std::string val; - if (GetListValue(dict, kPepperManifestMimesExtensionsKey, &list)) { - size_t size = list->GetList().size(); + if (list) { + size_t size = list->size(); for (size_t i = 0; i < size; ++i) if (GetStringValue(list, i, &val)) out_exensions->push_back(val); @@ -148,15 +135,15 @@ void GetMimeTypeExtensions(const base::DictionaryValue* dict, } bool GetWebPluginMimeType(const FilePath& pmf, - const base::ListValue* mimes, + const base::Value::List* mimes, size_t i, WebPluginMimeType* plugin_mime) { std::string type; std::string description; std::vector extensions; - const base::DictionaryValue* dict = nullptr; - if (GetDictionaryValue(mimes, i, &dict)) { + const base::Value::Dict* dict = GetDictionaryValue(mimes, i); + if (dict) { // "type" : (mandatory) if (!GetStringValue(dict, kPepperManifestMimesTypeKey, &type)) { PARSING_ERROR(pmf) << "MIME type attribute not found"; @@ -180,14 +167,10 @@ bool GetWebPluginMimeType(const FilePath& pmf, } bool GetPuginMimeTypes(const FilePath& pmf, - const base::ListValue* mimes_list, + const base::Value::List* mimes_list, std::vector* mime_types) { - if (mimes_list->type() != base::Value::Type::LIST) { - PARSING_ERROR(pmf) << "The mimes must be a list"; - return false; - } - size_t size = mimes_list->GetList().size(); + size_t size = mimes_list->size(); for (size_t i = 0; i < size; ++i) { WebPluginMimeType mime_type; if (GetWebPluginMimeType(pmf, mimes_list, i, &mime_type)) @@ -198,11 +181,11 @@ bool GetPuginMimeTypes(const FilePath& pmf, } bool ReadPluginMimeTypes(const FilePath& pmf, - const base::DictionaryValue* dict, + const base::Value::Dict* dict, ContentPluginInfo* info) { // Get the MIME types. - const base::ListValue* mimes_list = nullptr; - if (!GetListValue(dict, kPepperManifestMimesKey, &mimes_list)) { + const base::Value::List* mimes_list = GetListValue(dict, kPepperManifestMimesKey); + if (!mimes_list) { PARSING_ERROR(pmf) << "Can't read the MIME types list"; return false; } @@ -223,15 +206,15 @@ bool ReadPluginMimeTypes(const FilePath& pmf, } bool ReadPluginPath(const FilePath& pmf, - const base::DictionaryValue* dict, + const base::Value::Dict* dict, ContentPluginInfo* info) { // Path to the plugin. The url attribute has higher priority // than the manifest name. - const base::DictionaryValue* program_dict; - if (!GetDictionaryValue(dict, kPepperManifestProgramKey, &program_dict)) { - auto key = dict->FindKey(kPepperManifestProgramKey); - bool has_key = (key != nullptr ? true:false); - + const base::Value::Dict* program_dict = GetDictionaryValue(dict, kPepperManifestProgramKey); + if (!program_dict) { + auto key = dict->Find(kPepperManifestProgramKey); + bool has_key = (key != nullptr ? true:false); + if (has_key) { PARSING_ERROR(pmf) << "invalid \"program\" key present:" << " not a dictionary"; @@ -261,7 +244,7 @@ bool ReadPluginPath(const FilePath& pmf, } bool ValidatePluginType(const FilePath& pmf, - const base::DictionaryValue* dict) { + const base::Value::Dict* dict) { std::string val; if (!GetStringValue(dict, kPepperManifestTypeKey, &val)) { PARSING_ERROR(pmf) << "No type attribute in the PMF file"; @@ -437,45 +420,46 @@ void TrustedPepperPluginInfoCache::MaybeUpdateRw() { return; } - base::Value* dict = root->FindDictKey("forceupdate_webapi"); + base::Value::Dict* dict = root->GetDict().FindDict("forceupdate_webapi"); if (!dict) { LOG(ERROR) << "readJsonFile, no obj under key forceupdate_webapi"; return; } - base::Value* list = dict->FindListKey("pepper"); + base::Value::List* list = dict->FindList("pepper"); if (!list) { LOG(ERROR) << "readJsonFile, no list under key pepper"; return; } - for (base::Value& plugin : list->GetList()) { - if (!plugin.is_dict()) + for (auto& plugin : *list) { + auto* plugin_dict = plugin.GetIfDict(); + if (!plugin_dict) continue; - std::string* dir = plugin.FindStringKey("path"); - std::string* dir_sys = plugin.FindStringKey("systempath"); - if (dir_sys && plugin.FindBoolKey("system").value_or(false)) + std::string* dir = plugin_dict->FindString("path"); + std::string* dir_sys = plugin_dict->FindString("systempath"); + if (dir_sys && plugin_dict->FindBool("system").value_or(false)) AddPluginsFromDirectory(*dir_sys, kSRO); if (!dir || (dir_sys && (dir->compare(*dir_sys) == 0))) // no rw installed. rw path IS sro path continue; - bool force = plugin.FindBoolKey("forceupdate").value_or(false); + bool force = plugin_dict->FindBool("forceupdate").value_or(false); if (AddPluginsFromDirectory(*dir, kRW) && force) judge_map_.insert({*dir, true}); } - dict = root->FindDictPath("upgradable_webapi_applist.pepper"); + dict = root->GetDict().FindDict("upgradable_webapi_applist.pepper"); if (!dict) { LOG(ERROR) << "readJsonFile, no obj under key upgradable_webapi_applist.pepper"; return; } - for (auto kv : dict->DictItems()) { + for (auto kv : *dict) { base::Value& tpk_list = kv.second; if (!tpk_list.is_list()) continue; - for (base::Value& tpk : tpk_list.GetList()) { + for (auto& tpk : tpk_list.GetList()) { if (!tpk.is_dict()) continue; - std::string* dir = tpk.FindStringKey("path"); + std::string* dir = tpk.GetDict().FindString("path"); if (!dir) continue; if (!judge_map_.count(*dir)) { @@ -540,11 +524,12 @@ bool ParsePepperPluginManifest(const FilePath& pmf, return false; } - base::DictionaryValue* dict = 0; - if (!root.value().GetAsDictionary(&dict) || !dict) { + if (!root.value().is_dict()) { PARSING_ERROR(pmf) << "Can't to get the root node as an object."; return false; } + const base::Value::Dict* dict = root.value().GetIfDict(); + if (!ValidatePluginType(pmf, dict)) return false; diff --git a/tizen_src/ewk/efl_integration/ewk_extension_system_delegate.cc b/tizen_src/ewk/efl_integration/ewk_extension_system_delegate.cc index f5fae93..5fd389d 100644 --- a/tizen_src/ewk/efl_integration/ewk_extension_system_delegate.cc +++ b/tizen_src/ewk/efl_integration/ewk_extension_system_delegate.cc @@ -172,9 +172,9 @@ std::unique_ptr EwkExtensionSystemDelegate::GetExtensionInfo() base::AutoLock guard{access_lock_}; if (!info_) return std::make_unique(); - return static_cast(info_) - ->GetValue() - ->CreateDeepCopy(); + base::Value* value = static_cast(info_) + ->GetValue(); + return std::make_unique(value->Clone()); } int EwkExtensionSystemDelegate::GetWindowId() const { @@ -189,14 +189,14 @@ std::unique_ptr EwkExtensionSystemDelegate::GenericSyncCall( return std::make_unique(); Ewk_Value arg = static_cast( - new EwkValuePrivate(data.CreateDeepCopy())); + new EwkValuePrivate(std::make_unique(data.Clone()))); ewk_value_ref(arg); Ewk_Value result = cb_(name.c_str(), arg, cb_data_); ewk_value_unref(arg); if (!result) return std::make_unique(); - std::unique_ptr ret = - static_cast(result)->GetValue()->CreateDeepCopy(); + base::Value* value = static_cast(result)->GetValue(); + std::unique_ptr ret = std::make_unique(value->Clone()); ewk_value_unref(result); return ret; } diff --git a/tizen_src/ewk/efl_integration/public/ewk_value.cc b/tizen_src/ewk/efl_integration/public/ewk_value.cc index fb025b2..f53853c 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_value.cc +++ b/tizen_src/ewk/efl_integration/public/ewk_value.cc @@ -125,7 +125,7 @@ Eina_Stringshare* ewk_value_string_value_get(Ewk_Value value) { Ewk_Value ewk_value_array_new() { Ewk_Value val = static_cast( - new EwkValuePrivate(std::unique_ptr(new base::ListValue()))); + new EwkValuePrivate(std::unique_ptr(new base::Value(base::Value::Type::LIST)))); return ewk_value_ref(val); } @@ -142,12 +142,12 @@ Eina_Bool ewk_value_array_is_mutable(Ewk_Value array) { Eina_Bool ewk_value_array_append(Ewk_Value array, Ewk_Value value) { EINA_SAFETY_ON_FALSE_RETURN_VAL(ewk_value_array_is_mutable(array), EINA_FALSE); - base::ListValue* list; + base::Value::List* list; bool result = EwkValueCast(array)->GetValue()->is_list(); if (result) { // TODO(m.majczak) consider a workaround for the deep copy - base::ListValue* list = static_cast(EwkValueCast(array)->GetValue()); - list->Append(std::move(*(EwkValueCast(value)->GetValue()->CreateDeepCopy()))); + base::Value::List* list = EwkValueCast(array)->GetValue()->GetIfList(); + list->Append(std::move(*(std::make_unique(EwkValueCast(value)->GetValue()->Clone()))));; return EINA_TRUE; } else { return EINA_FALSE; @@ -156,11 +156,11 @@ Eina_Bool ewk_value_array_append(Ewk_Value array, Ewk_Value value) { size_t ewk_value_array_count(Ewk_Value array) { EWK_VALUE_TYPE_CHECK_RETURN_VAL(array, ewk_value_array_type_get(), 0); - base::ListValue* list; + base::Value::List* list; bool result = EwkValueCast(array)->GetValue()->is_list(); if (result) { - list = static_cast(EwkValueCast(array)->GetValue()); - return list->GetList().size(); + list = static_cast(EwkValueCast(array)->GetValue()->GetIfList()); + return list->size(); } else { return 0; } @@ -172,17 +172,17 @@ Eina_Bool ewk_value_array_get(Ewk_Value array, EINA_SAFETY_ON_FALSE_RETURN_VAL(position < ewk_value_array_count(array), EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(dst, EINA_FALSE); - base::ListValue* list; + base::Value::List* list; bool result = EwkValueCast(array)->GetValue()->is_list(); if (result) { // TODO(m.majczak) consider a workaround for the deep copy - list = static_cast(EwkValueCast(array)->GetValue()); + list = EwkValueCast(array)->GetValue()->GetIfList(); base::Value* val = nullptr; - val = &(list->GetList().operator[](position)); + val = &(list->operator[](position)); if (!val) return EINA_FALSE; Ewk_Value ret = static_cast( - new EwkValuePrivate(std::unique_ptr(val->CreateDeepCopy()))); + new EwkValuePrivate(std::unique_ptr(std::make_unique(val->Clone())))); // warning!!! the ownership is passed to the caller here ewk_value_ref(ret); *dst = ret; @@ -213,12 +213,12 @@ Eina_Bool ewk_value_array_remove(Ewk_Value array, size_t position) { Ewk_Value ewk_value_dictionary_new() { Ewk_Value val = static_cast(new EwkValuePrivate( - std::unique_ptr(new base::DictionaryValue()))); + std::unique_ptr(new base::Value(base::Value::Type::DICT)))); return ewk_value_ref(val); } Ewk_Value_Type ewk_value_dictionary_type_get() { - return static_cast(base::Value::Type::DICTIONARY); + return static_cast(base::Value::Type::DICT); } Eina_Bool ewk_value_dictionary_is_mutable(Ewk_Value dictionary) { @@ -232,12 +232,11 @@ Eina_Bool ewk_value_dictionary_keys(Ewk_Value dictionary, Ewk_Value* keys) { EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(keys, EINA_FALSE); // warning!!! This is very expensive operation. - base::DictionaryValue* dict; - bool result = EwkValueCast(dictionary)->GetValue()->GetAsDictionary(&dict); - if (result) { + base::Value::Dict* dict = EwkValueCast(dictionary)->GetValue()->GetIfDict(); + if (dict) { *keys = ewk_value_array_new(); - base::detail::dict_iterator it = dict->DictItems().begin(); - while (it!=dict->DictItems().end()) { + base::detail::dict_iterator it = dict->begin(); + while (it!=dict->end()) { Ewk_Value str = ewk_value_string_new(it->first.c_str()); ewk_value_array_append(*keys, str); ewk_value_unref(str); @@ -256,18 +255,18 @@ Eina_Bool ewk_value_dictionary_set(Ewk_Value dictionary, EINA_SAFETY_ON_FALSE_RETURN_VAL(ewk_value_dictionary_is_mutable(dictionary), EINA_FALSE); EWK_VALUE_TYPE_CHECK_RETURN_VAL(key, ewk_value_string_type_get(), EINA_FALSE); - base::DictionaryValue* dict; + base::Value::Dict* dict; std::string k; bool result1 = EwkValueCast(dictionary)->GetValue()->is_dict(); bool result2 = EwkValueCast(key)->GetValue()->is_string(); if (result1 && result2) { - dict = static_cast(EwkValueCast(dictionary)->GetValue()); - k = *(EwkValueCast(key)->GetValue()->GetIfString()); + dict = EwkValueCast(dictionary)->GetValue()->GetIfDict(); + k = *(EwkValueCast(key)->GetValue()->GetIfString()); // TODO(m.majczak) consider a workaround for the deep copy - auto val = dict->FindKey(k); - auto haskey = (val != nullptr)?true:false; + auto val = dict->Find(k); + auto haskey = (val != nullptr)?true:false; *new_entry = Eina_FromBool(!haskey); - dict->Set(k, EwkValueCast(value)->GetValue()->CreateDeepCopy()); + dict->Set(k, EwkValueCast(value)->GetValue()->Clone()); return EINA_TRUE; } else { return EINA_FALSE; @@ -281,18 +280,17 @@ Eina_Bool ewk_value_dictionary_add(Ewk_Value dictionary, EINA_SAFETY_ON_FALSE_RETURN_VAL(ewk_value_dictionary_is_mutable(dictionary), EINA_FALSE); EWK_VALUE_TYPE_CHECK_RETURN_VAL(key, ewk_value_string_type_get(), EINA_FALSE); - base::DictionaryValue* dict; + base::Value::Dict* dict = EwkValueCast(dictionary)->GetValue()->GetIfDict(); std::string k; - bool result1 = EwkValueCast(dictionary)->GetValue()->GetAsDictionary(&dict); bool result2 = EwkValueCast(key)->GetValue()->is_string(); - if (result1 && result2) { - k = *(EwkValueCast(key)->GetValue()->GetIfString()); - auto val = dict->FindKey(k); - auto haskey = (val != nullptr)?true:false; + if (dict && result2) { + k = *(EwkValueCast(key)->GetValue()->GetIfString()); + auto val = dict->Find(k); + auto haskey = (val != nullptr)?true:false; if (!haskey) { *new_entry = EINA_TRUE; // TODO(m.majczak) consider a workaround for the deep copy - dict->Set(k, EwkValueCast(value)->GetValue()->CreateDeepCopy()); + dict->Set(k, EwkValueCast(value)->GetValue()->Clone()); return EINA_TRUE; } *new_entry = EINA_FALSE; @@ -309,19 +307,17 @@ Eina_Bool ewk_value_dictionary_get(Ewk_Value dictionary, EINA_FALSE); EWK_VALUE_TYPE_CHECK_RETURN_VAL(key, ewk_value_string_type_get(), EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(dst, EINA_FALSE); - base::DictionaryValue* dict; + base::Value::Dict* dict = EwkValueCast(dictionary)->GetValue()->GetIfDict(); std::string k; - bool result1 = EwkValueCast(dictionary)->GetValue()->GetAsDictionary(&dict); bool result2 = EwkValueCast(key)->GetValue()->is_string(); - if (result1 && result2) { - k = *(EwkValueCast(key)->GetValue()->GetIfString()); - base::Value* val = nullptr; - dict->Get(k, &val); + if (dict && result2) { + k = *(EwkValueCast(key)->GetValue()->GetIfString()); + base::Value* val = dict->FindByDottedPath(k); if (!val) return EINA_FALSE; // TODO(m.majczak) consider a workaround for the deep copy Ewk_Value ret = static_cast( - new EwkValuePrivate(std::unique_ptr(val->CreateDeepCopy()))); + new EwkValuePrivate(std::unique_ptr(std::make_unique(val->Clone())))); // warning!!! the ownership is passed to the caller here ewk_value_ref(ret); *dst = ret; @@ -335,14 +331,13 @@ Eina_Bool ewk_value_dictionary_remove(Ewk_Value dictionary, Ewk_Value key) { EINA_SAFETY_ON_FALSE_RETURN_VAL(ewk_value_dictionary_is_mutable(dictionary), EINA_FALSE); EWK_VALUE_TYPE_CHECK_RETURN_VAL(key, ewk_value_string_type_get(), EINA_FALSE); - base::DictionaryValue* dict; + base::Value::Dict* dict = EwkValueCast(dictionary)->GetValue()->GetIfDict(); std::string k; - bool result1 = EwkValueCast(dictionary)->GetValue()->GetAsDictionary(&dict); bool result2 = EwkValueCast(key)->GetValue()->is_string(); - if (result1 && result2) { - k = *(EwkValueCast(key)->GetValue()->GetIfString()); + if (dict && result2) { + k = *(EwkValueCast(key)->GetValue()->GetIfString()); // warning!!! value is completely deleted here - return Eina_FromBool(dict->RemoveKey(k)); + return Eina_FromBool(dict->Remove(k)); } else { return EINA_FALSE; } -- 2.7.4 From e27d7df7ea997d304b29a0512768088cc426b016 Mon Sep 17 00:00:00 2001 From: "zhishun.zhou" Date: Wed, 27 Mar 2024 18:04:40 +0800 Subject: [PATCH 14/16] [M120 Migration][SVACE] Check stream before using Several issues reported crash as null check missing Add stream check before using Patch from: https://review.tizen.org/gerrit/#/c/301574/ Change-Id: I83328ff8bc530b15cd43aaa41ac477c553132bec Signed-off-by: yanqing.lu --- media/filters/decrypting_demuxer_stream.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/media/filters/decrypting_demuxer_stream.cc b/media/filters/decrypting_demuxer_stream.cc index 493b17e..14ab249 100644 --- a/media/filters/decrypting_demuxer_stream.cc +++ b/media/filters/decrypting_demuxer_stream.cc @@ -423,6 +423,11 @@ void DecryptingDemuxerStream::DoReset() { } Decryptor::StreamType DecryptingDemuxerStream::GetDecryptorStreamType() const { + if (!demuxer_stream_) { + LOG(INFO) << "demuxer_stream is nullptr!"; + return Decryptor::kStreamTypeMax; + } + if (demuxer_stream_->type() == AUDIO) return Decryptor::kAudio; -- 2.7.4 From 3e3b4ac7d6495642438c11a719f71f5951251cd4 Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Wed, 27 Mar 2024 11:00:32 +0900 Subject: [PATCH 15/16] [WRTjs][VD] Refactors to reduce IS_TIZEN_TV flag Seperates WRTBrowserContextTV class to reduce IS_TIZEN_TV flag Change-Id: I5a45a309541bebe7f6ce84e3d04066c3dc844ea6 Signed-off-by: DongHyun Song --- wrt/filenames.gni | 2 ++ wrt/src/browser/tv/wrt_browser_context_tv.cc | 20 +++++++++++++++++ wrt/src/browser/tv/wrt_browser_context_tv.h | 32 ++++++++++++++++++++++++++++ wrt/src/browser/wrt_browser_context.cc | 25 ++++++++++------------ wrt/src/browser/wrt_browser_context.h | 12 ++--------- 5 files changed, 67 insertions(+), 24 deletions(-) create mode 100644 wrt/src/browser/tv/wrt_browser_context_tv.cc create mode 100644 wrt/src/browser/tv/wrt_browser_context_tv.h diff --git a/wrt/filenames.gni b/wrt/filenames.gni index a08c7bb..4fbf198 100644 --- a/wrt/filenames.gni +++ b/wrt/filenames.gni @@ -210,6 +210,8 @@ wrt_lib_sources_tv = [ "src/browser/tv/widget_state.h", "src/browser/tv/wrt_browser_client_tv.cc", "src/browser/tv/wrt_browser_client_tv.h", + "src/browser/tv/wrt_browser_context_tv.cc", + "src/browser/tv/wrt_browser_context_tv.h", "src/browser/tv/wrt_native_window_tv.cc", "src/browser/tv/wrt_native_window_tv.h", "src/browser/tv/wrt_xwalk_extension_browser_tv.cc", diff --git a/wrt/src/browser/tv/wrt_browser_context_tv.cc b/wrt/src/browser/tv/wrt_browser_context_tv.cc new file mode 100644 index 0000000..52804a5 --- /dev/null +++ b/wrt/src/browser/tv/wrt_browser_context_tv.cc @@ -0,0 +1,20 @@ +// Copyright 2024 Samsung Electronics. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "wrt/src/browser/tv/wrt_browser_context_tv.h" + +namespace wrt { + +WRTBrowserContextTV::WRTBrowserContextTV( + const electron::PartitionOrPath partition_location, + bool in_memory, + base::Value::Dict options) + : WRTBrowserContext(partition_location, in_memory, std::move(options)), + web_cache_manager_(this) {} + +void WRTBrowserContextTV::ClearWebCache() { + web_cache_manager_.ClearCache(); +} + +} // namespace wrt diff --git a/wrt/src/browser/tv/wrt_browser_context_tv.h b/wrt/src/browser/tv/wrt_browser_context_tv.h new file mode 100644 index 0000000..f3015fe --- /dev/null +++ b/wrt/src/browser/tv/wrt_browser_context_tv.h @@ -0,0 +1,32 @@ +// Copyright 2024 Samsung Electronics. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BROWSER_WRT_BROWSER_CONTEXT_TV_H_ +#define BROWSER_WRT_BROWSER_CONTEXT_TV_H_ + +#include "wrt/src/browser/wrt_browser_context.h" + +#include "tizen_src/ewk/efl_integration/browser/web_cache_efl/web_cache_manager_efl.h" + +namespace wrt { + +class WRTBrowserContextTV : public WRTBrowserContext { + public: + WRTBrowserContextTV(const electron::PartitionOrPath partition_location, + bool in_memory, + base::Value::Dict options); + virtual ~WRTBrowserContextTV() override = default; + + WRTBrowserContextTV(const WRTBrowserContextTV&) = delete; + WRTBrowserContextTV& operator=(const WRTBrowserContextTV&) = delete; + + private: + void ClearWebCache() override; + + WebCacheManagerEfl web_cache_manager_; +}; + +} // namespace wrt + +#endif // BROWSER_WRT_BROWSER_CONTEXT_TV_H_ diff --git a/wrt/src/browser/wrt_browser_context.cc b/wrt/src/browser/wrt_browser_context.cc index 5f894fa..fc2955b 100755 --- a/wrt/src/browser/wrt_browser_context.cc +++ b/wrt/src/browser/wrt_browser_context.cc @@ -14,6 +14,14 @@ #include "wrt/src/browser/wrt_special_storage_policy.h" #include "wrt/src/common/application_data.h" +#if BUILDFLAG(IS_TIZEN_TV) +#include "wrt/src/browser/tv/wrt_browser_context_tv.h" + +using WRTBrowserContextType = wrt::WRTBrowserContextTV; +#else +using WRTBrowserContextType = wrt::WRTBrowserContext; +#endif + namespace { std::vector> @@ -36,12 +44,7 @@ WRTBrowserContext::WRTBrowserContext( bool in_memory, base::Value::Dict options) : electron::ElectronBrowserContext( - partition_location, in_memory, std::move(options)) -#if BUILDFLAG(IS_TIZEN_TV) - , - web_cache_manager_(this) -#endif -{ + partition_location, in_memory, std::move(options)) { SetUserAgent(EflWebView::VersionInfo::GetInstance()->DefaultUserAgent()); InitVisitedLinkWriter(); @@ -116,12 +119,6 @@ void WRTBrowserContext::DeleteCookies() { base::BindOnce([](uint32_t num_deleted) {})); } -#if BUILDFLAG(IS_TIZEN_TV) -void WRTBrowserContext::ClearWebCache() { - web_cache_manager_.ClearCache(); -} -#endif - } // namespace wrt namespace electron { @@ -136,7 +133,7 @@ ElectronBrowserContext* ElectronBrowserContext::From( if (browser_context) return browser_context; - auto* new_context = new wrt::WRTBrowserContext( + auto* new_context = new WRTBrowserContextType( std::cref(partition), in_memory, std::move(options)); browser_context_map()[key] = std::unique_ptr(new_context); @@ -154,7 +151,7 @@ ElectronBrowserContext* ElectronBrowserContext::FromPath( } auto* new_context = - new wrt::WRTBrowserContext(std::cref(path), false, std::move(options)); + new WRTBrowserContextType(std::cref(path), false, std::move(options)); browser_context_map()[key] = std::unique_ptr(new_context); return new_context; diff --git a/wrt/src/browser/wrt_browser_context.h b/wrt/src/browser/wrt_browser_context.h index 62ff83d..83be4b7 100755 --- a/wrt/src/browser/wrt_browser_context.h +++ b/wrt/src/browser/wrt_browser_context.h @@ -11,10 +11,6 @@ #include "electron/shell/browser/electron_browser_context.h" #include "extensions/buildflags/buildflags.h" -#if BUILDFLAG(IS_TIZEN_TV) -#include "tizen_src/ewk/efl_integration/browser/web_cache_efl/web_cache_manager_efl.h" -#endif - namespace visitedlink { class VisitedLinkWriter; } @@ -43,9 +39,8 @@ class WRTBrowserContext : public electron::ElectronBrowserContext, WRTSpecialStoragePolicy* GetWRTSpecialStoragePolicy(); -#if BUILDFLAG(IS_TIZEN_TV) - void ClearWebCache(); -#endif + // product specific features + virtual void ClearWebCache() {} private: // visitedlink::VisitedLinkDelegate implementation. @@ -59,9 +54,6 @@ class WRTBrowserContext : public electron::ElectronBrowserContext, scoped_refptr wrt_special_storage_policy_; std::unique_ptr background_sync_controller_; -#if BUILDFLAG(IS_TIZEN_TV) - WebCacheManagerEfl web_cache_manager_; -#endif }; } // namespace wrt -- 2.7.4 From 68436ad99ea19d5477112f9872c79e2a477b09b3 Mon Sep 17 00:00:00 2001 From: fang fengrong Date: Tue, 19 Mar 2024 16:50:47 +0800 Subject: [PATCH 16/16] [M120 Migration]URL of _Ewk_Error set wrong The url should be set as the third parameter of _Ewk_Error constructor. refer: https://review.tizen.org/gerrit/#/c/297326 Change-Id: Ic0ebe2a005083749afc4e28defd6d51e2cc7e59d Signed-off-by: fang fengrong --- .../ewk/efl_integration/browser/navigation_throttle_efl.cc | 2 +- tizen_src/ewk/efl_integration/eweb_view.cc | 12 +++++------- tizen_src/ewk/efl_integration/eweb_view.h | 7 +++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/tizen_src/ewk/efl_integration/browser/navigation_throttle_efl.cc b/tizen_src/ewk/efl_integration/browser/navigation_throttle_efl.cc index c571c81..a6da944 100644 --- a/tizen_src/ewk/efl_integration/browser/navigation_throttle_efl.cc +++ b/tizen_src/ewk/efl_integration/browser/navigation_throttle_efl.cc @@ -72,7 +72,7 @@ NavigationThrottleEfl::WillFailRequest() { // from app side. if (web_view->IsLoadErrorPageCallbackSet()) { const char* error_page = web_view->InvokeViewLoadErrorPageCallback( - handle->GetURL(), error_code, "ERR_ABORTED"); + handle->GetURL(), error_code, error_code == net::ERR_ABORTED); if (error_page) { LOG(ERROR) << "Already get customer error page"; // Currently return result with action NavigationThrottle::CANCEL, error diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index ef84a2c..ec314f1 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -1331,13 +1331,11 @@ void EWebView::SetViewLoadErrorPageCallback( } // Remove below code while ewk_error_cancellation_get has been implemented. -const char* EWebView::InvokeViewLoadErrorPageCallback( - const GURL& url, - int error_code, - const std::string& error_description) { - std::unique_ptr<_Ewk_Error> err( - new _Ewk_Error(error_code, url.possibly_invalid_spec().c_str(), - error_description.c_str())); +const char* EWebView::InvokeViewLoadErrorPageCallback(const GURL& url, + int error_code, + bool is_cancellation) { + std::unique_ptr<_Ewk_Error> err(new _Ewk_Error( + error_code, is_cancellation, url.possibly_invalid_spec().c_str())); _Ewk_Error_Page error_page; LOG(INFO) << "EWebView::InvokeLoadErrorPageCallback url: " diff --git a/tizen_src/ewk/efl_integration/eweb_view.h b/tizen_src/ewk/efl_integration/eweb_view.h index 040fc89..08fc8e7 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.h +++ b/tizen_src/ewk/efl_integration/eweb_view.h @@ -575,10 +575,9 @@ class EWebView { void SetViewLoadErrorPageCallback(Ewk_View_Error_Page_Load_Callback callback, void* user_data); - const char* InvokeViewLoadErrorPageCallback( - const GURL& url, - int error_code, - const std::string& error_description); + const char* InvokeViewLoadErrorPageCallback(const GURL& url, + int error_code, + bool is_cancellation); bool IsLoadErrorPageCallbackSet() const; void SetViewUnfocusAllowCallback(Ewk_View_Unfocus_Allow_Callback callback, void* user_data); -- 2.7.4