Commit b6a59f2e authored by Fady Samuel's avatar Fady Samuel Committed by Commit Bot

BrowserPlugin: Delete non-surface-sync code path

BrowserPlugin is only on on Chrome desktop and and surface sync is always
on on desktop. This CL deletes the old code path.

Bug: 672962
Change-Id: If0394bd7b8eed4b04d23fede8e31aff1ee3417b4
Reviewed-on: https://chromium-review.googlesource.com/1234323Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Reviewed-by: default avatarSaman Sami <samans@chromium.org>
Reviewed-by: default avatarJames MacLean <wjmaclean@chromium.org>
Commit-Queue: Fady Samuel <fsamuel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592497}
parent 45844e36
......@@ -421,16 +421,6 @@ void BrowserPluginGuest::PointerLockPermissionResponse(bool allow) {
browser_plugin_instance_id(), allow));
}
void BrowserPluginGuest::FirstSurfaceActivation(
const viz::SurfaceInfo& surface_info) {
if (!features::IsUsingWindowService() &&
!features::IsSurfaceSynchronizationEnabled()) {
SendMessageToEmbedder(
std::make_unique<BrowserPluginMsg_FirstSurfaceActivation>(
browser_plugin_instance_id(), surface_info));
}
}
void BrowserPluginGuest::ResendEventToEmbedder(
const blink::WebInputEvent& event) {
if (!attached() || !owner_web_contents_)
......
......@@ -63,7 +63,6 @@ class RenderFrameMetadata;
namespace viz {
class LocalSurfaceId;
class SurfaceInfo;
} // namespace viz
namespace content {
......@@ -246,9 +245,6 @@ class CONTENT_EXPORT BrowserPluginGuest : public GuestHost,
void PointerLockPermissionResponse(bool allow);
// The next function is virtual for test purposes.
virtual void FirstSurfaceActivation(const viz::SurfaceInfo& surface_info);
void ResendEventToEmbedder(const blink::WebInputEvent& event);
// TODO(ekaramad): Remove this once https://crbug.com/642826 is resolved.
......
......@@ -371,12 +371,6 @@ void RenderWidgetHostViewGuest::SetTooltipText(
root_view->GetCursorManager()->SetTooltipTextForView(this, tooltip_text);
}
void RenderWidgetHostViewGuest::FirstSurfaceActivation(
const viz::SurfaceInfo& surface_info) {
if (guest_ && !guest_->is_in_destruction())
guest_->FirstSurfaceActivation(surface_info);
}
void RenderWidgetHostViewGuest::OnDidUpdateVisualPropertiesComplete(
const cc::RenderFrameMetadata& metadata) {
if (guest_)
......
......@@ -166,8 +166,6 @@ class CONTENT_EXPORT RenderWidgetHostViewGuest
private:
friend class RenderWidgetHostView;
void FirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override;
void OnDidUpdateVisualPropertiesComplete(
const cc::RenderFrameMetadata& metadata);
......
......@@ -111,17 +111,9 @@ class TestBrowserPluginGuest : public BrowserPluginGuest {
~TestBrowserPluginGuest() override {}
void ResetTestData() { last_surface_info_ = viz::SurfaceInfo(); }
void set_attached(bool attached) {
BrowserPluginGuest::set_attached_for_test(attached);
}
void FirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override {
last_surface_info_ = surface_info;
}
viz::SurfaceInfo last_surface_info_;
};
// TODO(wjmaclean): we should restructure RenderWidgetHostViewChildFrameTest to
......@@ -197,47 +189,4 @@ class RenderWidgetHostViewGuestSurfaceTest
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuestSurfaceTest);
};
TEST_F(RenderWidgetHostViewGuestSurfaceTest, TestGuestSurface) {
// Early out because RenderWidgetHostViewChildFrame::SendSurfaceInfoToEmbedder
// is no-op on mash and the test expects it call into FirstSurfaceActivation
// of BrowserPluginGuest.
if (features::IsUsingWindowService())
return;
gfx::Size view_size(100, 100);
gfx::Rect view_rect(view_size);
float scale_factor = 1.f;
viz::LocalSurfaceId local_surface_id(1, base::UnguessableToken::Create());
viz::SurfaceId surface_id(view_->GetFrameSinkId(), local_surface_id);
viz::SurfaceInfo surface_info(surface_id, scale_factor, view_size);
ASSERT_TRUE(browser_plugin_guest_);
view_->SetSize(view_size);
view_->Show();
browser_plugin_guest_->set_attached(true);
view_->OnFirstSurfaceActivation(surface_info);
EXPECT_EQ(surface_id, GetSurfaceId());
// Surface ID should have been passed to BrowserPluginGuest to
// be sent to the embedding renderer.
EXPECT_EQ(surface_info, browser_plugin_guest_->last_surface_info_);
browser_plugin_guest_->ResetTestData();
// The last received SurfaceInfo must be sent to BrowserPluginGuest on
// attachment.
view_->OnAttached();
// Surface ID should have been passed to BrowserPluginGuest to
// be sent to the embedding renderer.
EXPECT_EQ(surface_info, browser_plugin_guest_->last_surface_info_);
browser_plugin_guest_->set_attached(false);
browser_plugin_guest_->ResetTestData();
}
} // namespace content
......@@ -215,10 +215,6 @@ IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetCursor,
int /* browser_plugin_instance_id */,
content::WebCursor /* cursor */)
IPC_MESSAGE_CONTROL2(BrowserPluginMsg_FirstSurfaceActivation,
int /* browser_plugin_instance_id */,
viz::SurfaceInfo /* surface_info */)
// Forwards a PointerLock Unlock request to the BrowserPlugin.
IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetMouseLock,
int /* browser_plugin_instance_id */,
......
......@@ -103,8 +103,6 @@ BrowserPlugin::BrowserPlugin(
if (delegate_)
delegate_->SetElementInstanceID(browser_plugin_instance_id_);
enable_surface_synchronization_ = features::IsSurfaceSynchronizationEnabled();
}
BrowserPlugin::~BrowserPlugin() {
......@@ -136,27 +134,10 @@ bool BrowserPlugin::OnMessageReceived(const IPC::Message& message) {
#endif
IPC_MESSAGE_HANDLER(BrowserPluginMsg_ShouldAcceptTouchEvents,
OnShouldAcceptTouchEvents)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_FirstSurfaceActivation,
OnFirstSurfaceActivation)
IPC_END_MESSAGE_MAP()
return handled;
}
void BrowserPlugin::OnFirstSurfaceActivation(
int browser_plugin_instance_id,
const viz::SurfaceInfo& surface_info) {
if (!attached() || features::IsUsingWindowService())
return;
if (!enable_surface_synchronization_) {
compositing_helper_->SetPrimarySurfaceId(
surface_info.id(), screen_space_rect().size(),
cc::DeadlinePolicy::UseDefaultDeadline());
}
compositing_helper_->SetFallbackSurfaceId(surface_info.id(),
screen_space_rect().size());
}
void BrowserPlugin::UpdateDOMAttribute(const std::string& attribute_name,
const base::string16& attribute_value) {
if (!Container())
......@@ -286,7 +267,7 @@ void BrowserPlugin::SynchronizeVisualProperties() {
if (synchronized_props_changed)
parent_local_surface_id_allocator_.GenerateId();
if (enable_surface_synchronization_ && frame_sink_id_.is_valid()) {
if (frame_sink_id_.is_valid()) {
// If we're synchronizing surfaces, then use an infinite deadline to ensure
// everything is synchronized.
cc::DeadlinePolicy deadline =
......@@ -849,15 +830,6 @@ bool BrowserPlugin::HandleMouseLockedInputEvent(
}
#if defined(USE_AURA)
void BrowserPlugin::OnMusEmbeddedFrameSurfaceChanged(
const viz::SurfaceInfo& surface_info) {
if (!attached_)
return;
compositing_helper_->SetFallbackSurfaceId(surface_info.id(),
screen_space_rect().size());
}
void BrowserPlugin::OnMusEmbeddedFrameSinkIdAllocated(
const viz::FrameSinkId& frame_sink_id) {
// RendererWindowTreeClient should only call this when mus is hosting viz.
......
......@@ -204,8 +204,6 @@ class CONTENT_EXPORT BrowserPlugin : public blink::WebPlugin,
const gfx::Size& min_size,
const gfx::Size& max_size);
void OnDisableAutoResize(int browser_plugin_instance_id);
void OnFirstSurfaceActivation(int instance_id,
const viz::SurfaceInfo& surface_info);
void OnSetContentsOpaque(int instance_id, bool opaque);
void OnSetCursor(int instance_id, const WebCursor& cursor);
void OnSetMouseLock(int instance_id, bool enable);
......@@ -218,7 +216,7 @@ class CONTENT_EXPORT BrowserPlugin : public blink::WebPlugin,
#if defined(USE_AURA)
// MusEmbeddedFrameDelegate
void OnMusEmbeddedFrameSurfaceChanged(
const viz::SurfaceInfo& surface_info) override;
const viz::SurfaceInfo& surface_info) override {}
void OnMusEmbeddedFrameSinkIdAllocated(
const viz::FrameSinkId& frame_sink_id) override;
#endif
......@@ -263,8 +261,6 @@ class CONTENT_EXPORT BrowserPlugin : public blink::WebPlugin,
viz::FrameSinkId frame_sink_id_;
viz::ParentLocalSurfaceIdAllocator parent_local_surface_id_allocator_;
bool enable_surface_synchronization_ = false;
// The last ResizeParams sent to the browser process, if any.
base::Optional<FrameVisualProperties> sent_visual_properties_;
......
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