From e201798463e3d7731442e3f0871f6cc2b55c825c Mon Sep 17 00:00:00 2001 From: wuxiaoliang Date: Mon, 18 Mar 2024 16:24:57 +0800 Subject: [PATCH 01/16] [M120 Migration] Support HDR10+ property upstream remove side_data_size and add struct DecoderBufferSideData in this patch: https://chromium-review.googlesource.com/c/chromium/src/+/4757645 Migrated from: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/290546/ Change-Id: I0abc0b4fdd7d708582eb9215710ceb51ea194a2d Signed-off-by: wuxiaoliang --- .../media/filters/media_player_esplusplayer_tv.cc | 136 ++++++++++++++++++++- .../media/filters/media_player_esplusplayer_tv.h | 11 ++ 2 files changed, 145 insertions(+), 2 deletions(-) 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 33d2e73..84361c1 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 @@ -111,8 +111,16 @@ int MediaPlayerESPlusPlayerTV::SetVideoStreamInfo( } } - LOG(INFO) << "Framerate: [" << video_stream_info.framerate_num << "] [" - << video_stream_info.framerate_den << "]"; + video_codec_ = video_config.codec(); + if (hdr_info_.compare(video_config.hdr_info()) != 0) { + is_hdr_changed_ = true; + hdr_info_ = video_config.hdr_info(); + } + + LOG_ID(INFO, player_id_) << "Framerate: [" << video_stream_info.framerate_num + << "] [" << video_stream_info.framerate_den << "]" + << " ,is_hdr_changed_ : " << is_hdr_changed_ + << " ,hdr info:" << hdr_info_; if (!SetVideoSubmitDataType(video_config)) { LOG(ERROR) << "SetVideoSubmitDataType failed."; @@ -243,6 +251,7 @@ esplusplayer_submit_status MediaPlayerESPlusPlayerTV::SubmitEsPacket( // This filed only set when PushMediaPacket packet.matroska_color_info = nullptr; + FillHDRIntoPacket(type, buffer, &packet); unsigned int tz_handle = buffer->tz_handle() ? buffer->tz_handle() : 0; #if TIZEN_VERSION_AT_LEAST(6, 0, 0) @@ -431,4 +440,127 @@ esplusplayer_drm_info* MediaPlayerESPlusPlayerTV::DrmInfo::GetPlayerDrmInfo( } #endif +void MediaPlayerESPlusPlayerTV::HDRStringToMatroskaColor( + const std::string& hdr_info, + esplusplayer_matroska_color* matroska_color) { + const char* fmt = + "matrixCoefficients:%u bitsPerChannel:%u chromaSubsamplingHorz:%u " + "chromaSubsamplingVert:%u" + " cbSubsamplingHorz:%u cbSubsamplingVert:%u chromaSitingHorz:%u " + "chromaSitingVert:%u" + " range:%u transferCharacteristics:%u primaries:%u maxCLL:%u maxFALL:%u" + " RX:%lf RY:%lf GX:%lf GY:%lf BX:%lf BY:%lf wX:%lf wY:%lf" + " luminanceMax:%lf luminanceMin:%lf"; + + memset(matroska_color, 0, sizeof(esplusplayer_matroska_color)); + if (sscanf(hdr_info.c_str(), fmt, &(matroska_color->matrix_coefficients), + &(matroska_color->bits_per_channel), + &(matroska_color->chroma_subsampling_horizontal), + &(matroska_color->chroma_subsampling_vertical), + &(matroska_color->cb_subsampling_horizontal), + &(matroska_color->cb_subsampling_vertical), + &(matroska_color->chroma_siting_horizontal), + &(matroska_color->chroma_siting_vertical), + &(matroska_color->range), + &(matroska_color->transfer_characteristics), + &(matroska_color->primaries), &(matroska_color->max_cll), + &(matroska_color->max_fall), + &(matroska_color->metadata.primary_r_chromaticity_x), + &(matroska_color->metadata.primary_r_chromaticity_y), + &(matroska_color->metadata.primary_g_chromaticity_x), + &(matroska_color->metadata.primary_g_chromaticity_y), + &(matroska_color->metadata.primary_b_chromaticity_x), + &(matroska_color->metadata.primary_b_chromaticity_y), + &(matroska_color->metadata.white_point_chromaticity_x), + &(matroska_color->metadata.white_point_chromaticity_y), + &(matroska_color->metadata.luminance_max), + &(matroska_color->metadata.luminance_min)) != 23) { + LOG(ERROR) << "HDRStringToMatroskaColor hdr string invalid. " << hdr_info; + return; + } + + LOG_ID(INFO, player_id_) + << "matrixCoefficients:" << matroska_color->matrix_coefficients + << " bitsPerChannel:" << matroska_color->bits_per_channel + << " chromaSubsamplingHorz:" + << matroska_color->chroma_subsampling_horizontal + << " chromaSubsamplingVert:" + << matroska_color->chroma_subsampling_vertical + << " cbSubsamplingHorz:" << matroska_color->cb_subsampling_horizontal + << " cbSubsamplingVert:" << matroska_color->cb_subsampling_vertical + << " chromaSitingHorz:" << matroska_color->chroma_siting_horizontal + << " chromaSitingVert:" << matroska_color->chroma_siting_vertical + << " range:" << matroska_color->range + << " transferCharacteristics:" << matroska_color->transfer_characteristics + << " primaries:" << matroska_color->primaries + << " maxCLL:" << matroska_color->max_cll + << " maxFALL:" << matroska_color->max_fall + << " RX:" << matroska_color->metadata.primary_r_chromaticity_x + << " RY:" << matroska_color->metadata.primary_r_chromaticity_y + << " GX:" << matroska_color->metadata.primary_g_chromaticity_x + << " GY:" << matroska_color->metadata.primary_g_chromaticity_y + << " BX:" << matroska_color->metadata.primary_b_chromaticity_x + << " BY:" << matroska_color->metadata.primary_b_chromaticity_y + << " wX:" << matroska_color->metadata.white_point_chromaticity_x + << " wY:" << matroska_color->metadata.white_point_chromaticity_y + << " luminanceMax:" << matroska_color->metadata.luminance_max + << " luminanceMin:" << matroska_color->metadata.luminance_min; +} + +void MediaPlayerESPlusPlayerTV::FillHDRIntoPacket( + DemuxerStream::Type type, + scoped_refptr buffer, + esplusplayer_es_packet* packet) { + if (type != media::DemuxerStream::VIDEO) + return; + + if (!buffer) { + LOG_ID(ERROR, player_id_) + << "decoder buffer is null, cannot get HDR10 metadata"; + return; + } + + // update HDR info in the first packet + if (is_hdr_changed_) { + HDRStringToMatroskaColor(hdr_info_, &matroska_color_); + packet->matroska_color_info = &matroska_color_; + is_hdr_changed_ = false; + } + + if (!buffer->has_side_data()) { + LOG_ID(ERROR, player_id_) << "decoder buffer has no side data"; + return; + } + + if (buffer->side_data()->alpha_data.empty()) { + LOG_ID(ERROR, player_id_) << "decoder buffer has no alpha data"; + return; + } + + uint8_t* side_data = (uint8_t*)buffer->side_data()->alpha_data.data(); + size_t side_data_size = buffer->side_data()->alpha_data.size(); + + if (side_data_size > 8) { + // follow cobalt's check about hdr10plus inf + std::vector side_data_vec; + size_t side_data_vec_size = 0; + uint64_t blockAddId = 0; + for (int j = 0; j < 8; ++j) { + blockAddId = (blockAddId << 8) | side_data[j]; + } + + if (blockAddId == 0x04) { + side_data_vec_size = side_data_size - 8; + side_data_vec.resize(side_data_vec_size); + memcpy(&side_data_vec[0], side_data + 8, + sizeof(uint8_t) * side_data_vec_size); + } + + packet->hdr10p_metadata_size = side_data_vec_size; + packet->hdr10p_metadata = + reinterpret_cast(const_cast(side_data_vec.data())); + matroska_color_.isHDR10p = true; + } +} + } // namespace media diff --git a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.h b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.h index a063bbf..4a9d6c6 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.h +++ b/tizen_src/chromium_impl/media/filters/media_player_esplusplayer_tv.h @@ -98,6 +98,17 @@ class MEDIA_EXPORT MediaPlayerESPlusPlayerTV : public MediaPlayerESPlusPlayer { bool is_video_drm_eme_{false}; bool single_process_mode_{false}; media::VideoCodec video_codec_{media::VideoCodec::kUnknown}; + + void HDRStringToMatroskaColor(const std::string& hdr_info, + esplusplayer_matroska_color* matroska_color); + void FillHDRIntoPacket(DemuxerStream::Type type, + scoped_refptr buffer, + esplusplayer_es_packet* packet); + + std::string hdr_info_; + bool is_hdr_changed_{false}; + esplusplayer_matroska_color matroska_color_; + base::WeakPtrFactory weak_factory_{this}; }; } // namespace media -- 2.7.4 From 7cd2d323cc9d3bbda857c64f9b3cbb3b279b0823 Mon Sep 17 00:00:00 2001 From: wuxiaoliang Date: Tue, 19 Mar 2024 15:14:29 +0800 Subject: [PATCH 02/16] Fixup! [M120 Migration][MPEG-H][Hbbtv][MSE] Add proper demuxing for MPEG-H codec patch 290424 is merged in tizen.beta, side data get method is changed, and it just comment it for build. now add the right method to fill side data. Change-Id: I55e6036c9d227fdce0aa56cd5873bb6c9e515a8b Signed-off-by: wuxiaoliang --- media/filters/source_buffer_range.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/media/filters/source_buffer_range.cc b/media/filters/source_buffer_range.cc index b5e8f47..d44518e 100644 --- a/media/filters/source_buffer_range.cc +++ b/media/filters/source_buffer_range.cc @@ -230,14 +230,20 @@ void SourceBufferRange::ModifyFirstFrameForMpeghCodec() { // Creating new buffer based on changed data auto new_buffer = StreamParserBuffer::CopyFrom( &(new_data.front()), new_data.size(), -#if !defined(EWK_BRINGUP) // FIXME: m120 bringup (Removed in Open Source) - buffers_[next_buffer_index_]->side_data(), - buffers_[next_buffer_index_]->side_data_size(), -#endif buffers_[next_buffer_index_]->is_key_frame(), buffers_[next_buffer_index_]->type(), buffers_[next_buffer_index_]->track_id()); + // set side_data/alpha_data for new buffer + if (buffers_[next_buffer_index_]->has_side_data()) { + auto side_data = buffers_[next_buffer_index_]->side_data(); + if (!side_data->alpha_data.empty()) { + new_buffer->WritableSideData().alpha_data.assign( + side_data->alpha_data.data(), + side_data->alpha_data.data() + side_data->alpha_data.size()); + } + } + // Setting other necessary data not copied by previous function new_buffer->SetConfigId(buffers_[next_buffer_index_]->GetConfigId()); new_buffer->SetDecodeTimestamp( -- 2.7.4 From 19123f8b08d778428e4e8a45ce72522bc5aeb583 Mon Sep 17 00:00:00 2001 From: "zhishun.zhou" Date: Mon, 25 Mar 2024 20:24:07 +0800 Subject: [PATCH 03/16] [M120 Migration] Add new interface to forward message from mmplayer to hbbtv Support EWK notify interface: DECLARE_EWK_VIEW_CALLBACK(EVENTData, "update,event,data", void*); Patch from: https://review.tizen.org/gerrit/#/c/294840/ Change-Id: I7359fd40029e1788fcca0a1c6aaccf0602744d12 Signed-off-by: yangzhiwen Signed-off-by: zhishun.zhou --- content/public/browser/web_contents_delegate.h | 1 + .../content/browser/media/tizen_renderer_impl.cc | 13 +++++++++++++ .../content/browser/media/tizen_renderer_impl.h | 1 + .../media/filters/media_player_bridge_capi_tv.cc | 4 ++-- tizen_src/chromium_impl/media/filters/media_player_tizen.h | 1 + tizen_src/ewk/efl_integration/eweb_view.cc | 5 +++++ tizen_src/ewk/efl_integration/eweb_view.h | 1 + tizen_src/ewk/efl_integration/eweb_view_callbacks.h | 2 ++ tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc | 4 ++++ tizen_src/ewk/efl_integration/web_contents_delegate_efl.h | 1 + 10 files changed, 31 insertions(+), 2 deletions(-) diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h index c561d38..d2d66ab 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -748,6 +748,7 @@ class CONTENT_EXPORT WebContentsDelegate { uint32_t previous, uint32_t current) {} virtual bool IsHighBitRate() const { return false; } + virtual void UpdateEventData(void* data) {} virtual void NotifyParentalRatingInfo(const std::string& info, const std::string& url) {} virtual void NotifyDownloadableFontInfo(const std::string& scheme_id_uri, 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 835c40b..a09bc9f 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 @@ -414,6 +414,19 @@ void TizenRendererImpl::SetPreferTextLanguage(const std::string& lang) { } media_player_->SetPreferTextLanguage(lang); } + +void TizenRendererImpl::UpdateEventData(std::string data) { + content::WebContentsDelegate* web_contents_delegate = + GetWebContentsDelegate(); + if (!web_contents_delegate) { + LOG_ID(ERROR, player_id_) << "web_contents_delegate is null"; + return; + } + + web_contents_delegate->UpdateEventData( + static_cast(const_cast(data.c_str()))); +} + content::WebContentsDelegate* TizenRendererImpl::GetWebContentsDelegate() const { content::WebContents* web_contents = GetWebContents(); 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 bf9f6ad..8208990 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 @@ -188,6 +188,7 @@ class CONTENT_EXPORT TizenRendererImpl void SetActiveAudioTrack(int index) override; void SetActiveVideoTrack(int index) override; void SetPreferTextLanguage(const std::string& lang) override; + void UpdateEventData(std::string data); #endif content::WebContents* GetWebContents() const; diff --git a/tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc b/tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc index 44e3845..9173530 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc +++ b/tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc @@ -1207,7 +1207,7 @@ void MediaPlayerBridgeCapiTV::OnOtherEvent(int event_type, void* event_data) { LOG_ID(INFO, player_id_) << "not supported scheme id uri,uri:" << uri; return; } -#if !defined(EWK_BRINGUP) + if (!uri.compare("urn:dvb:css")) { LOG_ID(INFO, player_id_) << "event->value:" << eventstream->value << " evalue " << value.c_str(); @@ -1216,7 +1216,7 @@ void MediaPlayerBridgeCapiTV::OnOtherEvent(int event_type, void* event_data) { weak_factory_.GetWeakPtr(), value)); return; } -#endif + const std::string info = uri + " " + value; task_runner_->PostTask( FROM_HERE, 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 10a5f22..d24ffc6 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_tizen.h +++ b/tizen_src/chromium_impl/media/filters/media_player_tizen.h @@ -115,6 +115,7 @@ class MEDIA_EXPORT MediaPlayerTizen { virtual void SetActiveAudioTrack(int index) {} virtual void SetActiveVideoTrack(int index) {} virtual void SetPreferTextLanguage(const std::string& lang) {} + virtual void UpdateEventData(std::string data) {} }; } // namespace media diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index 22539f1..ab7fac0 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -3443,6 +3443,11 @@ void EWebView::UpdateCurrentTime(double current_time) { current_time_ = current_time; } +void EWebView::UpdateEventData(void* data) { + LOG(INFO) << "EWebView::UpdateEventData data:" << (char*)data; + SmartCallback().call(data); +} + void EWebView::NotifyParentalRatingInfo(const char* info, const char* url) { LOG(INFO) << "info:" << info << ",url:" << url; Ewk_Media_Parental_Rating_Info* data = diff --git a/tizen_src/ewk/efl_integration/eweb_view.h b/tizen_src/ewk/efl_integration/eweb_view.h index f6bf763..6d7f069 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.h +++ b/tizen_src/ewk/efl_integration/eweb_view.h @@ -820,6 +820,7 @@ class EWebView { const std::string& data, unsigned int size); void UpdateCurrentTime(double current_time); + void UpdateEventData(void* data); double GetCurrentTime() { return current_time_; } void GetMediaDeviceList(Ewk_Media_Device_List_Get_Callback callback, void* userData); diff --git a/tizen_src/ewk/efl_integration/eweb_view_callbacks.h b/tizen_src/ewk/efl_integration/eweb_view_callbacks.h index 0128cf1..895d47e 100644 --- a/tizen_src/ewk/efl_integration/eweb_view_callbacks.h +++ b/tizen_src/ewk/efl_integration/eweb_view_callbacks.h @@ -138,6 +138,7 @@ enum CallbackType { SubtitleNotifyData, FirstTimestamp, PESData, + EVENTData, #endif OverscrolledLeft, OverscrolledRight, @@ -329,6 +330,7 @@ DECLARE_EWK_VIEW_CALLBACK(SubtitleSeekComplete, DECLARE_EWK_VIEW_CALLBACK(SubtitleNotifyData, "on,subtitle,data", void*); DECLARE_EWK_VIEW_CALLBACK(FirstTimestamp, "on,dvb,subtitle,timestamp", void*); DECLARE_EWK_VIEW_CALLBACK(PESData, "on,dvb,subtitle,data", void*); +DECLARE_EWK_VIEW_CALLBACK(EVENTData, "update,event,data", void*); #endif DECLARE_EWK_VIEW_CALLBACK(OverscrolledLeft, "overscrolled,left", void); DECLARE_EWK_VIEW_CALLBACK(OverscrolledRight, "overscrolled,right", void); diff --git a/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc b/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc index 1357ccc..83ecaec 100644 --- a/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc +++ b/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc @@ -774,6 +774,10 @@ void WebContentsDelegateEfl::UpdateCurrentTime(double current_time) { web_view_->UpdateCurrentTime(current_time); } +void WebContentsDelegateEfl::UpdateEventData(void* data) { + web_view_->UpdateEventData(data); +} + void WebContentsDelegateEfl::NotifySubtitleState(int state, double time_stamp) { web_view_->NotifySubtitleState(state, time_stamp); } diff --git a/tizen_src/ewk/efl_integration/web_contents_delegate_efl.h b/tizen_src/ewk/efl_integration/web_contents_delegate_efl.h index a4955c8..68edad2 100644 --- a/tizen_src/ewk/efl_integration/web_contents_delegate_efl.h +++ b/tizen_src/ewk/efl_integration/web_contents_delegate_efl.h @@ -162,6 +162,7 @@ class WebContentsDelegateEfl : public WebContentsDelegate { unsigned int len, int media_position) override; void UpdateCurrentTime(double current_time) override; + void UpdateEventData(void* data) override; void NotifySubtitleState(int state, double time_stamp) override; void NotifySubtitlePlay(int active_track_id, const std::string& url, -- 2.7.4 From 3582344f24a472c9d4b24665e5feae2a516e684a Mon Sep 17 00:00:00 2001 From: jinbei09 Date: Wed, 28 Feb 2024 17:48:13 +0800 Subject: [PATCH 04/16] [M120 Migration][XWalkExtension] Support IME in xwalk exension Due to the reason that pepper plugin will be converted to xwalk plugin Samsung extended IME PPAPI can't be used. Need to provide IME function in xwalk plugin. Call Sequence: (WRT) sendRuntimeMessage(js) -> WRTXWalkExtensionBrowserTV::HandleRuntimeMessageInternal -> SetIMERecommendedWords/SetIMERecommendedWordsType (HBBTV) sendRuntimeMessage(js) -> XWalkExtensionBrowserEfl::HandleRuntimeMessageInternal -> SetIMERecommendedWords/SetIMERecommendedWordsType Support SetIMERecommendedWords and SetIMERecommendedWordsType Migrated from tizen 8.0: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/296727/ https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/298681/ Change-Id: I3323c4f4b1800b651d941291930ce2ef65820805 Signed-off-by: jinbei09 (cherry picked from commit f567edbefd181c35e2452d9f14b8534b8882c477) --- .../browser/xwalk_extension_browser_efl.cc | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tizen_src/ewk/efl_integration/browser/xwalk_extension_browser_efl.cc b/tizen_src/ewk/efl_integration/browser/xwalk_extension_browser_efl.cc index 08f29dc..fa12f8a 100644 --- a/tizen_src/ewk/efl_integration/browser/xwalk_extension_browser_efl.cc +++ b/tizen_src/ewk/efl_integration/browser/xwalk_extension_browser_efl.cc @@ -6,11 +6,68 @@ #include "base/logging.h" +#if BUILDFLAG(IS_TIZEN_TV) +#include "content/browser/renderer_host/render_widget_host_view_aura.h" +#include "content/browser/renderer_host/rwhv_aura_common_helper_efl.h" +#include "content/browser/web_contents/web_contents_impl.h" +#endif + namespace content { +namespace { + +#if BUILDFLAG(IS_TIZEN_TV) +content::RWHVAuraCommonHelperEfl* GetRWHVAEflHelper() { + auto* web_contents = content::WebContentsImpl::GetAllWebContents().front(); + auto* rwhva = static_cast( + web_contents->GetRenderWidgetHostView()); + if (!rwhva || !rwhva->aura_efl_helper()) { + LOG(ERROR) << "RWHV is not created yet!"; + return nullptr; + } + return rwhva->aura_efl_helper(); +} +#endif + +} // namespace + std::string XWalkExtensionBrowserEfl::HandleRuntimeMessageInternal( const std::string& type, const std::string& value) { LOG(INFO) << "type : " << type; + +#if BUILDFLAG(IS_TIZEN_TV) + if (type == "webapis://appcommon/setIMERecommendedWords") { + if (!GetRWHVAEflHelper()) { + LOG(ERROR) << "RWHV is not created yet!"; + return "error"; + } + std::string auto_words = "autoword="; + static const char AUTOWORD_ITEM_DELIMETER[] = {0x07, 0x06, 0x00}; + std::string temp = value; + std::size_t found = temp.find_first_of(','); + while (found != std::string::npos) { + auto_words.append(temp.substr(0, found)); + auto_words.append(AUTOWORD_ITEM_DELIMETER); + temp = temp.substr(found + 1); + found = temp.find_first_of(','); + } + auto_words.append(temp); + LOG(INFO) << "auto_words=[" << auto_words << "]"; + GetRWHVAEflHelper()->SetIMERecommendedWords(auto_words); + return "success"; + } else if (type == "webapis://appcommon/setIMERecommendedType") { + if (!GetRWHVAEflHelper()) { + LOG(ERROR) << "RWHV is not created yet!"; + return "error"; + } + GetRWHVAEflHelper()->SetIMERecommendedWordsType(value == "1" ? true + : false); + return "success"; + } else { + LOG(ERROR) << "Unknown message type : " << type; + } +#endif + // TODO(dh81.song) // According to xwalk extensions, this might handle internal messages. return std::string(); -- 2.7.4 From f35a64e243ade8fa8be61594b53fff80b172b6b2 Mon Sep 17 00:00:00 2001 From: Manjeet Date: Fri, 8 Mar 2024 14:07:37 +0530 Subject: [PATCH 05/16] fixup! [M120 Migration] Selection & Context menu controller This patch avoids creation of additional menu runner from views/directory, which is not needed for our browser and webapps, since we have our own context menu. Reference: https://review.tizen.org/gerrit/293300/ Change-Id: Ied1282196c73fe6815af9184c3d4fcbffe643e47 Signed-off-by: Manjeet --- ui/views/views_delegate.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/views/views_delegate.cc b/ui/views/views_delegate.cc index e3895dc..b977838 100644 --- a/ui/views/views_delegate.cc +++ b/ui/views/views_delegate.cc @@ -32,7 +32,8 @@ ViewsDelegate::ViewsDelegate() ui::TouchEditingControllerFactory::SetInstance( editing_controller_factory_.get()); -#if BUILDFLAG(ENABLE_DESKTOP_AURA) || BUILDFLAG(IS_CHROMEOS_ASH) +#if (BUILDFLAG(ENABLE_DESKTOP_AURA) || BUILDFLAG(IS_CHROMEOS_ASH)) && \ + !BUILDFLAG(IS_EFL) // TouchSelectionMenuRunnerViews is not supported on Mac or Cast. // It is also not used on Ash (the ChromeViewsDelegate() for Ash will // immediately replace this). But tests running without the Chrome layer -- 2.7.4 From 45ae09dd7db18242bbd677132b766f05f6b0d3e0 Mon Sep 17 00:00:00 2001 From: Sun-woo Nam Date: Thu, 7 Mar 2024 20:44:15 -0800 Subject: [PATCH 06/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 07/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 08/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 09/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 10/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 11/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..d86c2f6f 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 12/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 13/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 14/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 15/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 16/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