From: ayush.k123 Date: Wed, 8 Feb 2023 09:51:41 +0000 (+0530) Subject: [M108 Migration][API] Add ewk_context_max_refresh_rate_set X-Git-Tag: submit/tizen/20230227.160252~84 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F07%2F288007%2F4;p=platform%2Fframework%2Fweb%2Fchromium-efl.git [M108 Migration][API] Add ewk_context_max_refresh_rate_set To reduce current consumption, some devices need to set screen FPS limitation. This api is added to set screen FPS limitation. If max refresh rate is set as 30, each thread will work as below. 1) With |setInterval(16ms)|. - Renderer main thread : 60fps - Renderer raster thread : 30fps - Renderer compositor thread : 30fps - UI main thread : 30fps 2) With |setInterval(20ms)| - Renderer main thread : 50fps - Renderer raster thread : 30fps - Renderer compositor thread : 30fps - UI main thread : 30fps 3) With |requestAnimationFrame| - Renderer main thread : 30fps - Renderer raster thread : 30fps - Renderer compositor thread : 30fps - UI main thread : 30fps References: https://review.tizen.org/gerrit/270945 Change-Id: I05d8e28afe2b12ccf1d281c7634bab380a0e5b40 Signed-off-by: Ayush Kumar --- diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 2ce1e68..17895cb 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -2872,6 +2872,16 @@ const blink::web_pref::WebPreferences WebContentsImpl::ComputeWebPreferences() { prefs.user_gesture_required_for_presentation = !command_line.HasSwitch( switches::kDisableGestureRequirementForPresentation); +#if BUILDFLAG(IS_TIZEN) + if (command_line.HasSwitch(switches::kMaxRefreshRate)) { + int refresh_rate = 0; + base::StringToInt( + command_line.GetSwitchValueASCII(switches::kMaxRefreshRate), + &refresh_rate); + prefs.max_refresh_rate = refresh_rate; + } +#endif + if (is_overlay_content_) prefs.hide_download_ui = true; diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index 310961b..cde3d1c 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc @@ -1068,6 +1068,10 @@ const char kGpu2StartupDialog[] = "gpu2-startup-dialog"; const char kAudioProcessHighPriority[] = "audio-process-high-priority"; #endif +#if BUILDFLAG(IS_TIZEN) +const char kMaxRefreshRate[] = "max-refresh-rate"; +#endif + #if defined(ENABLE_IPC_FUZZER) // Dumps IPC messages sent from renderer processes to the browser process to // the given directory. Used primarily to gather samples for IPC fuzzing. diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index e3e3ddf..e04843e 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h @@ -297,6 +297,10 @@ CONTENT_EXPORT extern const char kGpu2StartupDialog[]; CONTENT_EXPORT extern const char kAudioProcessHighPriority[]; #endif +#if BUILDFLAG(IS_TIZEN) +CONTENT_EXPORT extern const char kMaxRefreshRate[]; +#endif + #if defined(ENABLE_IPC_FUZZER) extern const char kIpcDumpDirectory[]; extern const char kIpcFuzzerTestcase[]; diff --git a/content/renderer/agent_scheduling_group.cc b/content/renderer/agent_scheduling_group.cc index dcdbc2e..3524610 100644 --- a/content/renderer/agent_scheduling_group.cc +++ b/content/renderer/agent_scheduling_group.cc @@ -31,6 +31,10 @@ #include "third_party/blink/public/web/web_view.h" #include "third_party/blink/public/web/web_view_client.h" +#if BUILDFLAG(IS_TIZEN) +#include "third_party/blink/public/web/web_frame_widget.h" +#endif + namespace content { using ::IPC::ChannelMojo; @@ -329,6 +333,15 @@ blink::WebView* AgentSchedulingGroup::CreateWebView( GetContentClient()->renderer()->WebViewCreated( web_view, was_created_by_renderer, params->outermost_origin ? ¶ms->outermost_origin.value() : nullptr); + +#if BUILDFLAG(IS_TIZEN) + if (web_view->MainFrame() && web_view->MainFrame()->IsWebLocalFrame()) { + auto* frame_widget = + web_view->MainFrame()->ToWebLocalFrame()->LocalRoot()->FrameWidget(); + frame_widget->SetMaxRefreshRate(params->web_preferences.max_refresh_rate); + } +#endif + return web_view; } diff --git a/third_party/blink/common/web_preferences/web_preferences.cc b/third_party/blink/common/web_preferences/web_preferences.cc index 2257cb2..67b358e 100644 --- a/third_party/blink/common/web_preferences/web_preferences.cc +++ b/third_party/blink/common/web_preferences/web_preferences.cc @@ -205,6 +205,9 @@ WebPreferences::WebPreferences() #endif low_priority_iframes_threshold( EffectiveConnectionType::kEffectiveConnectionUnknownType), +#if BUILDFLAG(IS_TIZEN) + max_refresh_rate(-1), +#endif picture_in_picture_enabled(true), translate_service_available(false), network_quality_estimator_web_holdback( diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc index f8792c5..99b78f7 100644 --- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc +++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc @@ -159,6 +159,9 @@ bool StructTraitsdouble_tap_to_zoom_enabled = data.double_tap_to_zoom_enabled(); out->fullscreen_supported = data.fullscreen_supported(); out->text_autosizing_enabled = data.text_autosizing_enabled(); +#if BUILDFLAG(IS_TIZEN) + out->max_refresh_rate = data.max_refresh_rate(); +#endif #if BUILDFLAG(IS_ANDROID) out->font_scale_factor = data.font_scale_factor(); out->device_scale_adjustment = data.device_scale_adjustment(); diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h index c141ba7..21c156f 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences.h +++ b/third_party/blink/public/common/web_preferences/web_preferences.h @@ -296,6 +296,10 @@ struct BLINK_COMMON_EXPORT WebPreferences { // TODO(changwan): remove this once we no longer support Android N. bool do_not_update_selection_on_mutating_selection_range; +#if BUILDFLAG(IS_TIZEN) + int max_refresh_rate; +#endif + // Defines the current autoplay policy. blink::mojom::AutoplayPolicy autoplay_policy = blink::mojom::AutoplayPolicy::kNoUserGestureRequired; diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h index dafe321..3f2fbaf 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h +++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h @@ -528,6 +528,12 @@ struct BLINK_COMMON_EXPORT StructTraits