Skip to content

Commit

Permalink
Mus+Ash: Replace (Server)WindowSurface with (Server)WindowCompositorF…
Browse files Browse the repository at this point in the history
…rameSink

In an effort to unify Mus+Ash and Chrome terminology, this CL replaces
all WindowSurface references with ui::(Server)WindowCompositorFrameSink.

This CL is a followup to https://codereview.chromium.org/2430653002/

BUG=656975
TBR=tsepez@chromium.org for renaming of methods in mojoms.
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel

Review-Url: https://chromiumcodereview.appspot.com/2429173005
Cr-Commit-Position: refs/heads/master@{#426984}
  • Loading branch information
fsamuel authored and Commit bot committed Oct 22, 2016
1 parent 354fdaa commit d892195
Show file tree
Hide file tree
Showing 75 changed files with 743 additions and 768 deletions.
2 changes: 1 addition & 1 deletion ash/autoclick/mus/autoclick_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void AutoclickApplication::Launch(uint32_t what, mash::mojom::LaunchMode how) {
ui::Window* window =
window_manager_connection_.get()->NewTopLevelWindow(properties);
params.native_widget = new views::NativeWidgetMus(
widget_.get(), window, ui::mojom::SurfaceType::DEFAULT);
widget_.get(), window, ui::mojom::CompositorFrameSinkType::DEFAULT);
widget_->Init(params);
} else {
widget_->Close();
Expand Down
2 changes: 1 addition & 1 deletion ash/mus/bridge/wm_root_window_controller_mus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void WmRootWindowControllerMus::ConfigureWidgetInitParamsForContainer(
WmWindowMus::Get(new_window)
->set_widget(widget, WmWindowMus::WidgetCreationType::INTERNAL);
init_params->native_widget = new views::NativeWidgetMus(
widget, new_window, ui::mojom::SurfaceType::DEFAULT);
widget, new_window, ui::mojom::CompositorFrameSinkType::DEFAULT);
}

WmWindow* WmRootWindowControllerMus::FindEventTarget(
Expand Down
2 changes: 1 addition & 1 deletion ash/mus/frame/detached_title_area_renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ DetachedTitleAreaRenderer::DetachedTitleAreaRenderer(
params.name = "DetachedTitleAreaRenderer";
params.activatable = views::Widget::InitParams::ACTIVATABLE_NO;
params.native_widget = new views::NativeWidgetMus(
widget_, window, ui::mojom::SurfaceType::UNDERLAY);
widget_, window, ui::mojom::CompositorFrameSinkType::UNDERLAY);
widget_->Init(params);
HeaderView* header_view = new HeaderView(frame_);
if (source == Source::CLIENT) {
Expand Down
6 changes: 3 additions & 3 deletions ash/mus/native_widget_factory_mus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ views::NativeWidget* CreateNativeWidgetMus(
return nullptr;
std::map<std::string, std::vector<uint8_t>> props;
views::NativeWidgetMus::ConfigurePropertiesForNewWindow(init_params, &props);
return new views::NativeWidgetMus(delegate,
window_manager->NewTopLevelWindow(&props),
ui::mojom::SurfaceType::DEFAULT);
return new views::NativeWidgetMus(
delegate, window_manager->NewTopLevelWindow(&props),
ui::mojom::CompositorFrameSinkType::DEFAULT);
}

} // namespace
Expand Down
4 changes: 3 additions & 1 deletion ash/mus/non_client_frame_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ class WmNativeWidgetMus : public views::NativeWidgetMus {
WmNativeWidgetMus(views::internal::NativeWidgetDelegate* delegate,
ui::Window* window,
ui::WindowManagerClient* window_manager_client)
: NativeWidgetMus(delegate, window, ui::mojom::SurfaceType::UNDERLAY),
: NativeWidgetMus(delegate,
window,
ui::mojom::CompositorFrameSinkType::UNDERLAY),
window_manager_client_(window_manager_client) {}
~WmNativeWidgetMus() override {}

Expand Down
2 changes: 1 addition & 1 deletion ash/touch_hud/mus/touch_hud_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void TouchHudApplication::Launch(uint32_t what, mash::mojom::LaunchMode how) {
ui::Window* window =
window_manager_connection_.get()->NewTopLevelWindow(properties);
params.native_widget = new views::NativeWidgetMus(
widget_, window, ui::mojom::SurfaceType::DEFAULT);
widget_, window, ui::mojom::CompositorFrameSinkType::DEFAULT);
widget_->Init(params);
widget_->Show();
} else {
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/views/frame/browser_frame_mus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ BrowserFrameMus::BrowserFrameMus(BrowserFrame* browser_frame,
BrowserView* browser_view)
: views::NativeWidgetMus(browser_frame,
CreateMusWindow(browser_view),
ui::mojom::SurfaceType::DEFAULT),
ui::mojom::CompositorFrameSinkType::DEFAULT),
browser_view_(browser_view) {}

BrowserFrameMus::~BrowserFrameMus() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ void ImmersiveModeControllerAsh::CreateMashRevealWidget() {
mash_reveal_widget_.get(),
views::WindowManagerConnection::Get()->client()->NewWindow(
&window_properties),
ui::mojom::SurfaceType::DEFAULT);
ui::mojom::CompositorFrameSinkType::DEFAULT);
init_params.accept_events = false;
init_params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
init_params.activatable = views::Widget::InitParams::ACTIVATABLE_NO;
Expand Down
4 changes: 4 additions & 0 deletions content/browser/compositor/OWNERS
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
danakj@chromium.org
jbauman@chromium.org
ccameron@chromium.org

per-file *Mus*=fsamuel@chromium.org
per-file *Mus*=sadrul@chromium.org
per-file *Mus*=rjkroege@chromium.org
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
#include "content/common/gpu/client/context_provider_command_buffer.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/ipc/client/command_buffer_proxy_impl.h"
#include "services/ui/public/cpp/compositor_frame_sink.h"
#include "services/ui/public/cpp/window.h"
#include "services/ui/public/cpp/window_surface.h"
#include "services/ui/public/cpp/window_compositor_frame_sink.h"

namespace content {

Expand All @@ -33,7 +32,7 @@ MusBrowserCompositorOutputSurface::MusBrowserCompositorOutputSurface(
std::move(overlay_candidate_validator)),
ui_window_(window) {
ui_compositor_frame_sink_ = ui_window_->RequestCompositorFrameSink(
ui::mojom::SurfaceType::DEFAULT, context);
ui::mojom::CompositorFrameSinkType::DEFAULT, context);
}

MusBrowserCompositorOutputSurface::~MusBrowserCompositorOutputSurface() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
#include "content/browser/compositor/gpu_browser_compositor_output_surface.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "gpu/ipc/common/surface_handle.h"
#include "services/ui/public/cpp/window_surface_client.h"

namespace ui {
class CompositorFrameSink;
class Window;
class WindowCompositorFrameSink;
}

namespace content {
Expand Down Expand Up @@ -64,7 +63,7 @@ class MusBrowserCompositorOutputSurface
const gpu::Mailbox& GetMailboxFromResourceId(uint32_t id);

ui::Window* ui_window_;
std::unique_ptr<ui::CompositorFrameSink> ui_compositor_frame_sink_;
std::unique_ptr<ui::WindowCompositorFrameSink> ui_compositor_frame_sink_;
std::vector<uint32_t> free_resource_ids_;
std::vector<gpu::Mailbox> mailboxes_;

Expand Down
3 changes: 3 additions & 0 deletions content/renderer/mus/OWNERS
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
ben@chromium.org
sadrul@chromium.org
fsamuel@chromium.org
rjkroege@chromium.org
23 changes: 14 additions & 9 deletions content/renderer/mus/compositor_mus_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ CompositorMusConnection::CompositorMusConnection(
}

void CompositorMusConnection::AttachCompositorFrameSinkOnMainThread(
std::unique_ptr<ui::WindowSurfaceBinding> surface_binding) {
std::unique_ptr<ui::WindowCompositorFrameSinkBinding>
compositor_frame_sink_binding) {
DCHECK(main_task_runner_->BelongsToCurrentThread());
compositor_task_runner_->PostTask(
FROM_HERE,
base::Bind(
&CompositorMusConnection::AttachCompositorFrameSinkOnCompositorThread,
this, base::Passed(std::move(surface_binding))));
this, base::Passed(std::move(compositor_frame_sink_binding))));
}

CompositorMusConnection::~CompositorMusConnection() {
Expand All @@ -62,12 +63,15 @@ CompositorMusConnection::~CompositorMusConnection() {
}

void CompositorMusConnection::AttachCompositorFrameSinkOnCompositorThread(
std::unique_ptr<ui::WindowSurfaceBinding> surface_binding) {
std::unique_ptr<ui::WindowCompositorFrameSinkBinding>
compositor_frame_sink_binding) {
DCHECK(compositor_task_runner_->BelongsToCurrentThread());
window_surface_binding_ = std::move(surface_binding);
window_compositor_frame_sink_binding_ =
std::move(compositor_frame_sink_binding);
if (root_) {
root_->AttachCompositorFrameSink(ui::mojom::SurfaceType::DEFAULT,
std::move(window_surface_binding_));
root_->AttachCompositorFrameSink(
ui::mojom::CompositorFrameSinkType::DEFAULT,
std::move(window_compositor_frame_sink_binding_));
}
}

Expand Down Expand Up @@ -152,9 +156,10 @@ void CompositorMusConnection::OnEmbed(ui::Window* root) {
DCHECK(compositor_task_runner_->BelongsToCurrentThread());
root_ = root;
root_->set_input_event_handler(this);
if (window_surface_binding_) {
root->AttachCompositorFrameSink(ui::mojom::SurfaceType::DEFAULT,
std::move(window_surface_binding_));
if (window_compositor_frame_sink_binding_) {
root->AttachCompositorFrameSink(
ui::mojom::CompositorFrameSinkType::DEFAULT,
std::move(window_compositor_frame_sink_binding_));
}
}

Expand Down
13 changes: 8 additions & 5 deletions content/renderer/mus/compositor_mus_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ class CONTENT_EXPORT CompositorMusConnection
mojo::InterfaceRequest<ui::mojom::WindowTreeClient> request,
InputHandlerManager* input_handler_manager);

// Attaches the provided |surface_binding| with the ui::Window for the
// renderer once it becomes available.
// Attaches the provided |compositor_frame_sink_binding| with the ui::Window
// for the renderer once it becomes available.
void AttachCompositorFrameSinkOnMainThread(
std::unique_ptr<ui::WindowSurfaceBinding> surface_binding);
std::unique_ptr<ui::WindowCompositorFrameSinkBinding>
compositor_frame_sink_binding);

private:
friend class CompositorMusConnectionTest;
Expand All @@ -60,7 +61,8 @@ class CONTENT_EXPORT CompositorMusConnection
~CompositorMusConnection() override;

void AttachCompositorFrameSinkOnCompositorThread(
std::unique_ptr<ui::WindowSurfaceBinding> surface_binding);
std::unique_ptr<ui::WindowCompositorFrameSinkBinding>
compositor_frame_sink_binding);

void CreateWindowTreeClientOnCompositorThread(
ui::mojom::WindowTreeClientRequest request);
Expand Down Expand Up @@ -109,7 +111,8 @@ class CONTENT_EXPORT CompositorMusConnection
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
InputHandlerManager* const input_handler_manager_;
std::unique_ptr<ui::WindowSurfaceBinding> window_surface_binding_;
std::unique_ptr<ui::WindowCompositorFrameSinkBinding>
window_compositor_frame_sink_binding_;

// Stores the current state of the active pointers targeting this object.
ui::MotionEventAura pointer_state_;
Expand Down
20 changes: 11 additions & 9 deletions content/renderer/mus/render_widget_mus_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include "content/renderer/mus/compositor_mus_connection.h"
#include "content/renderer/render_thread_impl.h"
#include "content/renderer/render_view_impl.h"
#include "services/ui/public/cpp/compositor_frame_sink.h"
#include "services/ui/public/cpp/context_provider.h"
#include "services/ui/public/cpp/window_compositor_frame_sink.h"
#include "services/ui/public/interfaces/window_tree.mojom.h"

namespace content {
Expand All @@ -32,26 +32,28 @@ void RenderWidgetMusConnection::Bind(
routing_id_, render_thread->GetCompositorMainThreadTaskRunner(),
render_thread->compositor_task_runner(), std::move(request),
render_thread->input_handler_manager());
if (window_surface_binding_) {
if (window_compositor_frame_sink_binding_) {
compositor_mus_connection_->AttachCompositorFrameSinkOnMainThread(
std::move(window_surface_binding_));
std::move(window_compositor_frame_sink_binding_));
}
}

std::unique_ptr<cc::CompositorFrameSink>
RenderWidgetMusConnection::CreateCompositorFrameSink(
scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(!window_surface_binding_);
DCHECK(!window_compositor_frame_sink_binding_);

std::unique_ptr<cc::CompositorFrameSink> surface(new ui::CompositorFrameSink(
make_scoped_refptr(new ui::ContextProvider(std::move(gpu_channel_host))),
ui::WindowSurface::Create(&window_surface_binding_)));
std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink(
ui::WindowCompositorFrameSink::Create(
make_scoped_refptr(
new ui::ContextProvider(std::move(gpu_channel_host))),
&window_compositor_frame_sink_binding_));
if (compositor_mus_connection_) {
compositor_mus_connection_->AttachCompositorFrameSinkOnMainThread(
std::move(window_surface_binding_));
std::move(window_compositor_frame_sink_binding_));
}
return surface;
return compositor_frame_sink;
}

// static
Expand Down
4 changes: 2 additions & 2 deletions content/renderer/mus/render_widget_mus_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "content/common/content_export.h"
#include "content/renderer/input/render_widget_input_handler_delegate.h"
#include "content/renderer/mus/compositor_mus_connection.h"
#include "services/ui/public/cpp/window_surface.h"

namespace gpu {
class GpuChannelHost;
Expand Down Expand Up @@ -69,7 +68,8 @@ class CONTENT_EXPORT RenderWidgetMusConnection

const int routing_id_;
RenderWidgetInputHandler* input_handler_;
std::unique_ptr<ui::WindowSurfaceBinding> window_surface_binding_;
std::unique_ptr<ui::WindowCompositorFrameSinkBinding>
window_compositor_frame_sink_binding_;
scoped_refptr<CompositorMusConnection> compositor_mus_connection_;

base::Callback<void(ui::mojom::EventResult)> pending_ack_;
Expand Down
2 changes: 1 addition & 1 deletion mash/login/login.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class UI : public views::WidgetDelegateView,
ui::Window* window =
views::WindowManagerConnection::Get()->NewTopLevelWindow(properties);
params.native_widget = new views::NativeWidgetMus(
widget, window, ui::mojom::SurfaceType::DEFAULT);
widget, window, ui::mojom::CompositorFrameSinkType::DEFAULT);
widget->Init(params);
widget->Show();
}
Expand Down
2 changes: 1 addition & 1 deletion mash/screenlock/screenlock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void Screenlock::OnStart(const service_manager::Identity& identity) {
ui::Window* window =
views::WindowManagerConnection::Get()->NewTopLevelWindow(properties);
params.native_widget = new views::NativeWidgetMus(
widget, window, ui::mojom::SurfaceType::DEFAULT);
widget, window, ui::mojom::CompositorFrameSinkType::DEFAULT);
widget->Init(params);
widget->Show();
}
Expand Down
2 changes: 1 addition & 1 deletion services/navigation/view_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ void ViewImpl::OnEmbed(ui::Window* root) {
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.delegate = this;
params.native_widget = new views::NativeWidgetMus(
widget_.get(), root, ui::mojom::SurfaceType::DEFAULT);
widget_.get(), root, ui::mojom::CompositorFrameSinkType::DEFAULT);
widget_->Init(params);
widget_->Show();
}
Expand Down
5 changes: 2 additions & 3 deletions services/ui/demo/bitmap_uploader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "services/ui/public/cpp/gles2_context.h"
#include "services/ui/public/cpp/gpu_service.h"
#include "services/ui/public/cpp/window.h"
#include "services/ui/public/cpp/window_surface.h"

namespace ui {
namespace {
Expand Down Expand Up @@ -176,8 +175,8 @@ void BitmapUploader::Upload() {
void BitmapUploader::OnGpuChannelEstablished(
scoped_refptr<gpu::GpuChannelHost> gpu_channel) {
compositor_frame_sink_ = window_->RequestCompositorFrameSink(
mojom::SurfaceType::DEFAULT,
new ContextProvider(gpu_channel));
mojom::CompositorFrameSinkType::DEFAULT,
new ContextProvider(std::move(gpu_channel)));
compositor_frame_sink_->BindToClient(this);
}

Expand Down
9 changes: 4 additions & 5 deletions services/ui/demo/bitmap_uploader.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@
#include "cc/output/compositor_frame_sink_client.h"
#include "gpu/GLES2/gl2chromium.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "services/ui/public/cpp/compositor_frame_sink.h"
#include "services/ui/public/cpp/window_surface.h"
#include "services/ui/public/cpp/window_surface_client.h"
#include "services/ui/public/cpp/window_compositor_frame_sink.h"

namespace gpu {
class GpuChannelHost;
}

namespace ui {
class GLES2Context;

class GpuService;
class Window;

extern const char kBitmapUploaderForAcceleratedWidget[];

Expand Down Expand Up @@ -80,7 +79,7 @@ class BitmapUploader : public cc::CompositorFrameSinkClient {
const gfx::Transform& transform) override;

Window* window_;
std::unique_ptr<CompositorFrameSink> compositor_frame_sink_;
std::unique_ptr<WindowCompositorFrameSink> compositor_frame_sink_;

uint32_t color_;
int width_;
Expand Down
Loading

0 comments on commit d892195

Please sign in to comment.