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 <ayush.k123@samsung.com>
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;
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.
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[];
#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;
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;
}
#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(
out->double_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();
// 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;
#if BUILDFLAG(IS_EFL)
static bool link_effect_enabled(const blink::web_pref::WebPreferences& r) {
return r.link_effect_enabled;
+}
+#endif
+
+#if BUILDFLAG(IS_TIZEN)
+ static uint32_t max_refresh_rate(const blink::web_pref::WebPreferences& r) {
+ return r.max_refresh_rate;
}
#endif
if (tizen_product_tv) {
enabled_features += [ "is_tizen_tv" ]
}
+ if (is_tizen) {
+ enabled_features += [ "is_tizen" ]
+ }
if (use_efl) {
enabled_features += [ "is_efl" ]
}
[EnableIf=is_efl]
uint64 tizen_version_release;
+ [EnableIf=is_tizen]
+ int32 max_refresh_rate;
+
// Whether download UI should be hidden on this page.
bool hide_download_ui;
// UpdateAllLifecyclePhases() just before dumping pixels.
virtual void PrepareForFinalLifecyclUpdateForTesting() = 0;
+#if BUILDFLAG(IS_TIZEN)
+ virtual void SetMaxRefreshRate(uint32_t max_refresh_rate) {}
+#endif
+
private:
// This is a private virtual method so we don't expose cc::LayerTreeHost
// outside of this class. Friend classes may be added in order to access it.
}
#endif
+#if BUILDFLAG(IS_TIZEN)
+void WebFrameWidgetImpl::SetMaxRefreshRate(uint32_t max_refresh_rate) {
+ widget_base_->SetMaxRefreshRate(max_refresh_rate);
+}
+#endif
+
void WebFrameWidgetImpl::OrientationChanged() {
local_root_->SendOrientationChangeEvent();
}
void NotifyKeyEvent(WebInputEvent::Type type, bool processed) override;
#endif
+#if BUILDFLAG(IS_TIZEN)
+ void SetMaxRefreshRate(uint32_t max_refresh_rate) override;
+#endif
+
protected:
// WidgetBaseClient overrides:
void ScheduleAnimation() override;
namespace blink {
+#if BUILDFLAG(IS_TIZEN)
+int WidgetBase::max_refresh_rate_ = -1;
+#endif
+
namespace {
#if BUILDFLAG(IS_ANDROID)
Platform::Current()->CompositorThreadTaskRunner()
? Platform::Current()->CompositorThreadTaskRunner().get()
: base::ThreadTaskRunnerHandle::Get().get();
+#if BUILDFLAG(IS_TIZEN)
+ int max_refresh_rate_ = WidgetBase::GetMaxRefreshRate();
+ if (max_refresh_rate_ >= 1 && max_refresh_rate_ <= 60) {
+ auto timer_source = std::make_unique<viz::DelayBasedTimeSource>(
+ compositor_impl_side_task_runner);
+ const base::TimeDelta interval = base::Microseconds(
+ base::Time::kMicrosecondsPerSecond / max_refresh_rate_);
+ timer_source->SetTimebaseAndInterval(base::TimeTicks(), interval);
+ return std::make_unique<viz::DelayBasedBeginFrameSource>(
+ std::move(timer_source), viz::BeginFrameSource::kNotRestartableId);
+ }
+#endif
return std::make_unique<viz::BackToBackBeginFrameSource>(
std::make_unique<viz::DelayBasedTimeSource>(
compositor_impl_side_task_runner));
bool is_embedded() const { return is_embedded_; }
+#if BUILDFLAG(IS_TIZEN)
+ void SetMaxRefreshRate(uint32_t max_refresh_rate) {
+ max_refresh_rate_ = max_refresh_rate;
+ }
+
+ static int GetMaxRefreshRate() { return max_refresh_rate_; }
+#endif
+
private:
bool CanComposeInline();
void UpdateTextInputStateInternal(bool show_virtual_keyboard,
bool text_input_is_in_form_tag_ = false;
#endif
+#if BUILDFLAG(IS_TIZEN)
+ static int max_refresh_rate_;
+#endif
+
// Delayed callback to ensure we have only one delayed ScheduleAnimation()
// call going at a time.
TaskRunnerTimer<WidgetBase> request_animation_after_delay_timer_;
}
}
#endif
+
+void EWebContext::SetMaxRefreshRate(int max_refresh_rate) {
+#if BUILDFLAG(IS_TIZEN)
+ base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
+ command_line.AppendSwitchASCII(switches::kMaxRefreshRate,
+ base::NumberToString(max_refresh_rate));
+#endif
+}
#endif
void EnableAppControl(bool enabled);
+ void SetMaxRefreshRate(int max_refresh_rate);
private:
EWebContext(bool incognito);
return impl->GetApplicationType();
}
#endif
+
+void Ewk_Context::SetMaxRefreshRate(int max_refresh_rate) {
+ impl->SetMaxRefreshRate(max_refresh_rate);
+}
\ No newline at end of file
#endif
void EnableAppControl(bool enabled);
+ void SetMaxRefreshRate(int max_refresh_rate);
private:
EWebContext* impl;
void ewk_context_max_refresh_rate_set(Ewk_Context* context, int max_refresh_rate)
{
- LOG_EWK_API_MOCKUP();
+ EINA_SAFETY_ON_NULL_RETURN(context);
+ context->SetMaxRefreshRate(max_refresh_rate);
}
void ewk_context_service_worker_unregister(Ewk_Context *context, const char* scope_url, Ewk_Context_Service_Worker_Unregistration_Result_Callback result_callback, void* user_data)