0

content: removes support for mash from content/browser

As we no longer intend to ship the mash, this code is no longer applicable.

BUG=958121
TEST=covered by tests

Change-Id: I890de497c7e77b4a86b96437e268022049ac4273
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1595077
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#656865}
This commit is contained in:
Scott Violet
2019-05-06 17:57:23 +00:00
committed by Commit Bot
parent bbe230d3e4
commit 103df1a15e
20 changed files with 26 additions and 333 deletions

@@ -703,7 +703,7 @@ void BrowserPluginGuest::RenderViewReady() {
// In case we've created a new guest render process after a crash, let the // In case we've created a new guest render process after a crash, let the
// associated BrowserPlugin know. We only need to send this if we're attached, // associated BrowserPlugin know. We only need to send this if we're attached,
// as guest_crashed_ is cleared automatically on attach anyways. // as guest_crashed_ is cleared automatically on attach anyways.
if (attached() && !features::IsMultiProcessMash()) { if (attached()) {
RenderWidgetHostViewGuest* rwhv = static_cast<RenderWidgetHostViewGuest*>( RenderWidgetHostViewGuest* rwhv = static_cast<RenderWidgetHostViewGuest*>(
web_contents()->GetRenderWidgetHostView()); web_contents()->GetRenderWidgetHostView());
if (rwhv) { if (rwhv) {

@@ -66,7 +66,6 @@
#include "gpu/vulkan/buildflags.h" #include "gpu/vulkan/buildflags.h"
#include "services/ws/public/cpp/gpu/context_provider_command_buffer.h" #include "services/ws/public/cpp/gpu/context_provider_command_buffer.h"
#include "third_party/khronos/GLES2/gl2.h" #include "third_party/khronos/GLES2/gl2.h"
#include "ui/base/ui_base_features.h"
#include "ui/base/ui_base_switches_util.h" #include "ui/base/ui_base_switches_util.h"
#include "ui/compositor/compositor.h" #include "ui/compositor/compositor.h"
#include "ui/compositor/host/external_begin_frame_controller_client_impl.h" #include "ui/compositor/host/external_begin_frame_controller_client_impl.h"
@@ -218,13 +217,6 @@ GpuProcessTransportFactory::CreateSoftwareOutputDevice(
if (command_line->HasSwitch(switches::kHeadless)) if (command_line->HasSwitch(switches::kHeadless))
return base::WrapUnique(new viz::SoftwareOutputDevice); return base::WrapUnique(new viz::SoftwareOutputDevice);
#if defined(USE_AURA)
if (features::IsMultiProcessMash()) {
NOTREACHED();
return nullptr;
}
#endif
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
#if defined(OS_WIN) #if defined(OS_WIN)
return CreateSoftwareOutputDeviceWinBrowser(widget, software_backing_.get()); return CreateSoftwareOutputDeviceWinBrowser(widget, software_backing_.get());

@@ -471,22 +471,6 @@ bool CrossProcessFrameConnector::IsHidden() const {
return visibility_ == blink::mojom::FrameVisibility::kNotRendered; return visibility_ == blink::mojom::FrameVisibility::kNotRendered;
} }
#if defined(USE_AURA)
void CrossProcessFrameConnector::EmbedRendererWindowTreeClientInParent(
ws::mojom::WindowTreeClientPtr window_tree_client) {
RenderWidgetHostViewBase* root = GetRootRenderWidgetHostView();
RenderWidgetHostViewBase* parent = GetParentRenderWidgetHostView();
if (!parent || !root)
return;
const int frame_routing_id = frame_proxy_in_parent_renderer_->GetRoutingID();
parent->EmbedChildFrameRendererWindowTreeClient(
root, frame_routing_id, std::move(window_tree_client));
frame_proxy_in_parent_renderer_->SetDestructionCallback(
base::BindOnce(&RenderWidgetHostViewBase::OnChildFrameDestroyed,
parent->GetWeakPtr(), frame_routing_id));
}
#endif
void CrossProcessFrameConnector::DidUpdateVisualProperties( void CrossProcessFrameConnector::DidUpdateVisualProperties(
const cc::RenderFrameMetadata& metadata) { const cc::RenderFrameMetadata& metadata) {
frame_proxy_in_parent_renderer_->Send(new FrameMsg_DidUpdateVisualProperties( frame_proxy_in_parent_renderer_->Send(new FrameMsg_DidUpdateVisualProperties(

@@ -111,10 +111,6 @@ class CONTENT_EXPORT CrossProcessFrameConnector
bool IsHidden() const override; bool IsHidden() const override;
bool IsThrottled() const override; bool IsThrottled() const override;
bool IsSubtreeThrottled() const override; bool IsSubtreeThrottled() const override;
#if defined(USE_AURA)
void EmbedRendererWindowTreeClientInParent(
ws::mojom::WindowTreeClientPtr window_tree_client) override;
#endif
void DidUpdateVisualProperties( void DidUpdateVisualProperties(
const cc::RenderFrameMetadata& metadata) override; const cc::RenderFrameMetadata& metadata) override;

@@ -37,7 +37,6 @@
#include "gpu/ipc/common/gpu_client_ids.h" #include "gpu/ipc/common/gpu_client_ids.h"
#include "gpu/ipc/in_process_command_buffer.h" #include "gpu/ipc/in_process_command_buffer.h"
#include "services/resource_coordinator/public/mojom/memory_instrumentation/constants.mojom.h" #include "services/resource_coordinator/public/mojom/memory_instrumentation/constants.mojom.h"
#include "ui/base/ui_base_features.h"
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
#include "ui/accelerated_widget_mac/window_resize_helper_mac.h" #include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
@@ -304,9 +303,6 @@ BrowserGpuChannelHostFactory::~BrowserGpuChannelHostFactory() {
void BrowserGpuChannelHostFactory::EstablishGpuChannel( void BrowserGpuChannelHostFactory::EstablishGpuChannel(
gpu::GpuChannelEstablishedCallback callback) { gpu::GpuChannelEstablishedCallback callback) {
#if defined(USE_AURA)
DCHECK(!features::IsMultiProcessMash());
#endif
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (gpu_channel_.get() && gpu_channel_->IsLost()) { if (gpu_channel_.get() && gpu_channel_->IsLost()) {
DCHECK(!pending_request_.get()); DCHECK(!pending_request_.get());

@@ -35,7 +35,6 @@
#include "gpu/config/gpu_switches.h" #include "gpu/config/gpu_switches.h"
#include "gpu/ipc/host/gpu_memory_buffer_support.h" #include "gpu/ipc/host/gpu_memory_buffer_support.h"
#include "media/media_buildflags.h" #include "media/media_buildflags.h"
#include "ui/base/ui_base_features.h"
#include "ui/gl/gl_switches.h" #include "ui/gl/gl_switches.h"
namespace content { namespace content {
@@ -79,8 +78,6 @@ gpu::GpuFeatureStatus SafeGetFeatureStatus(
gpu::GpuFeatureStatus GetGpuCompositingStatus( gpu::GpuFeatureStatus GetGpuCompositingStatus(
const gpu::GpuFeatureInfo& gpu_feature_info, const gpu::GpuFeatureInfo& gpu_feature_info,
GpuFeatureInfoType type) { GpuFeatureInfoType type) {
if (features::IsMultiProcessMash())
return gpu::kGpuFeatureStatusEnabled;
gpu::GpuFeatureStatus status = SafeGetFeatureStatus( gpu::GpuFeatureStatus status = SafeGetFeatureStatus(
gpu_feature_info, gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING); gpu_feature_info, gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING);
#if defined(USE_AURA) || defined(OS_MACOSX) #if defined(USE_AURA) || defined(OS_MACOSX)

@@ -75,7 +75,6 @@
#include "services/service_manager/public/cpp/interface_provider.h" #include "services/service_manager/public/cpp/interface_provider.h"
#include "services/service_manager/sandbox/sandbox_type.h" #include "services/service_manager/sandbox/sandbox_type.h"
#include "services/service_manager/sandbox/switches.h" #include "services/service_manager/sandbox/switches.h"
#include "services/ws/public/mojom/constants.mojom.h"
#include "ui/base/ui_base_features.h" #include "ui/base/ui_base_features.h"
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
#include "ui/display/display_switches.h" #include "ui/display/display_switches.h"
@@ -463,14 +462,6 @@ void BindDiscardableMemoryRequestOnIO(
void BindDiscardableMemoryRequestOnUI( void BindDiscardableMemoryRequestOnUI(
discardable_memory::mojom::DiscardableSharedMemoryManagerRequest request) { discardable_memory::mojom::DiscardableSharedMemoryManagerRequest request) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
#if defined(USE_AURA)
if (features::IsMultiProcessMash()) {
ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface(
ws::mojom::kServiceName, std::move(request));
return;
}
#endif
base::PostTaskWithTraits( base::PostTaskWithTraits(
FROM_HERE, {BrowserThread::IO}, FROM_HERE, {BrowserThread::IO},
base::BindOnce( base::BindOnce(

@@ -22,7 +22,6 @@
#include "gpu/config/gpu_switches.h" #include "gpu/config/gpu_switches.h"
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "ui/base/ui_base_features.h"
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
#include "ui/compositor/compositor_switches.h" #include "ui/compositor/compositor_switches.h"
#include "ui/gl/gl_switches.h" #include "ui/gl/gl_switches.h"
@@ -37,10 +36,7 @@ class OOPBrowserTest : public ContentBrowserTest {
command_line->AppendSwitch(switches::kEnableGpuRasterization); command_line->AppendSwitch(switches::kEnableGpuRasterization);
command_line->AppendSwitch(switches::kEnablePixelOutputInTests); command_line->AppendSwitch(switches::kEnablePixelOutputInTests);
command_line->AppendSwitch(switches::kEnableOopRasterization); command_line->AppendSwitch(switches::kEnableOopRasterization);
command_line->AppendSwitch(switches::kUseGpuInTests);
const bool use_gpu_in_tests = !features::IsMultiProcessMash();
if (use_gpu_in_tests)
command_line->AppendSwitch(switches::kUseGpuInTests);
} }
void VerifyVisualStateUpdated(const base::Closure& done_cb, void VerifyVisualStateUpdated(const base::Closure& done_cb,

@@ -38,9 +38,6 @@ void FrameConnectorDelegate::SynchronizeVisualProperties(
if (!view_) if (!view_)
return; return;
#if defined(USE_AURA)
view_->SetFrameSinkId(frame_sink_id);
#endif // defined(USE_AURA)
RenderWidgetHostImpl* render_widget_host = view_->host(); RenderWidgetHostImpl* render_widget_host = view_->host();
DCHECK(render_widget_host); DCHECK(render_widget_host);

@@ -216,7 +216,6 @@
#include "third_party/blink/public/public_buildflags.h" #include "third_party/blink/public/public_buildflags.h"
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
#include "ui/accessibility/accessibility_switches.h" #include "ui/accessibility/accessibility_switches.h"
#include "ui/base/ui_base_features.h"
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
#include "ui/base/ui_base_switches_util.h" #include "ui/base/ui_base_switches_util.h"
#include "ui/display/display_switches.h" #include "ui/display/display_switches.h"
@@ -1545,14 +1544,12 @@ RenderProcessHostImpl::RenderProcessHostImpl(
InitializeChannelProxy(); InitializeChannelProxy();
if (!features::IsMultiProcessMash()) { const int id = GetID();
const int id = GetID(); const uint64_t tracing_id =
const uint64_t tracing_id = ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId(id);
ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId(id); gpu_client_.reset(new viz::GpuClient(
gpu_client_.reset(new viz::GpuClient( std::make_unique<BrowserGpuClientDelegate>(), id, tracing_id,
std::make_unique<BrowserGpuClientDelegate>(), id, tracing_id, base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO})));
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO})));
}
} }
// static // static

@@ -25,7 +25,6 @@
#include "content/test/test_render_view_host.h" #include "content/test/test_render_view_host.h"
#include "services/viz/public/interfaces/hit_test/input_target_client.mojom.h" #include "services/viz/public/interfaces/hit_test/input_target_client.mojom.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/ui_base_features.h"
namespace content { namespace content {
@@ -266,11 +265,8 @@ class RenderWidgetHostInputEventRouterTest : public testing::Test {
child.view.get(), parent_view, view_root_.get(), child.view.get(), parent_view, view_root_.get(),
false /* use_zoom_for_device_scale_factor */); false /* use_zoom_for_device_scale_factor */);
// This check often fails in Mash. https://crbug.com/933876 EXPECT_EQ(child.view.get(),
if (!features::IsMultiProcessMash()) { rwhier()->FindViewFromFrameSinkId(child.view->GetFrameSinkId()));
EXPECT_EQ(child.view.get(), rwhier()->FindViewFromFrameSinkId(
child.view->GetFrameSinkId()));
}
return child; return child;
} }

@@ -23,7 +23,6 @@
#include "components/viz/common/frame_sinks/copy_output_request.h" #include "components/viz/common/frame_sinks/copy_output_request.h"
#include "components/viz/common/frame_sinks/copy_output_result.h" #include "components/viz/common/frame_sinks/copy_output_result.h"
#include "components/viz/common/surfaces/local_surface_id_allocation.h" #include "components/viz/common/surfaces/local_surface_id_allocation.h"
#include "components/viz/host/host_frame_sink_manager.h"
#include "content/browser/accessibility/browser_accessibility_manager.h" #include "content/browser/accessibility/browser_accessibility_manager.h"
#include "content/browser/accessibility/browser_accessibility_state_impl.h" #include "content/browser/accessibility/browser_accessibility_state_impl.h"
#include "content/browser/bad_message.h" #include "content/browser/bad_message.h"
@@ -47,7 +46,6 @@
#include "content/browser/renderer_host/render_widget_host_view_event_handler.h" #include "content/browser/renderer_host/render_widget_host_view_event_handler.h"
#include "content/browser/renderer_host/ui_events_helper.h" #include "content/browser/renderer_host/ui_events_helper.h"
#include "content/common/input_messages.h" #include "content/common/input_messages.h"
#include "content/common/render_widget_window_tree_client_factory.mojom.h"
#include "content/common/text_input_state.h" #include "content/common/text_input_state.h"
#include "content/common/view_messages.h" #include "content/common/view_messages.h"
#include "content/public/browser/content_browser_client.h" #include "content/public/browser/content_browser_client.h"
@@ -56,8 +54,6 @@
#include "content/public/common/use_zoom_for_dsf_policy.h" #include "content/public/common/use_zoom_for_dsf_policy.h"
#include "gpu/ipc/common/gpu_messages.h" #include "gpu/ipc/common/gpu_messages.h"
#include "services/service_manager/public/cpp/interface_provider.h" #include "services/service_manager/public/cpp/interface_provider.h"
#include "services/ws/common/switches.h"
#include "services/ws/public/mojom/window_tree_constants.mojom.h"
#include "third_party/blink/public/platform/web_input_event.h" #include "third_party/blink/public/platform/web_input_event.h"
#include "third_party/blink/public/web/web_ime_text_span.h" #include "third_party/blink/public/web/web_ime_text_span.h"
#include "ui/accessibility/accessibility_switches.h" #include "ui/accessibility/accessibility_switches.h"
@@ -71,7 +67,6 @@
#include "ui/aura/client/transient_window_client.h" #include "ui/aura/client/transient_window_client.h"
#include "ui/aura/client/window_parenting_client.h" #include "ui/aura/client/window_parenting_client.h"
#include "ui/aura/env.h" #include "ui/aura/env.h"
#include "ui/aura/mus/window_port_mus.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h" #include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_observer.h" #include "ui/aura/window_observer.h"
@@ -79,7 +74,6 @@
#include "ui/base/clipboard/scoped_clipboard_writer.h" #include "ui/base/clipboard/scoped_clipboard_writer.h"
#include "ui/base/hit_test.h" #include "ui/base/hit_test.h"
#include "ui/base/ime/input_method.h" #include "ui/base/ime/input_method.h"
#include "ui/base/ui_base_features.h"
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
#include "ui/base/ui_base_switches_util.h" #include "ui/base/ui_base_switches_util.h"
#include "ui/base/ui_base_types.h" #include "ui/base/ui_base_types.h"
@@ -145,16 +139,6 @@ using blink::WebTouchEvent;
namespace content { namespace content {
namespace {
// Callback from embedding the renderer.
void EmbedCallback(bool result) {
if (!result)
DVLOG(1) << "embed failed";
}
} // namespace
#if defined(OS_WIN) #if defined(OS_WIN)
// This class implements the ui::InputMethodKeyboardControllerObserver interface // This class implements the ui::InputMethodKeyboardControllerObserver interface
@@ -369,11 +353,8 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(
is_guest_view_hack_(is_guest_view_hack), is_guest_view_hack_(is_guest_view_hack),
device_scale_factor_(0.0f), device_scale_factor_(0.0f),
event_handler_(new RenderWidgetHostViewEventHandler(host(), this, this)), event_handler_(new RenderWidgetHostViewEventHandler(host(), this, this)),
frame_sink_id_(features::IsMultiProcessMash() frame_sink_id_(is_guest_view_hack_ ? AllocateFrameSinkIdForGuestViewHack()
? viz::FrameSinkId() : host()->GetFrameSinkId()),
: is_guest_view_hack_
? AllocateFrameSinkIdForGuestViewHack()
: host()->GetFrameSinkId()),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
if (!is_mus_browser_plugin_guest_) if (!is_mus_browser_plugin_guest_)
CreateDelegatedFrameHostClient(); CreateDelegatedFrameHostClient();
@@ -956,20 +937,6 @@ void RenderWidgetHostViewAura::TransformPointToRootSurface(gfx::PointF* point) {
aura::Window* root = window_->GetRootWindow(); aura::Window* root = window_->GetRootWindow();
aura::Window::ConvertPointToTarget(window_, root, point); aura::Window::ConvertPointToTarget(window_, root, point);
root->GetRootWindow()->transform().TransformPoint(point); root->GetRootWindow()->transform().TransformPoint(point);
// On ChromeOS, the root surface is the whole desktop. When using the
// window-service converting to screen coordinates gives us that.
#if defined(OS_CHROMEOS)
if (features::IsUsingWindowService()) {
aura::client::ScreenPositionClient* screen_client =
aura::client::GetScreenPositionClient(root);
if (screen_client) {
gfx::Point rounded_point(point->x(), point->y());
screen_client->ConvertPointToScreen(root, &rounded_point);
*point = gfx::PointF(rounded_point);
}
}
#endif
} }
gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() {
@@ -1822,14 +1789,6 @@ viz::FrameSinkId RenderWidgetHostViewAura::GetRootFrameSinkId() {
if (!window_ || !window_->GetHost() || !window_->GetHost()->compositor()) if (!window_ || !window_->GetHost() || !window_->GetHost()->compositor())
return viz::FrameSinkId(); return viz::FrameSinkId();
// In single-process mash the root is provided by Ash. Have
// HostFrameSinkManager walk the tree to find the right root.
if (features::IsSingleProcessMash()) {
base::Optional<viz::FrameSinkId> root =
GetHostFrameSinkManager()->FindRootFrameSinkId(frame_sink_id_);
return root ? *root : viz::FrameSinkId();
}
return window_->GetHost()->compositor()->frame_sink_id(); return window_->GetHost()->compositor()->frame_sink_id();
} }
@@ -1871,14 +1830,6 @@ void RenderWidgetHostViewAura::FocusedNodeChanged(
#endif #endif
} }
void RenderWidgetHostViewAura::ScheduleEmbed(
ws::mojom::WindowTreeClientPtr client,
base::OnceCallback<void(const base::UnguessableToken&)> callback) {
DCHECK(features::IsMultiProcessMash());
aura::Env::GetInstance()->ScheduleEmbed(std::move(client),
std::move(callback));
}
void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) { void RenderWidgetHostViewAura::OnScrollEvent(ui::ScrollEvent* event) {
event_handler_->OnScrollEvent(event); event_handler_->OnScrollEvent(event);
} }
@@ -2108,18 +2059,6 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) {
// Init(), because it needs to have the layer. // Init(), because it needs to have the layer.
if (frame_sink_id_.is_valid()) if (frame_sink_id_.is_valid())
window_->SetEmbedFrameSinkId(frame_sink_id_); window_->SetEmbedFrameSinkId(frame_sink_id_);
if (!features::IsMultiProcessMash())
return;
// Embed the renderer into the Window.
// Use kEmbedFlagEmbedderControlsVisibility so that the renderer can't change
// the visibility of |window_|.
aura::WindowPortMus::Get(window_)->Embed(
GetWindowTreeClientFromRenderer(),
ws::mojom::kEmbedFlagEmbedderInterceptsEvents |
ws::mojom::kEmbedFlagEmbedderControlsVisibility,
base::BindOnce(&EmbedCallback));
} }
void RenderWidgetHostViewAura::CreateDelegatedFrameHostClient() { void RenderWidgetHostViewAura::CreateDelegatedFrameHostClient() {

@@ -194,12 +194,8 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
gfx::PointF* transformed_point) override; gfx::PointF* transformed_point) override;
viz::FrameSinkId GetRootFrameSinkId() override; viz::FrameSinkId GetRootFrameSinkId() override;
viz::SurfaceId GetCurrentSurfaceId() const override; viz::SurfaceId GetCurrentSurfaceId() const override;
void FocusedNodeChanged(bool is_editable_node, void FocusedNodeChanged(bool is_editable_node,
const gfx::Rect& node_bounds_in_screen) override; const gfx::Rect& node_bounds_in_screen) override;
void ScheduleEmbed(ws::mojom::WindowTreeClientPtr client,
base::OnceCallback<void(const base::UnguessableToken&)>
callback) override;
void OnSynchronizedDisplayPropertiesChanged() override; void OnSynchronizedDisplayPropertiesChanged() override;
viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties( viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties(
const cc::RenderFrameMetadata& metadata) override; const cc::RenderFrameMetadata& metadata) override;

@@ -41,11 +41,6 @@
#include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/geometry/size_f.h" #include "ui/gfx/geometry/size_f.h"
#if defined(USE_AURA)
#include "base/unguessable_token.h"
#include "content/common/render_widget_window_tree_client_factory.mojom.h"
#endif
namespace content { namespace content {
RenderWidgetHostViewBase::RenderWidgetHostViewBase(RenderWidgetHost* host) RenderWidgetHostViewBase::RenderWidgetHostViewBase(RenderWidgetHost* host)
@@ -840,74 +835,11 @@ base::TimeTicks RenderWidgetHostViewBase::GetAndResetLastTabChangeStartTime() {
return stored_time; return stored_time;
} }
#if defined(USE_AURA)
void RenderWidgetHostViewBase::EmbedChildFrameRendererWindowTreeClient(
RenderWidgetHostViewBase* root_view,
int routing_id,
ws::mojom::WindowTreeClientPtr renderer_window_tree_client) {
RenderWidgetHost* render_widget_host = GetRenderWidgetHost();
if (!render_widget_host)
return;
const int embed_id = ++next_embed_id_;
pending_embeds_[routing_id] = embed_id;
root_view->ScheduleEmbed(
std::move(renderer_window_tree_client),
base::BindOnce(&RenderWidgetHostViewBase::OnDidScheduleEmbed,
GetWeakPtr(), routing_id, embed_id));
}
void RenderWidgetHostViewBase::OnChildFrameDestroyed(int routing_id) {
pending_embeds_.erase(routing_id);
// Tests may not create |render_widget_window_tree_client_| (tests don't
// necessarily create RenderWidgetHostViewAura).
if (render_widget_window_tree_client_)
render_widget_window_tree_client_->DestroyFrame(routing_id);
}
#endif
void RenderWidgetHostViewBase::SynchronizeVisualProperties() { void RenderWidgetHostViewBase::SynchronizeVisualProperties() {
if (host()) if (host())
host()->SynchronizeVisualProperties(); host()->SynchronizeVisualProperties();
} }
#if defined(USE_AURA)
void RenderWidgetHostViewBase::OnDidScheduleEmbed(
int routing_id,
int embed_id,
const base::UnguessableToken& token) {
auto iter = pending_embeds_.find(routing_id);
if (iter == pending_embeds_.end() || iter->second != embed_id)
return;
pending_embeds_.erase(iter);
// Tests may not create |render_widget_window_tree_client_| (tests don't
// necessarily create RenderWidgetHostViewAura).
if (render_widget_window_tree_client_)
render_widget_window_tree_client_->Embed(routing_id, token);
}
void RenderWidgetHostViewBase::ScheduleEmbed(
ws::mojom::WindowTreeClientPtr client,
base::OnceCallback<void(const base::UnguessableToken&)> callback) {
NOTREACHED();
}
ws::mojom::WindowTreeClientPtr
RenderWidgetHostViewBase::GetWindowTreeClientFromRenderer() {
// NOTE: this function may be called multiple times.
RenderWidgetHost* render_widget_host = GetRenderWidgetHost();
mojom::RenderWidgetWindowTreeClientFactoryPtr factory;
BindInterface(render_widget_host->GetProcess(), &factory);
ws::mojom::WindowTreeClientPtr window_tree_client;
factory->CreateWindowTreeClientForRenderWidget(
render_widget_host->GetRoutingID(),
mojo::MakeRequest(&window_tree_client),
mojo::MakeRequest(&render_widget_window_tree_client_));
return window_tree_client;
}
#endif
void RenderWidgetHostViewBase::DidNavigate() { void RenderWidgetHostViewBase::DidNavigate() {
if (host()) if (host())
host()->SynchronizeVisualProperties(); host()->SynchronizeVisualProperties();

@@ -44,18 +44,8 @@
#include "ui/gfx/range/range.h" #include "ui/gfx/range/range.h"
#include "ui/surface/transport_dib.h" #include "ui/surface/transport_dib.h"
#if defined(USE_AURA)
#include "base/containers/flat_map.h"
#include "content/common/render_widget_window_tree_client_factory.mojom.h"
#include "services/ws/public/mojom/window_tree.mojom.h"
#endif
struct WidgetHostMsg_SelectionBounds_Params; struct WidgetHostMsg_SelectionBounds_Params;
namespace base {
class UnguessableToken;
}
namespace cc { namespace cc {
struct BeginFrameAck; struct BeginFrameAck;
} // namespace cc } // namespace cc
@@ -582,14 +572,6 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
return is_currently_scrolling_viewport_; return is_currently_scrolling_viewport_;
} }
#if defined(USE_AURA)
void EmbedChildFrameRendererWindowTreeClient(
RenderWidgetHostViewBase* root_view,
int routing_id,
ws::mojom::WindowTreeClientPtr renderer_window_tree_client);
void OnChildFrameDestroyed(int routing_id);
#endif
virtual void DidNavigate(); virtual void DidNavigate();
// Called when the RenderWidgetHostImpl has be initialized. // Called when the RenderWidgetHostImpl has be initialized.
@@ -620,14 +602,6 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
virtual void StopFlingingIfNecessary(const blink::WebGestureEvent& event, virtual void StopFlingingIfNecessary(const blink::WebGestureEvent& event,
InputEventAckState ack_result); InputEventAckState ack_result);
#if defined(USE_AURA)
virtual void ScheduleEmbed(
ws::mojom::WindowTreeClientPtr client,
base::OnceCallback<void(const base::UnguessableToken&)> callback);
ws::mojom::WindowTreeClientPtr GetWindowTreeClientFromRenderer();
#endif
// If |event| is a touchpad pinch or double tap event for which we've sent a // If |event| is a touchpad pinch or double tap event for which we've sent a
// synthetic wheel event, forward the |event| to the renderer, subject to // synthetic wheel event, forward the |event| to the renderer, subject to
// |ack_result| which is the ACK result of the synthetic wheel. // |ack_result| which is the ACK result of the synthetic wheel.
@@ -694,12 +668,6 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
void SynchronizeVisualProperties(); void SynchronizeVisualProperties();
#if defined(USE_AURA)
void OnDidScheduleEmbed(int routing_id,
int embed_id,
const base::UnguessableToken& token);
#endif
// Called when display properties that need to be synchronized with the // Called when display properties that need to be synchronized with the
// renderer process changes. This method is called before notifying // renderer process changes. This method is called before notifying
// RenderWidgetHostImpl in order to allow the view to allocate a new // RenderWidgetHostImpl in order to allow the view to allocate a new
@@ -731,18 +699,6 @@ class CONTENT_EXPORT RenderWidgetHostViewBase
base::ObserverList<RenderWidgetHostViewBaseObserver>::Unchecked observers_; base::ObserverList<RenderWidgetHostViewBaseObserver>::Unchecked observers_;
#if defined(USE_AURA)
mojom::RenderWidgetWindowTreeClientPtr render_widget_window_tree_client_;
int next_embed_id_ = 0;
// Maps from routing_id to embed-id. The |routing_id| is the id supplied to
// EmbedChildFrameRendererWindowTreeClient() and the embed-id a unique id
// generate at the time EmbedChildFrameRendererWindowTreeClient() was called.
// This is done to ensure when OnDidScheduleEmbed() is received another call
// too EmbedChildFrameRendererWindowTreeClient() did not come in.
base::flat_map<int, int> pending_embeds_;
#endif
base::Optional<blink::WebGestureEvent> pending_touchpad_pinch_begin_; base::Optional<blink::WebGestureEvent> pending_touchpad_pinch_begin_;
// The last tab switch processing start time. This should only be set and // The last tab switch processing start time. This should only be set and

@@ -43,17 +43,11 @@
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
#include "gpu/ipc/common/gpu_messages.h" #include "gpu/ipc/common/gpu_messages.h"
#include "third_party/blink/public/platform/web_touch_event.h" #include "third_party/blink/public/platform/web_touch_event.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/geometry/dip_util.h" #include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/geometry/size_f.h" #include "ui/gfx/geometry/size_f.h"
#include "ui/touch_selection/touch_selection_controller.h" #include "ui/touch_selection/touch_selection_controller.h"
#if defined(USE_AURA)
#include "services/ws/public/mojom/window_tree.mojom.h"
#include "ui/aura/env.h"
#endif
namespace content { namespace content {
// static // static
@@ -76,20 +70,14 @@ RenderWidgetHostViewChildFrame::RenderWidgetHostViewChildFrame(
enable_surface_synchronization_( enable_surface_synchronization_(
features::IsSurfaceSynchronizationEnabled()), features::IsSurfaceSynchronizationEnabled()),
weak_factory_(this) { weak_factory_(this) {
if (features::IsMultiProcessMash()) { GetHostFrameSinkManager()->RegisterFrameSinkId(
// In Mus the RenderFrameProxy will eventually assign a viz::FrameSinkId frame_sink_id_, this,
// until then set ours invalid, as operations using it will be disregarded. enable_surface_synchronization_
frame_sink_id_ = viz::FrameSinkId(); ? viz::ReportFirstSurfaceActivation::kNo
} else { : viz::ReportFirstSurfaceActivation::kYes);
GetHostFrameSinkManager()->RegisterFrameSinkId( GetHostFrameSinkManager()->SetFrameSinkDebugLabel(
frame_sink_id_, this, frame_sink_id_, "RenderWidgetHostViewChildFrame");
enable_surface_synchronization_ CreateCompositorFrameSinkSupport();
? viz::ReportFirstSurfaceActivation::kNo
: viz::ReportFirstSurfaceActivation::kYes);
GetHostFrameSinkManager()->SetFrameSinkDebugLabel(
frame_sink_id_, "RenderWidgetHostViewChildFrame");
CreateCompositorFrameSinkSupport();
}
} }
RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() { RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() {
@@ -99,11 +87,9 @@ RenderWidgetHostViewChildFrame::~RenderWidgetHostViewChildFrame() {
if (frame_connector_) if (frame_connector_)
DetachFromTouchSelectionClientManagerIfNecessary(); DetachFromTouchSelectionClientManagerIfNecessary();
if (!features::IsMultiProcessMash()) { ResetCompositorFrameSinkSupport();
ResetCompositorFrameSinkSupport(); if (GetHostFrameSinkManager())
if (GetHostFrameSinkManager()) GetHostFrameSinkManager()->InvalidateFrameSinkId(frame_sink_id_);
GetHostFrameSinkManager()->InvalidateFrameSinkId(frame_sink_id_);
}
} }
void RenderWidgetHostViewChildFrame::Init() { void RenderWidgetHostViewChildFrame::Init() {
@@ -152,8 +138,7 @@ void RenderWidgetHostViewChildFrame::SetFrameConnectorDelegate(
frame_connector_->GetParentRenderWidgetHostView(); frame_connector_->GetParentRenderWidgetHostView();
if (parent_view) { if (parent_view) {
DCHECK(parent_view->GetFrameSinkId().is_valid() || DCHECK(parent_view->GetFrameSinkId().is_valid());
features::IsMultiProcessMash());
SetParentFrameSinkId(parent_view->GetFrameSinkId()); SetParentFrameSinkId(parent_view->GetFrameSinkId());
} }
@@ -173,24 +158,9 @@ void RenderWidgetHostViewChildFrame::SetFrameConnectorDelegate(
} }
} }
#if defined(USE_AURA)
if (features::IsMultiProcessMash()) {
frame_connector_->EmbedRendererWindowTreeClientInParent(
GetWindowTreeClientFromRenderer());
}
#endif
SendSurfaceInfoToEmbedder(); SendSurfaceInfoToEmbedder();
} }
#if defined(USE_AURA)
void RenderWidgetHostViewChildFrame::SetFrameSinkId(
const viz::FrameSinkId& frame_sink_id) {
if (features::IsMultiProcessMash())
frame_sink_id_ = frame_sink_id;
}
#endif // defined(USE_AURA)
void RenderWidgetHostViewChildFrame::UpdateIntrinsicSizingInfo( void RenderWidgetHostViewChildFrame::UpdateIntrinsicSizingInfo(
const blink::WebIntrinsicSizingInfo& sizing_info) { const blink::WebIntrinsicSizingInfo& sizing_info) {
if (frame_connector_) if (frame_connector_)
@@ -601,8 +571,7 @@ void RenderWidgetHostViewChildFrame::DidCreateNewRendererCompositorFrameSink(
void RenderWidgetHostViewChildFrame::SetParentFrameSinkId( void RenderWidgetHostViewChildFrame::SetParentFrameSinkId(
const viz::FrameSinkId& parent_frame_sink_id) { const viz::FrameSinkId& parent_frame_sink_id) {
if (parent_frame_sink_id_ == parent_frame_sink_id || if (parent_frame_sink_id_ == parent_frame_sink_id)
features::IsMultiProcessMash())
return; return;
auto* host_frame_sink_manager = GetHostFrameSinkManager(); auto* host_frame_sink_manager = GetHostFrameSinkManager();
@@ -623,8 +592,6 @@ void RenderWidgetHostViewChildFrame::SetParentFrameSinkId(
} }
void RenderWidgetHostViewChildFrame::SendSurfaceInfoToEmbedder() { void RenderWidgetHostViewChildFrame::SendSurfaceInfoToEmbedder() {
if (features::IsMultiProcessMash())
return;
if (enable_surface_synchronization_) if (enable_surface_synchronization_)
return; return;
if (!last_activated_surface_info_.is_valid()) if (!last_activated_surface_info_.is_valid())
@@ -1065,7 +1032,7 @@ RenderWidgetHostViewChildFrame::DidUpdateVisualProperties(
} }
void RenderWidgetHostViewChildFrame::CreateCompositorFrameSinkSupport() { void RenderWidgetHostViewChildFrame::CreateCompositorFrameSinkSupport() {
if (features::IsMultiProcessMash() || enable_viz_) if (enable_viz_)
return; return;
DCHECK(!support_); DCHECK(!support_);

@@ -63,12 +63,6 @@ class CONTENT_EXPORT RenderWidgetHostViewChildFrame
void SetFrameConnectorDelegate(FrameConnectorDelegate* frame_connector); void SetFrameConnectorDelegate(FrameConnectorDelegate* frame_connector);
#if defined(USE_AURA)
// When the viz::FrameSinkId for this child frame is created and registered
// remotely, it can be set here.
void SetFrameSinkId(const viz::FrameSinkId& frame_sink_id);
#endif // defined(USE_AURA)
// This functions registers single-use callbacks that want to be notified when // This functions registers single-use callbacks that want to be notified when
// the next frame is swapped. The callback is triggered by // the next frame is swapped. The callback is triggered by
// SubmitCompositorFrame, which is the appropriate time to request pixel // SubmitCompositorFrame, which is the appropriate time to request pixel

@@ -487,7 +487,6 @@ mojom("mojo_bindings") {
"render_frame_message_filter.mojom", "render_frame_message_filter.mojom",
"render_frame_metadata.mojom", "render_frame_metadata.mojom",
"render_message_filter.mojom", "render_message_filter.mojom",
"render_widget_window_tree_client_factory.mojom",
"renderer.mojom", "renderer.mojom",
"renderer_host.mojom", "renderer_host.mojom",
"widget.mojom", "widget.mojom",

@@ -1,27 +0,0 @@
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module content.mojom;
import "mojo/public/mojom/base/unguessable_token.mojom";
import "services/ws/public/mojom/window_tree.mojom";
interface RenderWidgetWindowTreeClient {
// Asks the renderer to create a Window for the frame with the routing id
// |routing_id| and embeds the WindowTreeClient that was previously supplied
// to ScheduleEmbed().
Embed(uint32 frame_routing_id, mojo_base.mojom.UnguessableToken token);
// Called when a render frame has been destroyed. This is sent via mojom
// to handle to ensure there aren't race conditions because of message order
// delivery.
DestroyFrame(uint32 frame_routing_id);
};
interface RenderWidgetWindowTreeClientFactory {
CreateWindowTreeClientForRenderWidget(
uint32 render_widget_host_routing_id,
ws.mojom.WindowTreeClient& window_tree_client,
RenderWidgetWindowTreeClient& render_widget_window_tree_client_request);
};

@@ -135,11 +135,6 @@ class TestRenderWidgetHostView : public RenderWidgetHostViewBase,
void reset_did_change_compositor_frame_sink() { void reset_did_change_compositor_frame_sink() {
did_change_compositor_frame_sink_ = false; did_change_compositor_frame_sink_ = false;
} }
#if defined(USE_AURA)
void ScheduleEmbed(ws::mojom::WindowTreeClientPtr client,
base::OnceCallback<void(const base::UnguessableToken&)>
callback) override {}
#endif
// viz::HostFrameSinkClient implementation. // viz::HostFrameSinkClient implementation.
void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override; void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override;
void OnFrameTokenChanged(uint32_t frame_token) override; void OnFrameTokenChanged(uint32_t frame_token) override;