0

content: remove remaining window-service references from content

BUG=958121
TEST=covered by tests

Change-Id: Ibfe6adc213d9d9c46a9fe3b250a4f6c296a8728a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1598329
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#657260}
This commit is contained in:
Scott Violet
2019-05-07 15:36:10 +00:00
committed by Commit Bot
parent 83fdee935c
commit 9e1d0ab4a4
21 changed files with 51 additions and 296 deletions

@ -2550,7 +2550,6 @@ jumbo_source_set("browser") {
if (use_aura) {
deps += [
"//services/ws/public/cpp",
"//services/ws/public/cpp/host",
"//services/ws/public/mojom",
"//ui/aura",

@ -145,7 +145,6 @@
#include "skia/ext/skia_memory_dump_provider.h"
#include "sql/sql_memory_dump_provider.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/ui_base_features.h"
#include "ui/display/display_features.h"
#include "ui/gfx/font_render_params.h"
#include "ui/gfx/switches.h"
@ -752,15 +751,13 @@ void BrowserMainLoop::PostMainMessageLoopStart() {
base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}));
}
if (!features::IsMultiProcessMash()) {
discardable_shared_memory_manager_ =
std::make_unique<discardable_memory::DiscardableSharedMemoryManager>();
// TODO(boliu): kSingleProcess check is a temporary workaround for
// in-process Android WebView. crbug.com/503724 tracks proper fix.
if (!parsed_command_line_.HasSwitch(switches::kSingleProcess)) {
base::DiscardableMemoryAllocator::SetInstance(
discardable_shared_memory_manager_.get());
}
discardable_shared_memory_manager_ =
std::make_unique<discardable_memory::DiscardableSharedMemoryManager>();
// TODO(boliu): kSingleProcess check is a temporary workaround for
// in-process Android WebView. crbug.com/503724 tracks proper fix.
if (!parsed_command_line_.HasSwitch(switches::kSingleProcess)) {
base::DiscardableMemoryAllocator::SetInstance(
discardable_shared_memory_manager_.get());
}
if (parts_)
@ -1199,12 +1196,6 @@ void BrowserMainLoop::GetCompositingModeReporter(
// CompositingModeReporter.
return;
#else
if (features::IsMultiProcessMash()) {
// Mash == ChromeOS, which doesn't support software compositing, so no need
// to report compositing mode.
return;
}
compositing_mode_reporter_impl_->BindRequest(std::move(request));
#endif
}

@ -127,9 +127,7 @@ bool g_window_has_focus = false;
class TestRenderWidgetHostView : public RenderWidgetHostViewAura {
public:
TestRenderWidgetHostView(RenderWidgetHost* host, bool is_guest_view_hack)
: RenderWidgetHostViewAura(host,
is_guest_view_hack,
false /* is_mus_browser_plugin_guest */) {}
: RenderWidgetHostViewAura(host, is_guest_view_hack) {}
~TestRenderWidgetHostView() override {}
bool HasFocus() override { return g_window_has_focus; }

@ -45,9 +45,7 @@ class MockPointerLockRenderWidgetHostView : public RenderWidgetHostViewAura {
public:
MockPointerLockRenderWidgetHostView(RenderWidgetHost* host,
bool is_guest_view_hack)
: RenderWidgetHostViewAura(host,
is_guest_view_hack,
false /* is_mus_browser_plugin_guest */),
: RenderWidgetHostViewAura(host, is_guest_view_hack),
host_(RenderWidgetHostImpl::From(host)) {}
~MockPointerLockRenderWidgetHostView() override {
if (IsMouseLocked())

@ -17,10 +17,6 @@
#include "third_party/blink/public/common/frame/occlusion_state.h"
#include "ui/gfx/geometry/rect.h"
#if defined(USE_AURA)
#include "services/ws/public/mojom/window_tree.mojom.h"
#endif
namespace blink {
class WebGestureEvent;
struct WebIntrinsicSizingInfo;
@ -247,13 +243,6 @@ class CONTENT_EXPORT FrameConnectorDelegate {
// zoom-for-dsf is enabled, and in DIP if not.
virtual void SetScreenSpaceRect(const gfx::Rect& screen_space_rect);
#if defined(USE_AURA)
// Embeds a WindowTreeClient in the parent. This results in the parent
// creating a window in the ui server so that this can render to the screen.
virtual void EmbedRendererWindowTreeClientInParent(
ws::mojom::WindowTreeClientPtr window_tree_client) {}
#endif
// Called by RenderWidgetHostViewChildFrame when the child frame has updated
// its visual properties and its viz::LocalSurfaceId has changed.
virtual void DidUpdateVisualProperties(

@ -955,8 +955,7 @@ TEST_F(RenderWidgetHostTest, ResizeThenCrash) {
TEST_F(RenderWidgetHostTest, Background) {
std::unique_ptr<RenderWidgetHostViewBase> view;
#if defined(USE_AURA)
view.reset(new RenderWidgetHostViewAura(
host_.get(), false, false /* is_mus_browser_plugin_guest */));
view.reset(new RenderWidgetHostViewAura(host_.get(), false));
// TODO(derat): Call this on all platforms: http://crbug.com/102450.
view->InitAsChild(nullptr);
#elif defined(OS_ANDROID)

@ -330,10 +330,8 @@ class RenderWidgetHostViewAura::WindowAncestorObserver
RenderWidgetHostViewAura::RenderWidgetHostViewAura(
RenderWidgetHost* widget_host,
bool is_guest_view_hack,
bool is_mus_browser_plugin_guest)
bool is_guest_view_hack)
: RenderWidgetHostViewBase(widget_host),
is_mus_browser_plugin_guest_(is_mus_browser_plugin_guest),
window_(nullptr),
in_shutdown_(false),
in_bounds_changed_(false),
@ -356,8 +354,7 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(
frame_sink_id_(is_guest_view_hack_ ? AllocateFrameSinkIdForGuestViewHack()
: host()->GetFrameSinkId()),
weak_ptr_factory_(this) {
if (!is_mus_browser_plugin_guest_)
CreateDelegatedFrameHostClient();
CreateDelegatedFrameHostClient();
if (!is_guest_view_hack_)
host()->SetView(this);
@ -391,8 +388,6 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(
void RenderWidgetHostViewAura::InitAsChild(gfx::NativeView parent_view) {
DCHECK_EQ(widget_type_, WidgetType::kFrame);
if (is_mus_browser_plugin_guest_)
return;
CreateAuraWindow(aura::client::WINDOW_TYPE_CONTROL);
if (parent_view)
@ -405,8 +400,6 @@ void RenderWidgetHostViewAura::InitAsPopup(
RenderWidgetHostView* parent_host_view,
const gfx::Rect& bounds_in_screen) {
DCHECK_EQ(widget_type_, WidgetType::kPopup);
// Popups never have |is_mus_browser_plugin_guest_| set to true.
DCHECK(!is_mus_browser_plugin_guest_);
popup_parent_host_view_ =
static_cast<RenderWidgetHostViewAura*>(parent_host_view);
@ -456,9 +449,6 @@ void RenderWidgetHostViewAura::InitAsPopup(
void RenderWidgetHostViewAura::InitAsFullscreen(
RenderWidgetHostView* reference_host_view) {
DCHECK_EQ(widget_type_, WidgetType::kFrame);
// Webview Fullscreen doesn't go through InitAsFullscreen(), so
// |is_mus_browser_plugin_guest_| is always false.
DCHECK(!is_mus_browser_plugin_guest_);
is_fullscreen_ = true;
CreateAuraWindow(aura::client::WINDOW_TYPE_NORMAL);
window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
@ -482,9 +472,6 @@ void RenderWidgetHostViewAura::InitAsFullscreen(
}
void RenderWidgetHostViewAura::Show() {
if (is_mus_browser_plugin_guest_)
return;
// If the viz::LocalSurfaceIdAllocation is invalid, we may have been evicted,
// and no other visual properties have since been changed. Allocate a new id
// and start synchronizing.
@ -499,15 +486,11 @@ void RenderWidgetHostViewAura::Show() {
}
void RenderWidgetHostViewAura::Hide() {
if (is_mus_browser_plugin_guest_)
return;
window_->Hide();
WasOccluded();
}
void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) {
DCHECK(!is_mus_browser_plugin_guest_);
// For a SetSize operation, we don't care what coordinate system the origin
// of the window is in, it's only important to make sure that the origin
// remains constant after the operation.
@ -515,7 +498,6 @@ void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) {
}
void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) {
DCHECK(!is_mus_browser_plugin_guest_);
gfx::Point relative_origin(rect.origin());
// RenderWidgetHostViewAura::SetBounds() takes screen coordinates, but
@ -534,7 +516,6 @@ void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) {
}
gfx::NativeView RenderWidgetHostViewAura::GetNativeView() {
DCHECK(!is_mus_browser_plugin_guest_);
return window_;
}
@ -2040,7 +2021,6 @@ RenderWidgetHostViewAura::~RenderWidgetHostViewAura() {
void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) {
DCHECK(!window_);
DCHECK(!is_mus_browser_plugin_guest_);
window_ = new aura::Window(this);
window_->SetName("RenderWidgetHostViewAura");
event_handler_->set_window(window_);
@ -2080,9 +2060,6 @@ void RenderWidgetHostViewAura::CreateDelegatedFrameHostClient() {
}
void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() {
if (is_mus_browser_plugin_guest_)
return;
if (host()->GetProcess()->FastShutdownStarted())
return;

@ -94,10 +94,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
//
// TODO(lazyboy): Remove |is_guest_view_hack| once BrowserPlugin has migrated
// to use RWHVChildFrame (http://crbug.com/330264).
// |is_mus_browser_plugin_guest| can be removed at the same time.
RenderWidgetHostViewAura(RenderWidgetHost* host,
bool is_guest_view_hack,
bool is_mus_browser_plugin_guest);
RenderWidgetHostViewAura(RenderWidgetHost* host, bool is_guest_view_hack);
// RenderWidgetHostView implementation.
void InitAsChild(gfx::NativeView parent_view) override;
@ -586,8 +583,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
// Called to process a display metrics change.
void ProcessDisplayMetricsChanged();
const bool is_mus_browser_plugin_guest_;
// NOTE: this is null if |is_mus_browser_plugin_guest_| is true.
aura::Window* window_;

@ -101,7 +101,6 @@
#include "ui/base/ime/input_method.h"
#include "ui/base/ime/input_method_keyboard_controller.h"
#include "ui/base/ime/mock_input_method.h"
#include "ui/base/ui_base_features.h"
#include "ui/base/ui_base_switches.h"
#include "ui/base/ui_base_types.h"
#include "ui/compositor/compositor.h"
@ -263,9 +262,7 @@ class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura {
public:
FakeRenderWidgetHostViewAura(RenderWidgetHost* widget,
bool is_guest_view_hack)
: RenderWidgetHostViewAura(widget,
is_guest_view_hack,
false /* is_mus_browser_plugin_guest */),
: RenderWidgetHostViewAura(widget, is_guest_view_hack),
is_guest_view_hack_(is_guest_view_hack),
delegated_frame_host_client_(
new FakeDelegatedFrameHostClientAura(this)) {
@ -570,9 +567,8 @@ class RenderWidgetHostViewAuraTest : public testing::Test {
parent_host_ = MockRenderWidgetHostImpl::Create(delegates_.back().get(),
process_host_, routing_id);
delegates_.back()->set_widget_host(parent_host_);
const bool is_mus_browser_plugin_guest = false;
parent_view_ = new RenderWidgetHostViewAura(
parent_host_, is_guest_view_hack_, is_mus_browser_plugin_guest);
parent_view_ =
new RenderWidgetHostViewAura(parent_host_, is_guest_view_hack_);
parent_view_->InitAsChild(nullptr);
aura::client::ParentWindowWithContext(parent_view_->GetNativeView(),
aura_test_helper_->root_window(),
@ -3063,10 +3059,6 @@ viz::CompositorFrame MakeDelegatedFrame(float scale_factor,
// This test verifies that returned resources do not require a pending ack.
TEST_F(RenderWidgetHostViewAuraTest, ReturnedResources) {
// TODO: fix for mash.
if (features::IsMultiProcessMash())
return;
gfx::Size view_size(100, 100);
gfx::Rect view_rect(view_size);
@ -3097,10 +3089,8 @@ TEST_F(RenderWidgetHostViewAuraTest, ReturnedResources) {
TEST_F(RenderWidgetHostViewAuraTest, TwoOutputSurfaces) {
// TODO(jonross): Delete this test once Viz launches as it will be obsolete.
// https://crbug.com/844469
if (features::IsVizDisplayCompositorEnabled() ||
features::IsMultiProcessMash()) {
if (features::IsVizDisplayCompositorEnabled())
return;
}
viz::FakeSurfaceObserver manager_observer;
ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
@ -3241,10 +3231,6 @@ TEST_F(RenderWidgetHostViewAuraTest, ZeroSizeStillGetsLocalSurfaceId) {
}
TEST_F(RenderWidgetHostViewAuraTest, BackgroundColorMatchesCompositorFrame) {
// TODO: fix for mash.
if (features::IsMultiProcessMash())
return;
gfx::Size frame_size(100, 100);
parent_local_surface_id_allocator_.GenerateId();
viz::LocalSurfaceId local_surface_id =
@ -3416,10 +3402,6 @@ TEST_F(RenderWidgetHostViewAuraTest, DISABLED_Resize) {
// This test verifies that the primary SurfaceId is populated on resize.
TEST_F(RenderWidgetHostViewAuraSurfaceSynchronizationTest, SurfaceChanges) {
// Early out because DelegatedFrameHost is not used in mash.
if (features::IsMultiProcessMash())
return;
view_->InitAsChild(nullptr);
aura::client::ParentWindowWithContext(
view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
@ -3438,10 +3420,6 @@ TEST_F(RenderWidgetHostViewAuraSurfaceSynchronizationTest, SurfaceChanges) {
// factor changes.
TEST_F(RenderWidgetHostViewAuraSurfaceSynchronizationTest,
DeviceScaleFactorChanges) {
// TODO: fix for mash.
if (features::IsMultiProcessMash())
return;
view_->InitAsChild(nullptr);
aura::client::ParentWindowWithContext(
view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
@ -3466,10 +3444,8 @@ TEST_F(RenderWidgetHostViewAuraSurfaceSynchronizationTest,
CompositorFrameSinkChange) {
// TODO(jonross): Delete this test once Viz launches as it will be obsolete.
// https://crbug.com/844469
if (features::IsVizDisplayCompositorEnabled() ||
features::IsMultiProcessMash()) {
if (features::IsVizDisplayCompositorEnabled())
return;
}
gfx::Rect view_rect(100, 100);
gfx::Size frame_size = view_rect.size();
@ -3503,10 +3479,6 @@ TEST_F(RenderWidgetHostViewAuraSurfaceSynchronizationTest,
// RenderWidgetHostViewAuraTest.DiscardDelegatedFrame.
TEST_F(RenderWidgetHostViewAuraSurfaceSynchronizationTest,
DiscardDelegatedFrames) {
// Early out because DelegatedFrameHost is not used in mash.
if (features::IsMultiProcessMash())
return;
// Make sure |parent_view_| is evicted to avoid interfering with the code
// below.
parent_view_->Hide();
@ -3623,10 +3595,6 @@ TEST_F(RenderWidgetHostViewAuraSurfaceSynchronizationTest,
// Test that changing the memory pressure should delete saved frames. This test
// only applies to ChromeOS.
TEST_F(RenderWidgetHostViewAuraTest, DiscardDelegatedFramesWithMemoryPressure) {
// Early out because DelegatedFrameHost is not used in mash.
if (features::IsMultiProcessMash())
return;
// Make sure |parent_view_| is evicted to avoid interfering with the code
// below.
parent_view_->Hide();
@ -3732,10 +3700,8 @@ TEST_F(RenderWidgetHostViewAuraTest, SourceEventTypeExistsInLatencyInfo) {
TEST_F(RenderWidgetHostViewAuraTest, ForwardsBeginFrameAcks) {
// TODO(jonross): Delete this test once Viz launches as it will be obsolete.
// https://crbug.com/844469
if (features::IsVizDisplayCompositorEnabled() ||
features::IsMultiProcessMash()) {
if (features::IsVizDisplayCompositorEnabled())
return;
}
gfx::Rect view_rect(100, 100);
gfx::Size frame_size = view_rect.size();
@ -5779,10 +5745,8 @@ TEST_F(RenderWidgetHostViewAuraTest, GestureTapFromStylusHasPointerType) {
TEST_F(RenderWidgetHostViewAuraTest, HitTestRegionListSubmitted) {
// TODO(jonross): Delete this test once Viz launches as it will be obsolete.
// https://crbug.com/844469
if (features::IsVizDisplayCompositorEnabled() ||
features::IsMultiProcessMash()) {
if (features::IsVizDisplayCompositorEnabled())
return;
}
gfx::Rect view_rect(0, 0, 100, 100);
gfx::Size frame_size = view_rect.size();
@ -5821,10 +5785,6 @@ TEST_F(RenderWidgetHostViewAuraTest, HitTestRegionListSubmitted) {
// time passes without receiving a new compositor frame.
TEST_F(RenderWidgetHostViewAuraSurfaceSynchronizationTest,
NewContentRenderingTimeout) {
// TODO: fix for mash.
if (features::IsMultiProcessMash())
return;
constexpr base::TimeDelta kTimeout = base::TimeDelta::FromMicroseconds(10);
view_->InitAsChild(nullptr);
@ -5879,10 +5839,6 @@ TEST_F(RenderWidgetHostViewAuraSurfaceSynchronizationTest,
// If a tab is evicted, allocate a new LocalSurfaceId next time it's shown.
TEST_F(RenderWidgetHostViewAuraSurfaceSynchronizationTest,
AllocateLocalSurfaceIdOnEviction) {
// TODO: fix for mash.
if (features::IsMultiProcessMash())
return;
view_->InitAsChild(nullptr);
aura::client::ParentWindowWithContext(
view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
@ -5910,10 +5866,6 @@ TEST_F(RenderWidgetHostViewAuraSurfaceSynchronizationTest,
// visible we show blank.
TEST_F(RenderWidgetHostViewAuraSurfaceSynchronizationTest,
DropFallbackIfResizedWhileHidden) {
// Early out because DelegatedFrameHost is not used in mash.
if (features::IsMultiProcessMash())
return;
view_->InitAsChild(nullptr);
aura::client::ParentWindowWithContext(
view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
@ -5931,10 +5883,6 @@ TEST_F(RenderWidgetHostViewAuraSurfaceSynchronizationTest,
// fallback SurfaceId has to be preserved.
TEST_F(RenderWidgetHostViewAuraSurfaceSynchronizationTest,
DontDropFallbackIfNotResizedWhileHidden) {
// Early out because DelegatedFrameHost is not used in mash.
if (features::IsMultiProcessMash())
return;
view_->InitAsChild(nullptr);
aura::client::ParentWindowWithContext(
view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
@ -5958,10 +5906,6 @@ TEST_F(RenderWidgetHostViewAuraSurfaceSynchronizationTest,
// background color from the previous view to the new view.
TEST_F(RenderWidgetHostViewAuraSurfaceSynchronizationTest,
TakeFallbackContent) {
// Early out because DelegatedFrameHost is not used in mash.
if (features::IsMultiProcessMash())
return;
// Initialize the first view.
view_->InitAsChild(nullptr);
aura::client::ParentWindowWithContext(
@ -6003,8 +5947,7 @@ class RenderWidgetHostViewAuraWithViewHarnessTest
delete contents()->GetRenderViewHost()->GetWidget()->GetView();
// This instance is destroyed in the TearDown method below.
view_ = new RenderWidgetHostViewAura(
contents()->GetRenderViewHost()->GetWidget(), false,
false /* is_mus_browser_plugin_guest */);
contents()->GetRenderViewHost()->GetWidget(), false);
}
void TearDown() override {

@ -24,7 +24,6 @@
#include "content/test/test_content_browser_client.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/geometry/size.h"
namespace content {
@ -157,41 +156,6 @@ IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewChildFrameTest,
EXPECT_EQ(gfx::Size(75, 75), rwhv->GetVisibleViewportSize());
}
// Tests that while in mus, the child frame receives an updated FrameSinkId
// representing the frame sink used by the RenderFrameProxy.
IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewChildFrameTest, ChildFrameSinkId) {
// Only when mus hosts viz do we expect a RenderFrameProxy to provide the
// FrameSinkId.
if (!features::IsMultiProcessMash())
return;
GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html"));
NavigateToURL(shell(), main_url);
FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
->GetFrameTree()
->root();
auto message_filter =
base::MakeRefCounted<SynchronizeVisualPropertiesMessageFilter>();
root->current_frame_host()->GetProcess()->AddFilter(message_filter.get());
// Load cross-site page into iframe.
GURL cross_site_url(
embedded_test_server()->GetURL("foo.com", "/title2.html"));
// The child frame is created during this blocking call, on the UI thread.
// This is racing the IPC we are testing for, which arrives on the IO thread.
// Due to this we cannot get the pre-IPC value of the viz::FrameSinkId.
NavigateFrameToURL(root->child_at(0), cross_site_url);
// Ensure that the IPC providing the new viz::FrameSinkId. If it does not then
// this test will timeout.
set_expected_frame_sink_id(message_filter->GetOrWaitForId());
shell()->web_contents()->ForEachFrame(
base::BindRepeating(&RenderWidgetHostViewChildFrameTest::CheckFrameSinkId,
base::Unretained(this)));
}
// Validate that OOPIFs receive presentation feedbacks.
IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewChildFrameTest,
PresentationFeedback) {

@ -28,7 +28,6 @@
#include "mojo/public/cpp/bindings/interface_request.h"
#include "services/service_manager/public/cpp/binder_registry.h"
#include "services/ws/public/mojom/gpu.mojom.h"
#include "ui/base/ui_base_features.h"
#if defined(OS_WIN)
#include "content/browser/renderer_host/dwrite_font_proxy_impl_win.h"
@ -55,21 +54,19 @@ class ConnectionFilterImpl : public ConnectionFilter {
base::BindRepeating(&SandboxSupportMacImpl::BindRequest,
base::Owned(new SandboxSupportMacImpl)));
#endif
if (!features::IsMultiProcessMash()) {
// For mus, the mojom::discardable_memory::DiscardableSharedMemoryManager
// is exposed from ui::Service. So we don't need bind the interface here.
auto* browser_main_loop = BrowserMainLoop::GetInstance();
if (browser_main_loop) {
auto* manager = browser_main_loop->discardable_shared_memory_manager();
if (manager) {
registry_.AddInterface(base::BindRepeating(
&discardable_memory::DiscardableSharedMemoryManager::Bind,
base::Unretained(manager)));
}
// For mus, the mojom::discardable_memory::DiscardableSharedMemoryManager
// is exposed from ui::Service. So we don't need bind the interface here.
auto* browser_main_loop = BrowserMainLoop::GetInstance();
if (browser_main_loop) {
auto* manager = browser_main_loop->discardable_shared_memory_manager();
if (manager) {
registry_.AddInterface(base::BindRepeating(
&discardable_memory::DiscardableSharedMemoryManager::Bind,
base::Unretained(manager)));
}
registry_.AddInterface(base::BindRepeating(
&ConnectionFilterImpl::BindGpuRequest, base::Unretained(this)));
}
registry_.AddInterface(base::BindRepeating(
&ConnectionFilterImpl::BindGpuRequest, base::Unretained(this)));
}
~ConnectionFilterImpl() override { DCHECK_CURRENTLY_ON(BrowserThread::IO); }

@ -72,7 +72,6 @@
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/dragdrop/os_exchange_data_provider_factory.h"
#include "ui/base/hit_test.h"
#include "ui/base/ui_base_features.h"
#include "ui/base/ui_base_switches_util.h"
#include "ui/compositor/layer.h"
#include "ui/display/screen.h"
@ -635,10 +634,7 @@ void WebContentsViewAura::InstallCreateHookForTests(
WebContentsViewAura::WebContentsViewAura(WebContentsImpl* web_contents,
WebContentsViewDelegate* delegate)
: is_mus_browser_plugin_guest_(web_contents->GetBrowserPluginGuest() !=
nullptr &&
features::IsMultiProcessMash()),
web_contents_(web_contents),
: web_contents_(web_contents),
delegate_(delegate),
current_drag_op_(blink::kWebDragOperationNone),
drag_dest_delegate_(nullptr),
@ -755,32 +751,17 @@ bool WebContentsViewAura::IsValidDragTarget(
// WebContentsViewAura, WebContentsView implementation:
gfx::NativeView WebContentsViewAura::GetNativeView() const {
if (!is_mus_browser_plugin_guest_)
return window_.get();
DCHECK(web_contents_->GetOuterWebContents());
return web_contents_->GetOuterWebContents()->GetView()->GetNativeView();
return window_.get();
}
gfx::NativeView WebContentsViewAura::GetContentNativeView() const {
if (!is_mus_browser_plugin_guest_) {
RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
return rwhv ? rwhv->GetNativeView() : nullptr;
}
DCHECK(web_contents_->GetOuterWebContents());
return web_contents_->GetOuterWebContents()
->GetView()
->GetContentNativeView();
RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
return rwhv ? rwhv->GetNativeView() : nullptr;
}
gfx::NativeWindow WebContentsViewAura::GetTopLevelNativeWindow() const {
if (!is_mus_browser_plugin_guest_) {
gfx::NativeWindow window = window_->GetToplevelWindow();
return window ? window : delegate_->GetNativeWindow();
}
DCHECK(web_contents_->GetOuterWebContents());
return web_contents_->GetOuterWebContents()
->GetView()
->GetTopLevelNativeWindow();
gfx::NativeWindow window = window_->GetToplevelWindow();
return window ? window : delegate_->GetNativeWindow();
}
void WebContentsViewAura::GetContainerBounds(gfx::Rect* out) const {
@ -923,8 +904,7 @@ void WebContentsViewAura::CreateView(const gfx::Size& initial_size,
// if the bookmark bar is not shown and you create a new tab). The right
// value is set shortly after this, so its safe to ignore.
if (!is_mus_browser_plugin_guest_)
CreateAuraWindow(context);
CreateAuraWindow(context);
// delegate_->GetDragDestDelegate() creates a new delegate on every call.
// Hence, we save a reference to it locally. Similar model is used on other
@ -950,8 +930,8 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget(
g_create_render_widget_host_view
? g_create_render_widget_host_view(render_widget_host,
is_guest_view_hack)
: new RenderWidgetHostViewAura(render_widget_host, is_guest_view_hack,
is_mus_browser_plugin_guest_);
: new RenderWidgetHostViewAura(render_widget_host,
is_guest_view_hack);
view->InitAsChild(GetRenderWidgetHostViewParent());
RenderWidgetHostImpl* host_impl =
@ -960,9 +940,6 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget(
if (!host_impl->is_hidden())
view->Show();
if (is_mus_browser_plugin_guest_)
return view;
// We listen to drag drop events in the newly created view's window.
aura::client::SetDragDropDelegate(view->GetNativeView(), this);
@ -977,20 +954,14 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget(
RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForChildWidget(
RenderWidgetHost* render_widget_host) {
// Popups are not created as embedded windows in mus, so
// |is_mus_browser_plugin_guest| is always false for them.
const bool is_mus_browser_plugin_guest = false;
return new RenderWidgetHostViewAura(render_widget_host, false,
is_mus_browser_plugin_guest);
return new RenderWidgetHostViewAura(render_widget_host, false);
}
void WebContentsViewAura::SetPageTitle(const base::string16& title) {
if (!is_mus_browser_plugin_guest_) {
window_->SetTitle(title);
aura::Window* child_window = GetContentNativeView();
if (child_window)
child_window->SetTitle(title);
}
window_->SetTitle(title);
aura::Window* child_window = GetContentNativeView();
if (child_window)
child_window->SetTitle(title);
}
void WebContentsViewAura::RenderViewCreated(RenderViewHost* host) {

@ -226,9 +226,6 @@ class CONTENT_EXPORT WebContentsViewAura
#endif
DropCallbackForTesting drop_callback_for_testing_;
const bool is_mus_browser_plugin_guest_;
// NOTE: this is null when running in mus and |is_mus_browser_plugin_guest_|.
std::unique_ptr<aura::Window> window_;
std::unique_ptr<WindowObserver> window_observer_;

@ -21,7 +21,6 @@
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/common/context_menu_params.h"
#include "content/public/common/drop_data.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@ -74,17 +73,14 @@ void WebContentsViewGuest::OnGuestAttached(WebContentsView* parent_view) {
// view hierarchy. We add this view as embedder's child here.
// This would go in WebContentsViewGuest::CreateView, but that is too early to
// access embedder_web_contents(). Therefore, we do it here.
if (!features::IsMultiProcessMash())
parent_view->GetNativeView()->AddChild(platform_view_->GetNativeView());
parent_view->GetNativeView()->AddChild(platform_view_->GetNativeView());
#endif // defined(USE_AURA)
}
void WebContentsViewGuest::OnGuestDetached(WebContentsView* old_parent_view) {
#if defined(USE_AURA)
if (!features::IsMultiProcessMash()) {
old_parent_view->GetNativeView()->RemoveChild(
platform_view_->GetNativeView());
}
old_parent_view->GetNativeView()->RemoveChild(
platform_view_->GetNativeView());
#endif // defined(USE_AURA)
}

@ -9,7 +9,6 @@ include_rules = [
"+services/shape_detection",
"+services/viz/privileged/interfaces",
"+services/viz/service",
"+services/ws/common",
"+sandbox",
"+skia",
]

@ -51,7 +51,6 @@
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/resource_reply_thread_registrar.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/ws/public/mojom/constants.mojom.h"
#include "third_party/blink/public/web/blink.h"
#include "ui/base/buildflags.h"
#include "ui/base/ui_base_features.h"
@ -122,17 +121,8 @@ PpapiThread::PpapiThread(base::RepeatingClosure quit_closure,
// allocator.
if (!command_line.HasSwitch(switches::kSingleProcess)) {
discardable_memory::mojom::DiscardableSharedMemoryManagerPtr manager_ptr;
if (features::IsMultiProcessMash()) {
#if defined(USE_AURA)
GetServiceManagerConnection()->GetConnector()->BindInterface(
ws::mojom::kServiceName, &manager_ptr);
#else
NOTREACHED();
#endif
} else {
ChildThread::Get()->GetConnector()->BindInterface(
mojom::kBrowserServiceName, mojo::MakeRequest(&manager_ptr));
}
ChildThread::Get()->GetConnector()->BindInterface(
mojom::kBrowserServiceName, mojo::MakeRequest(&manager_ptr));
discardable_shared_memory_manager_ = std::make_unique<
discardable_memory::ClientDiscardableSharedMemoryManager>(
std::move(manager_ptr), GetIOTaskRunner());

@ -459,9 +459,6 @@ jumbo_static_library("content_shell_lib") {
if (is_chromeos) {
deps += [
"//chromeos/dbus",
"//services/ws/test_ws:lib",
"//services/ws/test_ws:manifest",
"//services/ws/test_ws:mojom",
"//ui/wm:test_support",
]
}

@ -43,9 +43,6 @@ include_rules = [
# Access to the process specific switches.
"+services/service_manager/embedder",
# Allows using test_ws for mash.
"+services/ws/test_ws",
]
specific_include_rules = {

@ -79,10 +79,6 @@
// TODO(https://crbug.com/784179): Remove nogncheck.
#include "content/public/browser/context_factory.h"
#include "content/public/browser/gpu_interface_provider_factory.h"
#include "services/ws/public/mojom/constants.mojom.h" // nogncheck
#include "services/ws/test_ws/test_manifest.h" // nogncheck
#include "services/ws/test_ws/test_window_service_factory.h" // nogncheck
#include "services/ws/test_ws/test_ws.mojom.h" // nogncheck
#endif
#if defined(OS_LINUX) || defined(OS_ANDROID)
@ -169,10 +165,6 @@ const service_manager::Manifest& GetContentBrowserOverlayManifest() {
mojom::WebTestBluetoothFakeAdapterSetter,
bluetooth::mojom::FakeBluetooth>())
.RequireCapability(echo::mojom::kServiceName, "echo")
#if defined(OS_CHROMEOS)
.RequireCapability(ws::mojom::kServiceName, "test")
.RequireCapability("test_ws", "test")
#endif
.ExposeInterfaceFilterCapability_Deprecated(
"navigation:frame", "renderer",
service_manager::Manifest::InterfaceList<
@ -195,9 +187,6 @@ const service_manager::Manifest& GetContentPackagedServicesOverlayManifest() {
static base::NoDestructor<service_manager::Manifest> manifest {
service_manager::ManifestBuilder()
.PackageService(echo::GetManifest())
#if defined(OS_CHROMEOS)
.PackageService(test_ws::GetManifest())
#endif
.Build()
};
return *manifest;
@ -318,12 +307,6 @@ void ShellContentBrowserClient::RegisterOutOfProcessServices(
base::BindRepeating(&base::ASCIIToUTF16, "Test Service");
(*services)[echo::mojom::kServiceName] =
base::BindRepeating(&base::ASCIIToUTF16, "Echo Service");
#if defined(OS_CHROMEOS)
if (features::IsMultiProcessMash()) {
(*services)[test_ws::mojom::kServiceName] =
base::BindRepeating(&base::ASCIIToUTF16, "Test Window Service");
}
#endif
}
void ShellContentBrowserClient::HandleServiceRequest(
@ -397,15 +380,6 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
#endif
}
void ShellContentBrowserClient::AdjustUtilityServiceProcessCommandLine(
const service_manager::Identity& identity,
base::CommandLine* command_line) {
#if defined(OS_CHROMEOS)
if (identity.name() == test_ws::mojom::kServiceName)
command_line->AppendSwitch(switches::kMessageLoopTypeUi);
#endif
}
std::string ShellContentBrowserClient::GetAcceptLangs(BrowserContext* context) {
return ShellURLRequestContextGetter::GetAcceptLanguages();
}

@ -51,9 +51,6 @@ class ShellContentBrowserClient : public ContentBrowserClient {
base::StringPiece name) override;
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) override;
void AdjustUtilityServiceProcessCommandLine(
const service_manager::Identity& identity,
base::CommandLine* command_line) override;
std::string GetAcceptLangs(BrowserContext* context) override;
void ResourceDispatcherHostCreated() override;
std::string GetDefaultDownloadName() override;

@ -25,13 +25,6 @@
#include "services/service_manager/public/cpp/binder_registry.h"
#include "services/test/echo/echo_service.h"
#if defined(OS_CHROMEOS)
// TODO(https://crbug.com/784179): Remove nogncheck.
#include "services/ws/test_ws/test_window_service_factory.h" // nogncheck
#include "services/ws/test_ws/test_ws.mojom.h" // nogncheck
#include "ui/base/ui_base_features.h"
#endif
namespace content {
namespace {
@ -122,12 +115,6 @@ bool ShellContentUtilityClient::HandleServiceRequest(
} else if (service_name == kTestServiceUrl) {
service = std::make_unique<TestService>(std::move(request));
}
#if defined(OS_CHROMEOS)
else if (features::IsMultiProcessMash() &&
service_name == test_ws::mojom::kServiceName) {
service = ws::test::CreateOutOfProcessWindowService(std::move(request));
}
#endif
if (service) {
service_manager::Service::RunAsyncUntilTermination(