fix: re-enable osr following m68 upgrade (#14973)

This commit is contained in:
Shelley Vohr 2018-10-05 11:03:35 -07:00 committed by GitHub
parent 859567983a
commit 71058fd9a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 87 additions and 89 deletions

View file

@ -381,7 +381,7 @@ WebContents::WebContents(v8::Isolate* isolate,
params.delegate_view = view;
web_contents = content::WebContents::Create(params);
view->SetWebContents(web_contents);
view->SetWebContents(web_contents.get());
} else {
#endif
web_contents = content::WebContents::Create(params);
@ -398,7 +398,7 @@ WebContents::WebContents(v8::Isolate* isolate,
params.delegate_view = view;
web_contents = content::WebContents::Create(params);
view->SetWebContents(web_contents);
view->SetWebContents(web_contents.get());
#endif
} else {
content::WebContents::CreateParams params(session->browser_context());

View file

@ -19,7 +19,6 @@
#include "components/viz/common/frame_sinks/delay_based_time_source.h"
#include "components/viz/common/gl_helper.h"
#include "components/viz/common/quads/render_pass.h"
#include "content/browser/renderer_host/compositor_resize_lock.h"
#include "content/browser/renderer_host/render_widget_host_delegate.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/common/view_messages.h"
@ -275,7 +274,6 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
#if !defined(OS_MACOSX)
delegated_frame_host_ = std::make_unique<content::DelegatedFrameHost>(
AllocateFrameSinkId(is_guest_view_hack), this,
features::IsSurfaceSynchronizationEnabled(),
base::FeatureList::IsEnabled(features::kVizDisplayCompositor),
true /* should_register_frame_sink_id */);
@ -289,9 +287,9 @@ OffScreenRenderWidgetHostView::OffScreenRenderWidgetHostView(
CreatePlatformWidget(is_guest_view_hack);
#endif
bool opaque = SkColorGetA(background_color()) == SK_AlphaOPAQUE;
bool opaque = SkColorGetA(background_color_) == SK_AlphaOPAQUE;
GetRootLayer()->SetFillsBoundsOpaquely(opaque);
GetRootLayer()->SetColor(background_color());
GetRootLayer()->SetColor(background_color_);
#if !defined(OS_MACOSX)
// On macOS the ui::Compositor is created/owned by the platform view.
@ -344,6 +342,13 @@ OffScreenRenderWidgetHostView::~OffScreenRenderWidgetHostView() {
#endif
}
content::BrowserAccessibilityManager*
OffScreenRenderWidgetHostView::CreateBrowserAccessibilityManager(
content::BrowserAccessibilityDelegate*,
bool) {
return nullptr;
}
void OffScreenRenderWidgetHostView::OnWindowResize() {
// In offscreen mode call RenderWidgetHostView's SetSize explicitly
auto size = native_window_->GetSize();
@ -400,7 +405,7 @@ void OffScreenRenderWidgetHostView::InitAsChild(gfx::NativeView) {
void OffScreenRenderWidgetHostView::SetSize(const gfx::Size& size) {
size_ = size;
WasResized();
SynchronizeVisualProperties();
}
void OffScreenRenderWidgetHostView::SetBounds(const gfx::Rect& new_bounds) {
@ -469,6 +474,11 @@ bool OffScreenRenderWidgetHostView::IsShowing() {
return is_showing_;
}
void OffScreenRenderWidgetHostView::EnsureSurfaceSynchronizedForLayoutTest() {
++latest_capture_sequence_number_;
SynchronizeVisualProperties();
}
gfx::Rect OffScreenRenderWidgetHostView::GetViewBounds() const {
if (IsPopupWidget())
return popup_position_;
@ -487,10 +497,15 @@ void OffScreenRenderWidgetHostView::SetBackgroundColor(SkColor color) {
}
}
SkColor OffScreenRenderWidgetHostView::background_color() const {
base::Optional<SkColor> OffScreenRenderWidgetHostView::GetBackgroundColor()
const {
return background_color_;
}
void OffScreenRenderWidgetHostView::UpdateBackgroundColor() {
NOTREACHED();
}
gfx::Size OffScreenRenderWidgetHostView::GetVisibleViewportSize() const {
return size_;
}
@ -511,7 +526,7 @@ void OffScreenRenderWidgetHostView::TakeFallbackContentFrom(
->IsRenderWidgetHostViewGuest());
OffScreenRenderWidgetHostView* view_osr =
static_cast<OffScreenRenderWidgetHostView*>(view);
SetBackgroundColor(view_osr->background_color());
SetBackgroundColor(view_osr->background_color_);
if (GetDelegatedFrameHost() && view_osr->GetDelegatedFrameHost()) {
GetDelegatedFrameHost()->TakeFallbackContentFrom(
view_osr->GetDelegatedFrameHost());
@ -531,7 +546,7 @@ void OffScreenRenderWidgetHostView::DidCreateNewRendererCompositorFrameSink(
void OffScreenRenderWidgetHostView::SubmitCompositorFrame(
const viz::LocalSurfaceId& local_surface_id,
viz::CompositorFrame frame,
viz::mojom::HitTestRegionListPtr hit_test_region_list) {
base::Optional<viz::HitTestRegionList> hit_test_region_list) {
TRACE_EVENT0("electron",
"OffScreenRenderWidgetHostView::SubmitCompositorFrame");
@ -659,6 +674,10 @@ void OffScreenRenderWidgetHostView::SetTooltipText(const base::string16&) {}
void OffScreenRenderWidgetHostView::SelectionBoundsChanged(
const ViewHostMsg_SelectionBounds_Params&) {}
uint32_t OffScreenRenderWidgetHostView::GetCaptureSequenceNumber() const {
return latest_capture_sequence_number_;
}
void OffScreenRenderWidgetHostView::CopyFromSurface(
const gfx::Rect& src_rect,
const gfx::Size& output_size,
@ -686,9 +705,8 @@ void OffScreenRenderWidgetHostView::InitAsGuest(
parent_host_view_->RegisterGuestViewFrameSwappedCallback(guest_view);
}
gfx::Vector2d OffScreenRenderWidgetHostView::GetOffsetFromRootSurface() {
return gfx::Vector2d();
}
void OffScreenRenderWidgetHostView::TransformPointToRootSurface(
gfx::PointF* point) {}
gfx::Rect OffScreenRenderWidgetHostView::GetBoundsInRootWindow() {
return gfx::Rect(size_);
@ -752,17 +770,6 @@ SkColor OffScreenRenderWidgetHostView::DelegatedFrameHostGetGutterColor()
return background_color_;
}
bool OffScreenRenderWidgetHostView::DelegatedFrameCanCreateResizeLock() const {
return !render_widget_host_->auto_resize_enabled();
}
std::unique_ptr<content::CompositorResizeLock>
OffScreenRenderWidgetHostView::DelegatedFrameHostCreateResizeLock() {
HoldResize();
const gfx::Size& desired_size = GetRootLayer()->bounds().size();
return std::make_unique<content::CompositorResizeLock>(this, desired_size);
}
void OffScreenRenderWidgetHostView::OnFirstSurfaceActivation(
const viz::SurfaceInfo& surface_info) {}
@ -776,20 +783,6 @@ void OffScreenRenderWidgetHostView::DidReceiveFirstFrameAfterNavigation() {
render_widget_host_->DidReceiveFirstFrameAfterNavigation();
}
std::unique_ptr<ui::CompositorLock>
OffScreenRenderWidgetHostView::GetCompositorLock(
ui::CompositorLockClient* client) {
return GetCompositor()->GetCompositorLock(client);
}
void OffScreenRenderWidgetHostView::CompositorResizeLockEnded() {
ReleaseResize();
}
bool OffScreenRenderWidgetHostView::IsAutoResizeEnabled() const {
return render_widget_host_->auto_resize_enabled();
}
viz::LocalSurfaceId OffScreenRenderWidgetHostView::GetLocalSurfaceId() const {
return local_surface_id_;
}
@ -810,14 +803,14 @@ void OffScreenRenderWidgetHostView::DidNavigate() {
#endif
}
bool OffScreenRenderWidgetHostView::TransformPointToLocalCoordSpace(
bool OffScreenRenderWidgetHostView::TransformPointToLocalCoordSpaceLegacy(
const gfx::PointF& point,
const viz::SurfaceId& original_surface,
gfx::PointF* transformed_point) {
// Transformations use physical pixels rather than DIP, so conversion
// is necessary.
gfx::PointF point_in_pixels = gfx::ConvertPointToPixel(scale_factor_, point);
if (!GetDelegatedFrameHost()->TransformPointToLocalCoordSpace(
if (!GetDelegatedFrameHost()->TransformPointToLocalCoordSpaceLegacy(
point_in_pixels, original_surface, transformed_point)) {
return false;
}
@ -830,7 +823,8 @@ bool OffScreenRenderWidgetHostView::TransformPointToLocalCoordSpace(
bool OffScreenRenderWidgetHostView::TransformPointToCoordSpaceForView(
const gfx::PointF& point,
RenderWidgetHostViewBase* target_view,
gfx::PointF* transformed_point) {
gfx::PointF* transformed_point,
viz::EventSource source) {
if (target_view == this) {
*transformed_point = point;
return true;
@ -840,7 +834,7 @@ bool OffScreenRenderWidgetHostView::TransformPointToCoordSpaceForView(
// but it is not necessary here because the final target view is responsible
// for converting before computing the final transform.
return GetDelegatedFrameHost()->TransformPointToCoordSpaceForView(
point, target_view, transformed_point);
point, target_view, transformed_point, source);
}
void OffScreenRenderWidgetHostView::CancelWidget() {
@ -1019,12 +1013,13 @@ void OffScreenRenderWidgetHostView::ReleaseResize() {
pending_resize_ = false;
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
base::BindOnce(&OffScreenRenderWidgetHostView::WasResized,
base::BindOnce(
&OffScreenRenderWidgetHostView::SynchronizeVisualProperties,
weak_ptr_factory_.GetWeakPtr()));
}
}
void OffScreenRenderWidgetHostView::WasResized() {
void OffScreenRenderWidgetHostView::SynchronizeVisualProperties() {
if (hold_resize_) {
if (!pending_resize_)
pending_resize_ = true;
@ -1033,9 +1028,9 @@ void OffScreenRenderWidgetHostView::WasResized() {
ResizeRootLayer(false);
if (render_widget_host_)
render_widget_host_->WasResized();
GetDelegatedFrameHost()->WasResized(local_surface_id_, size_,
cc::DeadlinePolicy::UseDefaultDeadline());
render_widget_host_->SynchronizeVisualProperties();
GetDelegatedFrameHost()->SynchronizeVisualProperties(
local_surface_id_, size_, cc::DeadlinePolicy::UseDefaultDeadline());
}
void OffScreenRenderWidgetHostView::SendMouseEvent(
@ -1274,14 +1269,15 @@ void OffScreenRenderWidgetHostView::ResizeRootLayer(bool force) {
bool resized = UpdateNSViewAndDisplay();
#else
bool resized = true;
GetDelegatedFrameHost()->WasResized(local_surface_id_, size,
cc::DeadlinePolicy::UseDefaultDeadline());
GetDelegatedFrameHost()->SynchronizeVisualProperties(
local_surface_id_, size, cc::DeadlinePolicy::UseDefaultDeadline());
#endif
// Note that |render_widget_host_| will retrieve resize parameters from the
// DelegatedFrameHost, so it must have WasResized called after.
// DelegatedFrameHost, so it must have SynchronizeVisualProperties called
// after.
if (resized && render_widget_host_)
render_widget_host_->WasResized();
render_widget_host_->SynchronizeVisualProperties();
}
viz::FrameSinkId OffScreenRenderWidgetHostView::AllocateFrameSinkId(
@ -1302,7 +1298,7 @@ viz::FrameSinkId OffScreenRenderWidgetHostView::AllocateFrameSinkId(
void OffScreenRenderWidgetHostView::UpdateBackgroundColorFromRenderer(
SkColor color) {
if (color == background_color())
if (color == background_color_)
return;
background_color_ = color;

View file

@ -26,7 +26,6 @@
#include "components/viz/common/quads/compositor_frame.h"
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
#include "content/browser/frame_host/render_widget_host_view_guest.h"
#include "content/browser/renderer_host/compositor_resize_lock.h"
#include "content/browser/renderer_host/delegated_frame_host.h"
#include "content/browser/renderer_host/input/mouse_wheel_phase_handler.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
@ -67,12 +66,10 @@ class AtomBeginFrameTimer;
class MacHelper;
#endif
class OffScreenRenderWidgetHostView
: public content::RenderWidgetHostViewBase,
class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
public ui::CompositorDelegate,
#if !defined(OS_MACOSX)
public content::DelegatedFrameHostClient,
public content::CompositorResizeLockClient,
#endif
public NativeWindowObserver,
public OffscreenViewProxyObserver {
@ -86,6 +83,10 @@ class OffScreenRenderWidgetHostView
NativeWindow* native_window);
~OffScreenRenderWidgetHostView() override;
content::BrowserAccessibilityManager* CreateBrowserAccessibilityManager(
content::BrowserAccessibilityDelegate*,
bool) override;
// content::RenderWidgetHostView:
void InitAsChild(gfx::NativeView) override;
void SetSize(const gfx::Size&) override;
@ -95,15 +96,18 @@ class OffScreenRenderWidgetHostView
ui::TextInputClient* GetTextInputClient() override;
void Focus(void) override;
bool HasFocus(void) const override;
uint32_t GetCaptureSequenceNumber() const override;
bool IsSurfaceAvailableForCopy(void) const override;
void Show(void) override;
void Hide(void) override;
bool IsShowing(void) override;
void EnsureSurfaceSynchronizedForLayoutTest() override;
gfx::Rect GetViewBounds(void) const override;
gfx::Size GetVisibleViewportSize() const override;
void SetInsets(const gfx::Insets&) override;
void SetBackgroundColor(SkColor color) override;
SkColor background_color() const override;
base::Optional<SkColor> GetBackgroundColor() const override;
void UpdateBackgroundColor() override;
bool LockMouse(void) override;
void UnlockMouse(void) override;
void TakeFallbackContentFrom(content::RenderWidgetHostView* view) override;
@ -124,7 +128,7 @@ class OffScreenRenderWidgetHostView
void SubmitCompositorFrame(
const viz::LocalSurfaceId& local_surface_id,
viz::CompositorFrame frame,
viz::mojom::HitTestRegionListPtr hit_test_region_list) override;
base::Optional<viz::HitTestRegionList> hit_test_region_list) override;
void ClearCompositorFrame(void) override;
void InitAsPopup(content::RenderWidgetHostView* rwhv,
@ -146,7 +150,7 @@ class OffScreenRenderWidgetHostView
void GetScreenInfo(content::ScreenInfo* results) const override;
void InitAsGuest(content::RenderWidgetHostView*,
content::RenderWidgetHostViewGuest*) override;
gfx::Vector2d GetOffsetFromRootSurface() override;
void TransformPointToRootSurface(gfx::PointF* point) override;
gfx::Rect GetBoundsInRootWindow(void) override;
viz::SurfaceId GetCurrentSurfaceId() const override;
void ImeCompositionRangeChanged(const gfx::Range&,
@ -165,18 +169,10 @@ class OffScreenRenderWidgetHostView
ui::Layer* DelegatedFrameHostGetLayer(void) const override;
bool DelegatedFrameHostIsVisible(void) const override;
SkColor DelegatedFrameHostGetGutterColor() const override;
bool DelegatedFrameCanCreateResizeLock() const override;
std::unique_ptr<content::CompositorResizeLock>
DelegatedFrameHostCreateResizeLock() override;
void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override;
void OnBeginFrame(base::TimeTicks frame_time) override;
void OnFrameTokenChanged(uint32_t frame_token) override;
void DidReceiveFirstFrameAfterNavigation() override;
// CompositorResizeLockClient implementation.
std::unique_ptr<ui::CompositorLock> GetCompositorLock(
ui::CompositorLockClient* client) override;
void CompositorResizeLockEnded() override;
bool IsAutoResizeEnabled() const override;
#endif // !defined(OS_MACOSX)
viz::LocalSurfaceId GetLocalSurfaceId() const override;
@ -184,13 +180,15 @@ class OffScreenRenderWidgetHostView
void DidNavigate() override;
bool TransformPointToLocalCoordSpace(const gfx::PointF& point,
bool TransformPointToLocalCoordSpaceLegacy(
const gfx::PointF& point,
const viz::SurfaceId& original_surface,
gfx::PointF* transformed_point) override;
bool TransformPointToCoordSpaceForView(
const gfx::PointF& point,
RenderWidgetHostViewBase* target_view,
gfx::PointF* transformed_point) override;
gfx::PointF* transformed_point,
viz::EventSource source = viz::EventSource::ANY) override;
// ui::CompositorDelegate:
std::unique_ptr<viz::SoftwareOutputDevice> CreateSoftwareOutputDevice(
@ -233,7 +231,7 @@ class OffScreenRenderWidgetHostView
void HoldResize();
void ReleaseResize();
void WasResized();
void SynchronizeVisualProperties();
void SendMouseEvent(const blink::WebMouseEvent& event);
void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event);
@ -246,6 +244,13 @@ class OffScreenRenderWidgetHostView
ui::Compositor* GetCompositor() const;
ui::Layer* GetRootLayer() const;
#if defined(OS_MACOSX)
content::BrowserCompositorMac* browser_compositor() const {
return browser_compositor_.get();
}
#endif
content::DelegatedFrameHost* GetDelegatedFrameHost() const;
void Invalidate();
@ -344,6 +349,11 @@ class OffScreenRenderWidgetHostView
viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink_ =
nullptr;
// Latest capture sequence number which is incremented when the caller
// requests surfaces be synchronized via
// EnsureSurfaceSynchronizedForLayoutTest().
uint32_t latest_capture_sequence_number_ = 0u;
SkColor background_color_ = SkColor();
base::WeakPtrFactory<OffScreenRenderWidgetHostView> weak_ptr_factory_;

View file

@ -53,14 +53,7 @@ class MacHelper : public content::BrowserCompositorMacClient,
return [view_->window()->GetNativeWindow() contentView];
}
void AcceleratedWidgetGetVSyncParameters(
base::TimeTicks* timebase,
base::TimeDelta* interval) const override {
*timebase = base::TimeTicks();
*interval = base::TimeDelta();
}
void AcceleratedWidgetSwapCompleted() override {}
void AcceleratedWidgetCALayerParamsUpdated() override {}
void DidReceiveFirstFrameAfterNavigation() override {
view_->render_widget_host()->DidReceiveFirstFrameAfterNavigation();
@ -68,7 +61,9 @@ class MacHelper : public content::BrowserCompositorMacClient,
void DestroyCompositorForShutdown() override {}
void WasResized() override { view_->render_widget_host()->WasResized(); }
bool SynchronizeVisualProperties() override {
return view_->render_widget_host()->SynchronizeVisualProperties();
}
private:
OffScreenRenderWidgetHostView* view_;

View file

@ -10,7 +10,4 @@ enable_extensions = false
proprietary_codecs = true
ffmpeg_branding = "Chrome"
# TODO(jeremy): OSR is broken in M68. Remove this once it's fixed.
enable_osr = false
is_cfi = false