Commit 76d1ea36 authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Push duplicate implementations into WebFrameWidgetBase.

WebViewImpl and WebFrameWidgetImpl have typically implemented very
similar things. The goal is to remove WebViewFrameWidget and have
a single frame widget class move more implementation into the base
class.

BUG=1097816

Change-Id: I8bc5c5a2b869cd99b693c8431e81eb127848596e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2517704Reviewed-by: default avatardanakj <danakj@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823631}
parent 7b5c8f9f
......@@ -1766,11 +1766,6 @@ WebViewFrameWidget* WebViewImpl::MainFrameViewWidget() {
return web_widget_;
}
void WebViewImpl::SetSuppressFrameRequestsWorkaroundFor704763Only(
bool suppress_frame_requests) {
page_->Animator().SetSuppressFrameRequestsWorkaroundFor704763Only(
suppress_frame_requests);
}
void WebViewImpl::BeginFrame(base::TimeTicks last_frame_time) {
TRACE_EVENT1("blink", "WebViewImpl::beginFrame", "frameTime",
last_frame_time);
......@@ -1819,39 +1814,6 @@ void WebViewImpl::EndUpdateLayers() {
update_layers_start_time_.reset();
}
void WebViewImpl::RecordStartOfFrameMetrics() {
if (!MainFrameImpl())
return;
MainFrameImpl()->GetFrame()->View()->EnsureUkmAggregator().BeginMainFrame();
}
void WebViewImpl::RecordEndOfFrameMetrics(
base::TimeTicks frame_begin_time,
cc::ActiveFrameSequenceTrackers trackers) {
if (!MainFrameImpl())
return;
MainFrameImpl()
->GetFrame()
->View()
->EnsureUkmAggregator()
.RecordEndOfFrameMetrics(frame_begin_time, base::TimeTicks::Now(),
trackers);
}
std::unique_ptr<cc::BeginMainFrameMetrics>
WebViewImpl::GetBeginMainFrameMetrics() {
if (!MainFrameImpl())
return nullptr;
return MainFrameImpl()
->GetFrame()
->View()
->EnsureUkmAggregator()
.GetBeginMainFrameMetrics();
}
void WebViewImpl::UpdateLifecycle(WebLifecycleUpdate requested_update,
DocumentUpdateReason reason) {
TRACE_EVENT0("blink", "WebViewImpl::updateAllLifecyclePhases");
......
......@@ -75,7 +75,6 @@
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace cc {
struct BeginMainFrameMetrics;
class ScopedDeferMainFrameUpdate;
}
......@@ -539,14 +538,9 @@ class CORE_EXPORT WebViewImpl final : public WebView,
// These are temporary methods to allow WebViewFrameWidget to delegate to
// WebViewImpl. We expect to eventually move these out.
void SetSuppressFrameRequestsWorkaroundFor704763Only(bool);
void BeginFrame(base::TimeTicks last_frame_time);
void BeginUpdateLayers();
void EndUpdateLayers();
void RecordStartOfFrameMetrics();
void RecordEndOfFrameMetrics(base::TimeTicks frame_begin_time,
cc::ActiveFrameSequenceTrackers trackers);
std::unique_ptr<cc::BeginMainFrameMetrics> GetBeginMainFrameMetrics();
void UpdateLifecycle(WebLifecycleUpdate requested_update,
DocumentUpdateReason reason);
void ThemeChanged();
......
......@@ -1052,6 +1052,45 @@ void WebFrameWidgetBase::RecordDispatchRafAlignedInputTime(
}
}
void WebFrameWidgetBase::SetSuppressFrameRequestsWorkaroundFor704763Only(
bool suppress_frame_requests) {
GetPage()->Animator().SetSuppressFrameRequestsWorkaroundFor704763Only(
suppress_frame_requests);
}
std::unique_ptr<cc::BeginMainFrameMetrics>
WebFrameWidgetBase::GetBeginMainFrameMetrics() {
if (!LocalRootImpl())
return nullptr;
return LocalRootImpl()
->GetFrame()
->View()
->EnsureUkmAggregator()
.GetBeginMainFrameMetrics();
}
void WebFrameWidgetBase::RecordStartOfFrameMetrics() {
if (!LocalRootImpl())
return;
LocalRootImpl()->GetFrame()->View()->EnsureUkmAggregator().BeginMainFrame();
}
void WebFrameWidgetBase::RecordEndOfFrameMetrics(
base::TimeTicks frame_begin_time,
cc::ActiveFrameSequenceTrackers trackers) {
if (!LocalRootImpl())
return;
LocalRootImpl()
->GetFrame()
->View()
->EnsureUkmAggregator()
.RecordEndOfFrameMetrics(frame_begin_time, base::TimeTicks::Now(),
trackers);
}
bool WebFrameWidgetBase::WillHandleGestureEvent(const WebGestureEvent& event) {
possible_drag_event_info_.source = ui::mojom::blink::DragEventSource::kTouch;
possible_drag_event_info_.location =
......@@ -1252,6 +1291,18 @@ void WebFrameWidgetBase::UpdateScreenInfo(const ScreenInfo& new_screen_info) {
widget_base_->UpdateScreenInfo(new_screen_info);
}
void WebFrameWidgetBase::UpdateSurfaceAndCompositorRect(
const viz::LocalSurfaceId& new_local_surface_id,
const gfx::Rect& compositor_viewport_pixel_rect) {
widget_base_->UpdateSurfaceAndCompositorRect(new_local_surface_id,
compositor_viewport_pixel_rect);
}
void WebFrameWidgetBase::UpdateCompositorViewportRect(
const gfx::Rect& compositor_viewport_pixel_rect) {
widget_base_->UpdateCompositorViewportRect(compositor_viewport_pixel_rect);
}
const ScreenInfo& WebFrameWidgetBase::GetScreenInfo() {
return widget_base_->GetScreenInfo();
}
......
......@@ -333,6 +333,13 @@ class CORE_EXPORT WebFrameWidgetBase
// WidgetBaseClient methods.
void RecordDispatchRafAlignedInputTime(
base::TimeTicks raf_aligned_input_start_time) override;
void SetSuppressFrameRequestsWorkaroundFor704763Only(bool) override;
void RecordStartOfFrameMetrics() override;
void RecordEndOfFrameMetrics(
base::TimeTicks,
cc::ActiveFrameSequenceTrackers trackers) override;
std::unique_ptr<cc::BeginMainFrameMetrics> GetBeginMainFrameMetrics()
override;
void DidCommitAndDrawCompositorFrame() override;
std::unique_ptr<cc::LayerTreeFrameSink> AllocateNewLayerTreeFrameSink()
override;
......@@ -576,6 +583,11 @@ class CORE_EXPORT WebFrameWidgetBase
// Similar to UpdateSurfaceAndScreenInfo but the surface allocation
// and compositor viewport rect remains the same.
void UpdateScreenInfo(const ScreenInfo& screen_info);
void UpdateSurfaceAndCompositorRect(
const viz::LocalSurfaceId& new_local_surface_id,
const gfx::Rect& compositor_viewport_pixel_rect);
void UpdateCompositorViewportRect(
const gfx::Rect& compositor_viewport_pixel_rect);
void SetWindowSegments(const std::vector<gfx::Rect>& window_segments);
viz::FrameSinkId GetFrameSinkIdAtPoint(const gfx::PointF& point,
gfx::PointF* local_point);
......
......@@ -314,12 +314,6 @@ void WebFrameWidgetImpl::UpdateMainFrameLayoutSize() {
view->SetLayoutSize(WebSize(layout_size));
}
void WebFrameWidgetImpl::SetSuppressFrameRequestsWorkaroundFor704763Only(
bool suppress_frame_requests) {
GetPage()->Animator().SetSuppressFrameRequestsWorkaroundFor704763Only(
suppress_frame_requests);
}
void WebFrameWidgetImpl::BeginMainFrame(base::TimeTicks last_frame_time) {
TRACE_EVENT1("blink", "WebFrameWidgetImpl::beginFrame", "frameTime",
last_frame_time);
......@@ -403,39 +397,6 @@ void WebFrameWidgetImpl::EndCommitCompositorFrame(
commit_compositor_frame_start_time_.reset();
}
void WebFrameWidgetImpl::RecordStartOfFrameMetrics() {
if (!LocalRootImpl())
return;
LocalRootImpl()->GetFrame()->View()->EnsureUkmAggregator().BeginMainFrame();
}
void WebFrameWidgetImpl::RecordEndOfFrameMetrics(
base::TimeTicks frame_begin_time,
cc::ActiveFrameSequenceTrackers trackers) {
if (!LocalRootImpl())
return;
LocalRootImpl()
->GetFrame()
->View()
->EnsureUkmAggregator()
.RecordEndOfFrameMetrics(frame_begin_time, base::TimeTicks::Now(),
trackers);
}
std::unique_ptr<cc::BeginMainFrameMetrics>
WebFrameWidgetImpl::GetBeginMainFrameMetrics() {
if (!LocalRootImpl())
return nullptr;
return LocalRootImpl()
->GetFrame()
->View()
->EnsureUkmAggregator()
.GetBeginMainFrameMetrics();
}
void WebFrameWidgetImpl::UpdateLifecycle(WebLifecycleUpdate requested_update,
DocumentUpdateReason reason) {
TRACE_EVENT0("blink", "WebFrameWidgetImpl::updateAllLifecyclePhases");
......
......@@ -53,7 +53,6 @@
namespace cc {
class Layer;
struct BeginMainFrameMetrics;
}
namespace blink {
......@@ -154,13 +153,6 @@ class WebFrameWidgetImpl final : public WebFrameWidgetBase,
// WidgetBaseClient overrides:
void BeginMainFrame(base::TimeTicks last_frame_time) override;
void SetSuppressFrameRequestsWorkaroundFor704763Only(bool) final;
void RecordStartOfFrameMetrics() override;
void RecordEndOfFrameMetrics(
base::TimeTicks,
cc::ActiveFrameSequenceTrackers trackers) override;
std::unique_ptr<cc::BeginMainFrameMetrics> GetBeginMainFrameMetrics()
override;
void BeginUpdateLayers() override;
void EndUpdateLayers() override;
void BeginCommitCompositorFrame() override;
......
......@@ -73,12 +73,6 @@ void WebViewFrameWidget::Resize(const gfx::Size& size) {
web_view_->Resize(size);
}
void WebViewFrameWidget::SetSuppressFrameRequestsWorkaroundFor704763Only(
bool suppress_frame_requests) {
web_view_->SetSuppressFrameRequestsWorkaroundFor704763Only(
suppress_frame_requests);
}
void WebViewFrameWidget::BeginMainFrame(base::TimeTicks last_frame_time) {
web_view_->BeginFrame(last_frame_time);
}
......@@ -126,21 +120,6 @@ void WebViewFrameWidget::EndCommitCompositorFrame(
commit_compositor_frame_start_time_.reset();
}
void WebViewFrameWidget::RecordStartOfFrameMetrics() {
web_view_->RecordStartOfFrameMetrics();
}
void WebViewFrameWidget::RecordEndOfFrameMetrics(
base::TimeTicks frame_begin_time,
cc::ActiveFrameSequenceTrackers trackers) {
web_view_->RecordEndOfFrameMetrics(frame_begin_time, trackers);
}
std::unique_ptr<cc::BeginMainFrameMetrics>
WebViewFrameWidget::GetBeginMainFrameMetrics() {
return web_view_->GetBeginMainFrameMetrics();
}
void WebViewFrameWidget::UpdateLifecycle(WebLifecycleUpdate requested_update,
DocumentUpdateReason reason) {
web_view_->UpdateLifecycle(requested_update, reason);
......@@ -593,16 +572,4 @@ void WebViewFrameWidget::ApplyVisualPropertiesSizing(
}
}
void WebViewFrameWidget::UpdateSurfaceAndCompositorRect(
const viz::LocalSurfaceId& new_local_surface_id,
const gfx::Rect& compositor_viewport_pixel_rect) {
widget_base_->UpdateSurfaceAndCompositorRect(new_local_surface_id,
compositor_viewport_pixel_rect);
}
void WebViewFrameWidget::UpdateCompositorViewportRect(
const gfx::Rect& compositor_viewport_pixel_rect) {
widget_base_->UpdateCompositorViewportRect(compositor_viewport_pixel_rect);
}
} // namespace blink
......@@ -112,13 +112,6 @@ class CORE_EXPORT WebViewFrameWidget : public WebFrameWidgetBase {
// WidgetBaseClient overrides:
void BeginMainFrame(base::TimeTicks last_frame_time) override;
void SetSuppressFrameRequestsWorkaroundFor704763Only(bool) final;
void RecordStartOfFrameMetrics() override;
void RecordEndOfFrameMetrics(
base::TimeTicks frame_begin_time,
cc::ActiveFrameSequenceTrackers trackers) override;
std::unique_ptr<cc::BeginMainFrameMetrics> GetBeginMainFrameMetrics()
override;
void BeginUpdateLayers() override;
void EndUpdateLayers() override;
void DidBeginMainFrame() override;
......@@ -149,11 +142,6 @@ class CORE_EXPORT WebViewFrameWidget : public WebFrameWidgetBase {
void Trace(Visitor*) const override;
void UpdateSurfaceAndCompositorRect(
const viz::LocalSurfaceId& new_local_surface_id,
const gfx::Rect& compositor_viewport_pixel_rect);
void UpdateCompositorViewportRect(
const gfx::Rect& compositor_viewport_pixel_rect);
void SetIsNestedMainFrameWidget(bool is_nested);
void DidAutoResize(const gfx::Size& size);
void SetDeviceColorSpaceForTesting(const gfx::ColorSpace& color_space);
......
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