Commit c76d136a authored by Ian Vollick's avatar Ian Vollick Committed by Commit Bot

[vr] Remove URL bar throttling

This is an obsolete performance optimization.

Bug: None
Change-Id: I1b37a9bdc46b73aedaeeec65a86fe46cf8af081a
Reviewed-on: https://chromium-review.googlesource.com/563960Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Commit-Queue: Ian Vollick <vollick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485260}
parent 86451593
...@@ -61,9 +61,4 @@ void LoadingIndicator::SetVisibility() { ...@@ -61,9 +61,4 @@ void LoadingIndicator::SetVisibility() {
set_visible(enabled_ && (loading_ || visibility_timer_.IsRunning())); set_visible(enabled_ && (loading_ || visibility_timer_.IsRunning()));
} }
void LoadingIndicator::OnBeginFrame(const base::TimeTicks& ticks) {
if (enabled_)
UpdateTexture();
}
} // namespace vr_shell } // namespace vr_shell
...@@ -24,7 +24,6 @@ class LoadingIndicator : public TexturedElement { ...@@ -24,7 +24,6 @@ class LoadingIndicator : public TexturedElement {
void SetLoadProgress(float progress); void SetLoadProgress(float progress);
void SetEnabled(bool enabled) override; void SetEnabled(bool enabled) override;
void OnBeginFrame(const base::TimeTicks& ticks) override;
private: private:
UiTexture* GetTexture() const override; UiTexture* GetTexture() const override;
......
...@@ -30,13 +30,14 @@ class TexturedElement : public UiElement { ...@@ -30,13 +30,14 @@ class TexturedElement : public UiElement {
void Render(UiElementRenderer* renderer, void Render(UiElementRenderer* renderer,
gfx::Transform view_proj_matrix) const final; gfx::Transform view_proj_matrix) const final;
void OnBeginFrame(const base::TimeTicks& begin_frame_time) override;
protected: protected:
void UpdateTexture();
virtual UiTexture* GetTexture() const = 0; virtual UiTexture* GetTexture() const = 0;
virtual void UpdateTexture();
virtual void UpdateElementSize(); virtual void UpdateElementSize();
void OnBeginFrame(const base::TimeTicks& begin_frame_time) final;
private: private:
void Flush(SkSurface* surface); void Flush(SkSurface* surface);
void OnSetMode() override; void OnSetMode() override;
......
...@@ -9,16 +9,6 @@ ...@@ -9,16 +9,6 @@
namespace vr_shell { namespace vr_shell {
namespace {
// We will often get spammed with many updates. We will also get security and
// url updates out of sync. To address both these problems, we will hang onto
// dirtyness for |kUpdateDelay| before updating our texture to reduce visual
// churn.
constexpr int64_t kUpdateDelayMS = 50;
} // namespace
UrlBar::UrlBar(int preferred_width, UrlBar::UrlBar(int preferred_width,
const base::Callback<void()>& back_button_callback, const base::Callback<void()>& back_button_callback,
const base::Callback<void()>& security_icon_callback, const base::Callback<void()>& security_icon_callback,
...@@ -30,11 +20,6 @@ UrlBar::UrlBar(int preferred_width, ...@@ -30,11 +20,6 @@ UrlBar::UrlBar(int preferred_width,
UrlBar::~UrlBar() = default; UrlBar::~UrlBar() = default;
void UrlBar::UpdateTexture() {
TexturedElement::UpdateTexture();
last_update_time_ = last_begin_frame_time_;
}
UiTexture* UrlBar::GetTexture() const { UiTexture* UrlBar::GetTexture() const {
return texture_.get(); return texture_.get();
} }
...@@ -74,20 +59,6 @@ bool UrlBar::HitTest(const gfx::PointF& position) const { ...@@ -74,20 +59,6 @@ bool UrlBar::HitTest(const gfx::PointF& position) const {
return texture_->HitsUrlBar(position) || texture_->HitsBackButton(position); return texture_->HitsUrlBar(position) || texture_->HitsBackButton(position);
} }
void UrlBar::OnBeginFrame(const base::TimeTicks& begin_frame_time) {
last_begin_frame_time_ = begin_frame_time;
if (enabled_ && texture_->dirty()) {
int64_t delta_ms = (begin_frame_time - last_update_time_).InMilliseconds();
if (delta_ms > kUpdateDelayMS)
UpdateTexture();
}
}
void UrlBar::SetEnabled(bool enabled) {
enabled_ = enabled;
set_visible(enabled);
}
void UrlBar::SetToolbarState(const ToolbarState& state) { void UrlBar::SetToolbarState(const ToolbarState& state) {
texture_->SetToolbarState(state); texture_->SetToolbarState(state);
} }
......
...@@ -35,26 +35,19 @@ class UrlBar : public TexturedElement { ...@@ -35,26 +35,19 @@ class UrlBar : public TexturedElement {
void OnButtonUp(const gfx::PointF& position) override; void OnButtonUp(const gfx::PointF& position) override;
bool HitTest(const gfx::PointF& point) const override; bool HitTest(const gfx::PointF& point) const override;
void OnBeginFrame(const base::TimeTicks& begin_frame_time) override;
void SetEnabled(bool enabled) override;
void SetHistoryButtonsEnabled(bool can_go_back); void SetHistoryButtonsEnabled(bool can_go_back);
void SetToolbarState(const ToolbarState& state); void SetToolbarState(const ToolbarState& state);
private: private:
void UpdateTexture() override;
UiTexture* GetTexture() const override; UiTexture* GetTexture() const override;
void OnStateUpdated(const gfx::PointF& position); void OnStateUpdated(const gfx::PointF& position);
std::unique_ptr<UrlBarTexture> texture_; std::unique_ptr<UrlBarTexture> texture_;
base::Callback<void()> back_button_callback_; base::Callback<void()> back_button_callback_;
base::Callback<void()> security_icon_callback_; base::Callback<void()> security_icon_callback_;
bool enabled_ = false;
bool can_go_back_ = false; bool can_go_back_ = false;
bool down_ = false; bool down_ = false;
bool security_region_down_ = false; bool security_region_down_ = false;
base::TimeTicks last_begin_frame_time_;
base::TimeTicks last_update_time_;
DISALLOW_COPY_AND_ASSIGN(UrlBar); DISALLOW_COPY_AND_ASSIGN(UrlBar);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment