summaryrefslogtreecommitdiffstats
path: root/chromium/components/mus/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/mus/gpu')
-rw-r--r--chromium/components/mus/gpu/DEPS21
-rw-r--r--chromium/components/mus/gpu/OWNERS2
-rw-r--r--chromium/components/mus/gpu/display_compositor/compositor_frame_sink_delegate.h27
-rw-r--r--chromium/components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.cc46
-rw-r--r--chromium/components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.h55
-rw-r--r--chromium/components/mus/gpu/display_compositor/compositor_frame_sink_impl.cc112
-rw-r--r--chromium/components/mus/gpu/display_compositor/compositor_frame_sink_impl.h74
-rw-r--r--chromium/components/mus/gpu/display_compositor/display_compositor_impl.cc28
-rw-r--r--chromium/components/mus/gpu/display_compositor/display_compositor_impl.h37
-rw-r--r--chromium/components/mus/gpu/display_compositor/display_impl.cc43
-rw-r--r--chromium/components/mus/gpu/display_compositor/display_impl.h44
-rw-r--r--chromium/components/mus/gpu/gpu_service_impl.cc63
-rw-r--r--chromium/components/mus/gpu/gpu_service_impl.h49
-rw-r--r--chromium/components/mus/gpu/gpu_service_mus.cc273
-rw-r--r--chromium/components/mus/gpu/gpu_service_mus.h173
-rw-r--r--chromium/components/mus/gpu/mus_gpu_memory_buffer_manager.cc115
-rw-r--r--chromium/components/mus/gpu/mus_gpu_memory_buffer_manager.h57
-rw-r--r--chromium/components/mus/gpu/mus_gpu_unittests_app_manifest.json10
18 files changed, 0 insertions, 1229 deletions
diff --git a/chromium/components/mus/gpu/DEPS b/chromium/components/mus/gpu/DEPS
deleted file mode 100644
index 004a2b9f68f..00000000000
--- a/chromium/components/mus/gpu/DEPS
+++ /dev/null
@@ -1,21 +0,0 @@
-include_rules = [
- "+gpu/command_buffer",
- "+gpu/config",
- "+gpu/ipc/common",
- "+gpu/ipc/client/gpu_channel_host.h",
- "+gpu/ipc/service",
- "+media/gpu/ipc/service",
-]
-
-specific_include_rules = {
- "gpu_service_mus\.h": [
- # A GpuChannelHost is used by mus locally.
- "+gpu/ipc/client/gpu_channel_host.h",
- ],
-
- "mus_gpu_memory_buffer_manager\.cc": [
- # The GpuMemoryBufferManager implementation used by mus locally.
- "+gpu/ipc/client/gpu_memory_buffer_impl.h",
- "+gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h",
- ]
-}
diff --git a/chromium/components/mus/gpu/OWNERS b/chromium/components/mus/gpu/OWNERS
deleted file mode 100644
index 1f1af6bcc54..00000000000
--- a/chromium/components/mus/gpu/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-fsamuel@chromium.org
-rjkroege@chromium.org
diff --git a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_delegate.h b/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_delegate.h
deleted file mode 100644
index ee377aadc49..00000000000
--- a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_delegate.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2016 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.
-
-#ifndef COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_DELEGATE_H_
-#define COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_DELEGATE_H_
-
-#include "cc/surfaces/surface_id.h"
-
-namespace mus {
-namespace gpu {
-
-class CompositorFrameSinkImpl;
-
-// A CompositorFrameSinkDelegate decouples CompositorFrameSinks from their
-// factories enabling them to be unit tested.
-class CompositorFrameSinkDelegate {
- public:
- virtual void CompositorFrameSinkConnectionLost(int sink_id) = 0;
-
- virtual cc::SurfaceId GenerateSurfaceId() = 0;
-};
-
-} // namespace gpu
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_DELEGATE_H_
diff --git a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.cc b/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.cc
deleted file mode 100644
index 5c52940a984..00000000000
--- a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2016 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.
-
-#include "components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.h"
-
-#include "base/memory/ptr_util.h"
-#include "cc/surfaces/surface_id.h"
-#include "components/mus/gpu/display_compositor/compositor_frame_sink_impl.h"
-
-namespace mus {
-namespace gpu {
-
-CompositorFrameSinkFactoryImpl::CompositorFrameSinkFactoryImpl(
- uint32_t client_id,
- mojo::InterfaceRequest<mojom::CompositorFrameSinkFactory> request,
- const scoped_refptr<SurfacesState>& surfaces_state)
- : client_id_(client_id),
- surfaces_state_(surfaces_state),
- allocator_(client_id),
- binding_(this, std::move(request)) {}
-
-CompositorFrameSinkFactoryImpl::~CompositorFrameSinkFactoryImpl() {}
-
-void CompositorFrameSinkFactoryImpl::CompositorFrameSinkConnectionLost(
- int local_id) {
- sinks_.erase(local_id);
-}
-
-cc::SurfaceId CompositorFrameSinkFactoryImpl::GenerateSurfaceId() {
- return allocator_.GenerateId();
-}
-
-void CompositorFrameSinkFactoryImpl::CreateCompositorFrameSink(
- uint32_t local_id,
- uint64_t nonce,
- mojo::InterfaceRequest<mojom::CompositorFrameSink> sink,
- mojom::CompositorFrameSinkClientPtr client) {
- // TODO(fsamuel): Use nonce once patch lands:
- // https://codereview.chromium.org/1996783002/
- sinks_[local_id] = base::WrapUnique(new CompositorFrameSinkImpl(
- this, local_id, surfaces_state_, std::move(sink), std::move(client)));
-}
-
-} // namespace gpu
-} // namespace mus
diff --git a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.h b/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.h
deleted file mode 100644
index 50aa0a5a0d3..00000000000
--- a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2016 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.
-
-#ifndef COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_FACTORY_IMPL_H_
-#define COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_FACTORY_IMPL_H_
-
-#include "cc/surfaces/surface_id_allocator.h"
-#include "components/mus/gpu/display_compositor/compositor_frame_sink_delegate.h"
-#include "components/mus/public/interfaces/gpu/display_compositor.mojom.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-
-namespace mus {
-namespace gpu {
-
-class CompositorFrameSinkImpl;
-
-class CompositorFrameSinkFactoryImpl : public mojom::CompositorFrameSinkFactory,
- public CompositorFrameSinkDelegate {
- public:
- CompositorFrameSinkFactoryImpl(
- uint32_t client_id,
- mojo::InterfaceRequest<mojom::CompositorFrameSinkFactory> request,
- const scoped_refptr<SurfacesState>& surfaces_state);
- ~CompositorFrameSinkFactoryImpl() override;
-
- uint32_t client_id() const { return client_id_; }
-
- void CompositorFrameSinkConnectionLost(int local_id) override;
- cc::SurfaceId GenerateSurfaceId() override;
-
- // mojom::CompositorFrameSinkFactory implementation.
- void CreateCompositorFrameSink(
- uint32_t local_id,
- uint64_t nonce,
- mojo::InterfaceRequest<mojom::CompositorFrameSink> sink,
- mojom::CompositorFrameSinkClientPtr client) override;
-
- private:
- const uint32_t client_id_;
- scoped_refptr<SurfacesState> surfaces_state_;
- cc::SurfaceIdAllocator allocator_;
- using CompositorFrameSinkMap =
- std::map<uint32_t, std::unique_ptr<CompositorFrameSinkImpl>>;
- CompositorFrameSinkMap sinks_;
- mojo::StrongBinding<mojom::CompositorFrameSinkFactory> binding_;
-
- DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkFactoryImpl);
-};
-
-} // namespace gpu
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_FACTORY_IMPL_H_
diff --git a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_impl.cc b/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_impl.cc
deleted file mode 100644
index 80bb15197df..00000000000
--- a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_impl.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright 2016 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.
-
-#include "components/mus/gpu/display_compositor/compositor_frame_sink_impl.h"
-
-#include "cc/ipc/compositor_frame.mojom.h"
-#include "cc/surfaces/surface_factory.h"
-#include "components/mus/gpu/display_compositor/compositor_frame_sink_delegate.h"
-
-namespace mus {
-namespace gpu {
-
-namespace {
-
-void CallCallback(
- const mojom::CompositorFrameSink::SubmitCompositorFrameCallback& callback,
- cc::SurfaceDrawStatus draw_status) {
- callback.Run(static_cast<mojom::CompositorFrameDrawStatus>(draw_status));
-}
-}
-
-CompositorFrameSinkImpl::CompositorFrameSinkImpl(
- CompositorFrameSinkDelegate* delegate,
- int sink_id,
- const scoped_refptr<SurfacesState>& surfaces_state,
- mojo::InterfaceRequest<mojom::CompositorFrameSink> request,
- mojom::CompositorFrameSinkClientPtr client)
- : delegate_(delegate),
- surfaces_state_(surfaces_state),
- sink_id_(sink_id),
- begin_frame_source_(nullptr),
- needs_begin_frame_(false),
- factory_(surfaces_state->manager(), this),
- client_(std::move(client)),
- binding_(this, std::move(request)) {
- DCHECK(delegate_);
- binding_.set_connection_error_handler(base::Bind(
- &CompositorFrameSinkImpl::OnConnectionLost, base::Unretained(this)));
-}
-
-CompositorFrameSinkImpl::~CompositorFrameSinkImpl() {}
-
-void CompositorFrameSinkImpl::SetNeedsBeginFrame(bool needs_begin_frame) {
- if (needs_begin_frame_ == needs_begin_frame)
- return;
-
- needs_begin_frame_ = needs_begin_frame;
- if (begin_frame_source_) {
- if (needs_begin_frame_)
- begin_frame_source_->AddObserver(this);
- else
- begin_frame_source_->RemoveObserver(this);
- }
-}
-
-void CompositorFrameSinkImpl::SubmitCompositorFrame(
- cc::CompositorFrame compositor_frame,
- const SubmitCompositorFrameCallback& callback) {
- gfx::Size frame_size =
- compositor_frame.delegated_frame_data->render_pass_list.back()
- ->output_rect.size();
- if (frame_size.IsEmpty() || frame_size != last_submitted_frame_size_) {
- if (!surface_id_.is_null())
- factory_.Destroy(surface_id_);
- // TODO(fsamuel): The allocator should live on CompositorFrameSinkFactory.
- surface_id_ = delegate_->GenerateSurfaceId();
- factory_.Create(surface_id_);
- last_submitted_frame_size_ = frame_size;
- }
- factory_.SubmitCompositorFrame(surface_id_, std::move(compositor_frame),
- base::Bind(&CallCallback, callback));
-}
-
-void CompositorFrameSinkImpl::ReturnResources(
- const cc::ReturnedResourceArray& resources) {
- if (!client_)
- return;
-
- client_->ReturnResources(mojo::Array<cc::ReturnedResource>::From(resources));
-}
-
-void CompositorFrameSinkImpl::WillDrawSurface(const cc::SurfaceId& surface_id,
- const gfx::Rect& damage_rect) {
- NOTIMPLEMENTED();
-}
-
-void CompositorFrameSinkImpl::SetBeginFrameSource(
- cc::BeginFrameSource* begin_frame_source) {
- begin_frame_source_ = begin_frame_source;
-}
-
-void CompositorFrameSinkImpl::OnBeginFrame(const cc::BeginFrameArgs& args) {
- // TODO(fsamuel): Implement this.
-}
-
-const cc::BeginFrameArgs& CompositorFrameSinkImpl::LastUsedBeginFrameArgs()
- const {
- // TODO(fsamuel): Implement this.
- return last_used_begin_frame_args_;
-}
-
-void CompositorFrameSinkImpl::OnBeginFrameSourcePausedChanged(bool paused) {
- // TODO(fsamuel): Implement this.
-}
-
-void CompositorFrameSinkImpl::OnConnectionLost() {
- delegate_->CompositorFrameSinkConnectionLost(sink_id_);
-}
-
-} // namespace gpu
-} // namespace mus
diff --git a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_impl.h b/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_impl.h
deleted file mode 100644
index e402a7ce2ce..00000000000
--- a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_impl.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2016 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.
-
-#ifndef COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_IMPL_H_
-#define COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_IMPL_H_
-
-#include "base/memory/ref_counted.h"
-#include "cc/scheduler/begin_frame_source.h"
-#include "cc/surfaces/surface_factory.h"
-#include "cc/surfaces/surface_factory_client.h"
-#include "cc/surfaces/surface_id.h"
-#include "components/mus/public/interfaces/gpu/display_compositor.mojom.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-
-namespace mus {
-namespace gpu {
-
-class CompositorFrameSinkDelegate;
-
-// A client presents visuals to screen by submitting CompositorFrames to a
-// CompositorFrameSink.
-class CompositorFrameSinkImpl : public cc::SurfaceFactoryClient,
- public mojom::CompositorFrameSink,
- public cc::BeginFrameObserver {
- public:
- CompositorFrameSinkImpl(
- CompositorFrameSinkDelegate* delegate,
- int sink_id,
- const scoped_refptr<SurfacesState>& surfaces_state,
- mojo::InterfaceRequest<mojom::CompositorFrameSink> request,
- mojom::CompositorFrameSinkClientPtr client);
- ~CompositorFrameSinkImpl() override;
-
- // mojom::CompositorFrameSink implementation.
- void SetNeedsBeginFrame(bool needs_begin_frame) override;
- void SubmitCompositorFrame(
- cc::CompositorFrame compositor_frame,
- const SubmitCompositorFrameCallback& callback) override;
-
- private:
- // SurfaceFactoryClient implementation.
- void ReturnResources(const cc::ReturnedResourceArray& resources) override;
- void WillDrawSurface(const cc::SurfaceId& surface_id,
- const gfx::Rect& damage_rect) override;
- void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
-
- // BeginFrameObserver implementation.
- void OnBeginFrame(const cc::BeginFrameArgs& args) override;
- const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override;
- void OnBeginFrameSourcePausedChanged(bool paused) override;
-
- void OnConnectionLost();
-
- CompositorFrameSinkDelegate* const delegate_;
- scoped_refptr<SurfacesState> surfaces_state_;
- const int sink_id_;
- cc::BeginFrameSource* begin_frame_source_;
- bool needs_begin_frame_;
- cc::BeginFrameArgs last_used_begin_frame_args_;
- cc::SurfaceFactory factory_;
- cc::SurfaceId surface_id_;
- gfx::Size last_submitted_frame_size_;
- mojom::CompositorFrameSinkClientPtr client_;
- mojo::Binding<mojom::CompositorFrameSink> binding_;
-
- DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkImpl);
-};
-
-} // namespace gpu
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_IMPL_H_
diff --git a/chromium/components/mus/gpu/display_compositor/display_compositor_impl.cc b/chromium/components/mus/gpu/display_compositor/display_compositor_impl.cc
deleted file mode 100644
index cf9a24df684..00000000000
--- a/chromium/components/mus/gpu/display_compositor/display_compositor_impl.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2016 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.
-
-#include "components/mus/gpu/display_compositor/display_compositor_impl.h"
-
-#include "components/mus/gpu/display_compositor/display_impl.h"
-
-namespace mus {
-namespace gpu {
-
-DisplayCompositorImpl::DisplayCompositorImpl(
- mojo::InterfaceRequest<mojom::DisplayCompositor> request)
- : binding_(this, std::move(request)) {}
-
-DisplayCompositorImpl::~DisplayCompositorImpl() {}
-
-void DisplayCompositorImpl::CreateDisplay(
- int accelerated_widget,
- mojo::InterfaceRequest<mojom::Display> display,
- mojom::DisplayHostPtr host,
- mojo::InterfaceRequest<mojom::CompositorFrameSink> sink,
- mojom::CompositorFrameSinkClientPtr client) {
- NOTIMPLEMENTED();
-}
-
-} // namespace gpu
-} // namespace mus
diff --git a/chromium/components/mus/gpu/display_compositor/display_compositor_impl.h b/chromium/components/mus/gpu/display_compositor/display_compositor_impl.h
deleted file mode 100644
index 237cc108b7c..00000000000
--- a/chromium/components/mus/gpu/display_compositor/display_compositor_impl.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2016 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.
-
-#ifndef COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_DISPLAY_COMPOSITOR_IMPL_H_
-#define COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_DISPLAY_COMPOSITOR_IMPL_H_
-
-#include "components/mus/public/interfaces/gpu/display_compositor.mojom.h"
-#include "components/mus/public/interfaces/gpu/display_compositor_host.mojom.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-
-namespace mus {
-namespace gpu {
-
-class DisplayCompositorImpl : public mojom::DisplayCompositor {
- public:
- explicit DisplayCompositorImpl(
- mojo::InterfaceRequest<mojom::DisplayCompositor> request);
- ~DisplayCompositorImpl() override;
-
- // mojom::DisplayCompositor implementation.
- void CreateDisplay(int accelerated_widget,
- mojo::InterfaceRequest<mojom::Display> display,
- mojom::DisplayHostPtr host,
- mojo::InterfaceRequest<mojom::CompositorFrameSink> sink,
- mojom::CompositorFrameSinkClientPtr client) override;
-
- private:
- mojo::StrongBinding<mojom::DisplayCompositor> binding_;
-
- DISALLOW_COPY_AND_ASSIGN(DisplayCompositorImpl);
-};
-
-} // namespace gpu
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_DISPLAY_COMPOSITOR_IMPL_H_
diff --git a/chromium/components/mus/gpu/display_compositor/display_impl.cc b/chromium/components/mus/gpu/display_compositor/display_impl.cc
deleted file mode 100644
index 274c67acbb1..00000000000
--- a/chromium/components/mus/gpu/display_compositor/display_impl.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2016 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.
-
-#include "components/mus/gpu/display_compositor/display_impl.h"
-
-#include "components/mus/gpu/display_compositor/compositor_frame_sink_impl.h"
-
-namespace mus {
-namespace gpu {
-
-DisplayImpl::DisplayImpl(
- int accelerated_widget,
- mojo::InterfaceRequest<mojom::Display> display,
- mojom::DisplayHostPtr host,
- mojo::InterfaceRequest<mojom::CompositorFrameSink> sink,
- mojom::CompositorFrameSinkClientPtr client,
- const scoped_refptr<SurfacesState>& surfaces_state)
- : binding_(this, std::move(display)) {
- const uint32_t client_id = 1;
- sink_.reset(new CompositorFrameSinkImpl(this, client_id, surfaces_state,
- std::move(sink), std::move(client)));
-}
-
-DisplayImpl::~DisplayImpl() {}
-
-void DisplayImpl::CreateClient(
- uint32_t client_id,
- mojo::InterfaceRequest<mojom::DisplayClient> client) {
- NOTIMPLEMENTED();
-}
-
-void DisplayImpl::CompositorFrameSinkConnectionLost(int sink_id) {
- NOTIMPLEMENTED();
-}
-
-cc::SurfaceId DisplayImpl::GenerateSurfaceId() {
- NOTIMPLEMENTED();
- return cc::SurfaceId();
-}
-
-} // namespace gpu
-} // namespace mus
diff --git a/chromium/components/mus/gpu/display_compositor/display_impl.h b/chromium/components/mus/gpu/display_compositor/display_impl.h
deleted file mode 100644
index c667bcbde03..00000000000
--- a/chromium/components/mus/gpu/display_compositor/display_impl.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2016 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.
-
-#ifndef COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_DISPLAY_IMPL_H_
-#define COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_DISPLAY_IMPL_H_
-
-#include "components/mus/gpu/display_compositor/compositor_frame_sink_delegate.h"
-#include "components/mus/public/interfaces/gpu/display_compositor_host.mojom.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "mojo/public/cpp/bindings/binding.h"
-
-namespace mus {
-namespace gpu {
-
-class DisplayImpl : public mojom::Display, public CompositorFrameSinkDelegate {
- public:
- DisplayImpl(int accelerated_widget,
- mojo::InterfaceRequest<mojom::Display> display,
- mojom::DisplayHostPtr host,
- mojo::InterfaceRequest<mojom::CompositorFrameSink> sink,
- mojom::CompositorFrameSinkClientPtr client,
- const scoped_refptr<SurfacesState>& surfaces_state);
- ~DisplayImpl() override;
-
- // mojom::Display implementation.
- void CreateClient(
- uint32_t client_id,
- mojo::InterfaceRequest<mojom::DisplayClient> client) override;
-
- private:
- // CompositorFrameSinkDelegate implementation:
- void CompositorFrameSinkConnectionLost(int sink_id) override;
- cc::SurfaceId GenerateSurfaceId() override;
-
- std::unique_ptr<CompositorFrameSinkImpl> sink_;
- mojo::Binding<mojom::Display> binding_;
- DISALLOW_COPY_AND_ASSIGN(DisplayImpl);
-};
-
-} // namespace gpu
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_DISPLAY_IMPL_H_
diff --git a/chromium/components/mus/gpu/gpu_service_impl.cc b/chromium/components/mus/gpu/gpu_service_impl.cc
deleted file mode 100644
index 9ea83820ffe..00000000000
--- a/chromium/components/mus/gpu/gpu_service_impl.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2016 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.
-
-#include "components/mus/gpu/gpu_service_impl.h"
-
-#include "components/mus/common/gpu_type_converters.h"
-#include "components/mus/gpu/gpu_service_mus.h"
-#include "services/shell/public/cpp/connection.h"
-
-namespace mus {
-
-namespace {
-
-void EstablishGpuChannelDone(
- const mojom::GpuService::EstablishGpuChannelCallback& callback,
- int32_t client_id,
- const IPC::ChannelHandle& channel_handle) {
- // TODO(penghuang): Send the real GPUInfo to the client.
- callback.Run(client_id, mojom::ChannelHandle::From(channel_handle),
- mojom::GpuInfo::From<gpu::GPUInfo>(gpu::GPUInfo()));
-}
-}
-
-GpuServiceImpl::GpuServiceImpl(
- mojo::InterfaceRequest<mojom::GpuService> request,
- shell::Connection* connection)
- : binding_(this, std::move(request)) {}
-
-GpuServiceImpl::~GpuServiceImpl() {}
-
-void GpuServiceImpl::EstablishGpuChannel(
- const mojom::GpuService::EstablishGpuChannelCallback& callback) {
- GpuServiceMus* service = GpuServiceMus::GetInstance();
- // TODO(penghuang): crbug.com/617415 figure out how to generate a meaningful
- // tracing id.
- const uint64_t client_tracing_id = 0;
- // TODO(penghuang): windows server may want to control those flags.
- // Add a private interface for windows server.
- const bool preempts = false;
- const bool allow_view_command_buffers = false;
- const bool allow_real_time_streams = false;
- service->EstablishGpuChannel(
- client_tracing_id, preempts, allow_view_command_buffers,
- allow_real_time_streams, base::Bind(&EstablishGpuChannelDone, callback));
-}
-
-void GpuServiceImpl::CreateGpuMemoryBuffer(
- mojom::GpuMemoryBufferIdPtr id,
- const gfx::Size& size,
- mojom::BufferFormat format,
- mojom::BufferUsage usage,
- uint64_t surface_id,
- const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) {
- NOTIMPLEMENTED();
-}
-
-void GpuServiceImpl::DestroyGpuMemoryBuffer(mojom::GpuMemoryBufferIdPtr id,
- const gpu::SyncToken& sync_token) {
- NOTIMPLEMENTED();
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/gpu/gpu_service_impl.h b/chromium/components/mus/gpu/gpu_service_impl.h
deleted file mode 100644
index 9d5f66ec715..00000000000
--- a/chromium/components/mus/gpu/gpu_service_impl.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2016 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.
-
-#ifndef COMPONENTS_MUS_GPU_GPU_SERVICE_IMPL_H_
-#define COMPONENTS_MUS_GPU_GPU_SERVICE_IMPL_H_
-
-#include "components/mus/public/interfaces/gpu_memory_buffer.mojom.h"
-#include "components/mus/public/interfaces/gpu_service.mojom.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-
-namespace shell {
-class Connection;
-}
-
-namespace mus {
-
-class GpuServiceImpl : public mojom::GpuService {
- public:
- GpuServiceImpl(mojo::InterfaceRequest<mojom::GpuService> request,
- shell::Connection* connection);
- ~GpuServiceImpl() override;
-
- // mojom::GpuService overrides:
- void EstablishGpuChannel(
- const mojom::GpuService::EstablishGpuChannelCallback& callback) override;
-
- void CreateGpuMemoryBuffer(
- mojom::GpuMemoryBufferIdPtr id,
- const gfx::Size& size,
- mojom::BufferFormat format,
- mojom::BufferUsage usage,
- uint64_t surface_id,
- const mojom::GpuService::CreateGpuMemoryBufferCallback& callback)
- override;
-
- void DestroyGpuMemoryBuffer(mojom::GpuMemoryBufferIdPtr id,
- const gpu::SyncToken& sync_token) override;
-
- private:
- mojo::StrongBinding<GpuService> binding_;
-
- DISALLOW_COPY_AND_ASSIGN(GpuServiceImpl);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GPU_GPU_SERVICE_IMPL_H_
diff --git a/chromium/components/mus/gpu/gpu_service_mus.cc b/chromium/components/mus/gpu/gpu_service_mus.cc
deleted file mode 100644
index 43ddb21ab00..00000000000
--- a/chromium/components/mus/gpu/gpu_service_mus.cc
+++ /dev/null
@@ -1,273 +0,0 @@
-// Copyright 2016 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.
-
-#include "components/mus/gpu/gpu_service_mus.h"
-
-#include "base/memory/shared_memory.h"
-#include "base/memory/singleton.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "build/build_config.h"
-#include "components/mus/gpu/mus_gpu_memory_buffer_manager.h"
-#include "gpu/command_buffer/service/gpu_switches.h"
-#include "gpu/command_buffer/service/sync_point_manager.h"
-#include "gpu/config/gpu_info_collector.h"
-#include "gpu/config/gpu_switches.h"
-#include "gpu/config/gpu_util.h"
-#include "gpu/ipc/common/gpu_memory_buffer_support.h"
-#include "gpu/ipc/common/memory_stats.h"
-#include "gpu/ipc/service/gpu_memory_buffer_factory.h"
-#include "ipc/ipc_channel_handle.h"
-#include "ipc/ipc_sync_message_filter.h"
-#include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h"
-#include "media/gpu/ipc/service/gpu_video_decode_accelerator.h"
-#include "media/gpu/ipc/service/gpu_video_encode_accelerator.h"
-#include "media/gpu/ipc/service/media_service.h"
-#include "ui/gl/gl_implementation.h"
-#include "ui/gl/gl_switches.h"
-#include "ui/gl/gpu_switching_manager.h"
-#include "ui/gl/init/gl_factory.h"
-#include "url/gurl.h"
-
-#if defined(USE_OZONE)
-#include "ui/ozone/public/ozone_platform.h"
-#endif
-
-namespace mus {
-namespace {
-
-const int kLocalGpuChannelClientId = 1;
-const uint64_t kLocalGpuChannelClientTracingId = 1;
-
-void EstablishGpuChannelDone(
- int client_id,
- const IPC::ChannelHandle* channel_handle,
- const GpuServiceMus::EstablishGpuChannelCallback& callback) {
- callback.Run(channel_handle ? client_id : -1, *channel_handle);
-}
-}
-
-GpuServiceMus::GpuServiceMus()
- : next_client_id_(kLocalGpuChannelClientId),
- main_task_runner_(base::ThreadTaskRunnerHandle::Get()),
- shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL,
- base::WaitableEvent::InitialState::NOT_SIGNALED),
- gpu_thread_("GpuThread"),
- io_thread_("GpuIOThread") {
- Initialize();
-}
-
-GpuServiceMus::~GpuServiceMus() {
- // Signal this event before destroying the child process. That way all
- // background threads can cleanup.
- // For example, in the renderer the RenderThread instances will be able to
- // notice shutdown before the render process begins waiting for them to exit.
- shutdown_event_.Signal();
- io_thread_.Stop();
-}
-
-void GpuServiceMus::EstablishGpuChannel(
- uint64_t client_tracing_id,
- bool preempts,
- bool allow_view_command_buffers,
- bool allow_real_time_streams,
- const EstablishGpuChannelCallback& callback) {
- DCHECK(CalledOnValidThread());
-
- if (!gpu_channel_manager_) {
- callback.Run(-1, IPC::ChannelHandle());
- return;
- }
-
- const int client_id = ++next_client_id_;
- IPC::ChannelHandle* channel_handle = new IPC::ChannelHandle;
- gpu_thread_.task_runner()->PostTaskAndReply(
- FROM_HERE,
- base::Bind(&GpuServiceMus::EstablishGpuChannelOnGpuThread,
- base::Unretained(this), client_id, client_tracing_id, preempts,
- allow_view_command_buffers, allow_real_time_streams,
- base::Unretained(channel_handle)),
- base::Bind(&EstablishGpuChannelDone, client_id,
- base::Owned(channel_handle), callback));
-}
-
-gfx::GpuMemoryBufferHandle GpuServiceMus::CreateGpuMemoryBuffer(
- gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage,
- int client_id,
- gpu::SurfaceHandle surface_handle) {
- DCHECK(CalledOnValidThread());
- return gpu_memory_buffer_factory_->CreateGpuMemoryBuffer(
- id, size, format, usage, client_id, surface_handle);
-}
-
-void GpuServiceMus::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
- int client_id,
- const gpu::SyncToken& sync_token) {
- DCHECK(CalledOnValidThread());
-
- if (gpu_channel_manager_)
- gpu_channel_manager_->DestroyGpuMemoryBuffer(id, client_id, sync_token);
-}
-
-void GpuServiceMus::DidCreateOffscreenContext(const GURL& active_url) {
- NOTIMPLEMENTED();
-}
-
-void GpuServiceMus::DidDestroyChannel(int client_id) {
- media_service_->RemoveChannel(client_id);
- NOTIMPLEMENTED();
-}
-
-void GpuServiceMus::DidDestroyOffscreenContext(const GURL& active_url) {
- NOTIMPLEMENTED();
-}
-
-void GpuServiceMus::DidLoseContext(bool offscreen,
- gpu::error::ContextLostReason reason,
- const GURL& active_url) {
- NOTIMPLEMENTED();
-}
-
-void GpuServiceMus::GpuMemoryUmaStats(const gpu::GPUMemoryUmaStats& params) {
- NOTIMPLEMENTED();
-}
-
-void GpuServiceMus::StoreShaderToDisk(int client_id,
- const std::string& key,
- const std::string& shader) {
- NOTIMPLEMENTED();
-}
-
-#if defined(OS_WIN)
-void GpuServiceMus::SendAcceleratedSurfaceCreatedChildWindow(
- gpu::SurfaceHandle parent_window,
- gpu::SurfaceHandle child_window) {
- NOTIMPLEMENTED();
-}
-#endif
-
-void GpuServiceMus::SetActiveURL(const GURL& url) {
- NOTIMPLEMENTED();
-}
-
-void GpuServiceMus::Initialize() {
- DCHECK(CalledOnValidThread());
- base::Thread::Options thread_options(base::MessageLoop::TYPE_DEFAULT, 0);
- thread_options.priority = base::ThreadPriority::NORMAL;
- CHECK(gpu_thread_.StartWithOptions(thread_options));
-
- thread_options = base::Thread::Options(base::MessageLoop::TYPE_IO, 0);
- thread_options.priority = base::ThreadPriority::NORMAL;
-#if defined(OS_ANDROID)
- // TODO(reveman): Remove this in favor of setting it explicitly for each type
- // of process.
- thread_options.priority = base::ThreadPriority::DISPLAY;
-#endif
- CHECK(io_thread_.StartWithOptions(thread_options));
-
- IPC::ChannelHandle channel_handle;
- base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL,
- base::WaitableEvent::InitialState::NOT_SIGNALED);
- gpu_thread_.task_runner()->PostTask(
- FROM_HERE, base::Bind(&GpuServiceMus::InitializeOnGpuThread,
- base::Unretained(this), &channel_handle, &event));
- event.Wait();
-
- gpu_memory_buffer_manager_local_.reset(
- new MusGpuMemoryBufferManager(this, kLocalGpuChannelClientId));
- gpu_channel_local_ = gpu::GpuChannelHost::Create(
- this, kLocalGpuChannelClientId, gpu_info_, channel_handle,
- &shutdown_event_, gpu_memory_buffer_manager_local_.get());
-}
-
-void GpuServiceMus::InitializeOnGpuThread(IPC::ChannelHandle* channel_handle,
- base::WaitableEvent* event) {
- gpu_info_.video_decode_accelerator_capabilities =
- media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_);
- gpu_info_.video_encode_accelerator_supported_profiles =
- media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences_);
- gpu_info_.jpeg_decode_accelerator_supported =
- media::GpuJpegDecodeAccelerator::IsSupported();
-
-#if defined(USE_OZONE)
- ui::OzonePlatform::InitializeForGPU();
-#endif
-
- if (gpu::GetNativeGpuMemoryBufferType() != gfx::EMPTY_BUFFER) {
- gpu_memory_buffer_factory_ =
- gpu::GpuMemoryBufferFactory::CreateNativeType();
- }
-
- if (!gl::init::InitializeGLOneOff())
- VLOG(1) << "gl::init::InitializeGLOneOff failed";
-
- DCHECK(!owned_sync_point_manager_);
- const bool allow_threaded_wait = false;
- owned_sync_point_manager_.reset(
- new gpu::SyncPointManager(allow_threaded_wait));
-
- // Defer creation of the render thread. This is to prevent it from handling
- // IPC messages before the sandbox has been enabled and all other necessary
- // initialization has succeeded.
- // TODO(penghuang): implement a watchdog.
- gpu::GpuWatchdog* watchdog = nullptr;
- gpu_channel_manager_.reset(new gpu::GpuChannelManager(
- gpu_preferences_, this, watchdog,
- base::ThreadTaskRunnerHandle::Get().get(), io_thread_.task_runner().get(),
- &shutdown_event_, owned_sync_point_manager_.get(),
- gpu_memory_buffer_factory_.get()));
-
- media_service_.reset(new media::MediaService(gpu_channel_manager_.get()));
-
- const bool preempts = true;
- const bool allow_view_command_buffers = true;
- const bool allow_real_time_streams = true;
- EstablishGpuChannelOnGpuThread(
- kLocalGpuChannelClientId, kLocalGpuChannelClientTracingId, preempts,
- allow_view_command_buffers, allow_real_time_streams, channel_handle);
- event->Signal();
-}
-
-void GpuServiceMus::EstablishGpuChannelOnGpuThread(
- int client_id,
- uint64_t client_tracing_id,
- bool preempts,
- bool allow_view_command_buffers,
- bool allow_real_time_streams,
- IPC::ChannelHandle* channel_handle) {
- if (gpu_channel_manager_) {
- *channel_handle = gpu_channel_manager_->EstablishChannel(
- client_id, client_tracing_id, preempts, allow_view_command_buffers,
- allow_real_time_streams);
- media_service_->AddChannel(client_id);
- }
-}
-
-bool GpuServiceMus::IsMainThread() {
- return main_task_runner_->BelongsToCurrentThread();
-}
-
-scoped_refptr<base::SingleThreadTaskRunner>
-GpuServiceMus::GetIOThreadTaskRunner() {
- return io_thread_.task_runner();
-}
-
-std::unique_ptr<base::SharedMemory> GpuServiceMus::AllocateSharedMemory(
- size_t size) {
- std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory());
- if (!shm->CreateAnonymous(size))
- return std::unique_ptr<base::SharedMemory>();
- return shm;
-}
-
-// static
-GpuServiceMus* GpuServiceMus::GetInstance() {
- return base::Singleton<GpuServiceMus,
- base::LeakySingletonTraits<GpuServiceMus>>::get();
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/gpu/gpu_service_mus.h b/chromium/components/mus/gpu/gpu_service_mus.h
deleted file mode 100644
index b6bfd1b69f5..00000000000
--- a/chromium/components/mus/gpu/gpu_service_mus.h
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright 2016 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.
-
-#ifndef COMPONENTS_MUS_GPU_GPU_SERVICE_MUS_H_
-#define COMPONENTS_MUS_GPU_GPU_SERVICE_MUS_H_
-
-#include "base/callback.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/threading/non_thread_safe.h"
-#include "base/threading/thread.h"
-#include "build/build_config.h"
-#include "gpu/command_buffer/service/gpu_preferences.h"
-#include "gpu/config/gpu_info.h"
-#include "gpu/ipc/client/gpu_channel_host.h"
-#include "gpu/ipc/common/surface_handle.h"
-#include "gpu/ipc/service/gpu_channel.h"
-#include "gpu/ipc/service/gpu_channel_manager.h"
-#include "gpu/ipc/service/gpu_channel_manager_delegate.h"
-#include "gpu/ipc/service/gpu_config.h"
-#include "gpu/ipc/service/x_util.h"
-#include "ui/gfx/native_widget_types.h"
-
-namespace base {
-template <typename T>
-struct DefaultSingletonTraits;
-}
-
-namespace IPC {
-struct ChannelHandle;
-}
-
-namespace gpu {
-class GpuChannelHost;
-class GpuMemoryBufferFactory;
-class SyncPointManager;
-}
-
-namespace media {
-class MediaService;
-}
-
-namespace mus {
-
-class MusGpuMemoryBufferManager;
-
-// TODO(fsamuel): GpuServiceMus is intended to be the Gpu thread within Mus.
-// Similar to GpuChildThread, it is a GpuChannelManagerDelegate and will have a
-// GpuChannelManager.
-class GpuServiceMus : public gpu::GpuChannelManagerDelegate,
- public gpu::GpuChannelHostFactory,
- public base::NonThreadSafe {
- public:
- typedef base::Callback<void(int client_id, const IPC::ChannelHandle&)>
- EstablishGpuChannelCallback;
- void EstablishGpuChannel(uint64_t client_tracing_id,
- bool preempts,
- bool allow_view_command_buffers,
- bool allow_real_time_streams,
- const EstablishGpuChannelCallback& callback);
- gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer(
- gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage,
- int client_id,
- gpu::SurfaceHandle surface_handle);
- gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle(
- gfx::GpuMemoryBufferHandle buffer_handle,
- gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- gfx::BufferFormat format,
- int client_id);
- void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
- int client_id,
- const gpu::SyncToken& sync_token);
-
- gpu::GpuChannelManager* gpu_channel_manager() const {
- return gpu_channel_manager_.get();
- }
-
- gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory() const {
- return gpu_memory_buffer_factory_.get();
- }
-
- scoped_refptr<gpu::GpuChannelHost> gpu_channel_local() const {
- return gpu_channel_local_;
- }
-
- const gpu::GPUInfo& gpu_info() const { return gpu_info_; }
-
- // GpuChannelManagerDelegate overrides:
- void DidCreateOffscreenContext(const GURL& active_url) override;
- void DidDestroyChannel(int client_id) override;
- void DidDestroyOffscreenContext(const GURL& active_url) override;
- void DidLoseContext(bool offscreen,
- gpu::error::ContextLostReason reason,
- const GURL& active_url) override;
- void GpuMemoryUmaStats(const gpu::GPUMemoryUmaStats& params) override;
- void StoreShaderToDisk(int client_id,
- const std::string& key,
- const std::string& shader) override;
-#if defined(OS_WIN)
- void SendAcceleratedSurfaceCreatedChildWindow(
- gpu::SurfaceHandle parent_window,
- gpu::SurfaceHandle child_window) override;
-#endif
- void SetActiveURL(const GURL& url) override;
-
- // GpuChannelHostFactory overrides:
- bool IsMainThread() override;
- scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override;
- std::unique_ptr<base::SharedMemory> AllocateSharedMemory(
- size_t size) override;
-
- static GpuServiceMus* GetInstance();
-
- private:
- friend struct base::DefaultSingletonTraits<GpuServiceMus>;
-
- GpuServiceMus();
- ~GpuServiceMus() override;
-
- void Initialize();
- void InitializeOnGpuThread(IPC::ChannelHandle* channel_handle,
- base::WaitableEvent* event);
- void EstablishGpuChannelOnGpuThread(int client_id,
- uint64_t client_tracing_id,
- bool preempts,
- bool allow_view_command_buffers,
- bool allow_real_time_streams,
- IPC::ChannelHandle* channel_handle);
-
- // The next client id.
- int next_client_id_;
-
- // The main thread task runner.
- scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
-
- // An event that will be signalled when we shutdown.
- base::WaitableEvent shutdown_event_;
-
- // The main thread for GpuService.
- base::Thread gpu_thread_;
-
- // The thread that handles IO events for GpuService.
- base::Thread io_thread_;
-
- std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_;
-
- std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_;
-
- std::unique_ptr<media::MediaService> media_service_;
-
- std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_;
-
- // A GPU memory buffer manager used locally.
- std::unique_ptr<MusGpuMemoryBufferManager> gpu_memory_buffer_manager_local_;
-
- // A GPU channel used locally.
- scoped_refptr<gpu::GpuChannelHost> gpu_channel_local_;
-
- gpu::GpuPreferences gpu_preferences_;
-
- // Information about the GPU, such as device and vendor ID.
- gpu::GPUInfo gpu_info_;
-
- DISALLOW_COPY_AND_ASSIGN(GpuServiceMus);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GPU_GPU_SERVICE_MUS_H_
diff --git a/chromium/components/mus/gpu/mus_gpu_memory_buffer_manager.cc b/chromium/components/mus/gpu/mus_gpu_memory_buffer_manager.cc
deleted file mode 100644
index d9ecbd3257a..00000000000
--- a/chromium/components/mus/gpu/mus_gpu_memory_buffer_manager.cc
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2016 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.
-
-#include "components/mus/gpu/mus_gpu_memory_buffer_manager.h"
-
-#include "base/logging.h"
-#include "components/mus/common/generic_shared_memory_id_generator.h"
-#include "components/mus/gpu/gpu_service_mus.h"
-#include "gpu/ipc/client/gpu_memory_buffer_impl.h"
-#include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h"
-#include "gpu/ipc/common/gpu_memory_buffer_support.h"
-#include "gpu/ipc/service/gpu_memory_buffer_factory.h"
-
-namespace mus {
-
-namespace {
-
-MusGpuMemoryBufferManager* g_gpu_memory_buffer_manager = nullptr;
-
-bool IsNativeGpuMemoryBufferFactoryConfigurationSupported(
- gfx::BufferFormat format,
- gfx::BufferUsage usage) {
- switch (gpu::GetNativeGpuMemoryBufferType()) {
- case gfx::SHARED_MEMORY_BUFFER:
- return false;
- case gfx::IO_SURFACE_BUFFER:
- case gfx::SURFACE_TEXTURE_BUFFER:
- case gfx::OZONE_NATIVE_PIXMAP:
- return gpu::IsNativeGpuMemoryBufferConfigurationSupported(format, usage);
- default:
- NOTREACHED();
- return false;
- }
-}
-}
-
-MusGpuMemoryBufferManager* MusGpuMemoryBufferManager::current() {
- return g_gpu_memory_buffer_manager;
-}
-
-MusGpuMemoryBufferManager::MusGpuMemoryBufferManager(GpuServiceMus* gpu_service,
- int client_id)
- : gpu_service_(gpu_service), client_id_(client_id), weak_factory_(this) {
- DCHECK(!g_gpu_memory_buffer_manager);
- g_gpu_memory_buffer_manager = this;
-}
-
-MusGpuMemoryBufferManager::~MusGpuMemoryBufferManager() {
- g_gpu_memory_buffer_manager = nullptr;
-}
-
-std::unique_ptr<gfx::GpuMemoryBuffer>
-MusGpuMemoryBufferManager::AllocateGpuMemoryBuffer(
- const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage,
- gpu::SurfaceHandle surface_handle) {
- gfx::GpuMemoryBufferId id = GetNextGenericSharedMemoryId();
- const bool is_native =
- IsNativeGpuMemoryBufferFactoryConfigurationSupported(format, usage);
- if (is_native) {
- gfx::GpuMemoryBufferHandle handle =
- gpu_service_->gpu_memory_buffer_factory()->CreateGpuMemoryBuffer(
- id, size, format, usage, client_id_, surface_handle);
- if (handle.is_null())
- return nullptr;
- return gpu::GpuMemoryBufferImpl::CreateFromHandle(
- handle, size, format, usage,
- base::Bind(&MusGpuMemoryBufferManager::DestroyGpuMemoryBuffer,
- weak_factory_.GetWeakPtr(), id, client_id_, is_native));
- }
-
- DCHECK(gpu::GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage))
- << static_cast<int>(usage);
- return gpu::GpuMemoryBufferImplSharedMemory::Create(
- id, size, format,
- base::Bind(&MusGpuMemoryBufferManager::DestroyGpuMemoryBuffer,
- weak_factory_.GetWeakPtr(), id, client_id_, is_native));
-}
-
-std::unique_ptr<gfx::GpuMemoryBuffer>
-MusGpuMemoryBufferManager::CreateGpuMemoryBufferFromHandle(
- const gfx::GpuMemoryBufferHandle& handle,
- const gfx::Size& size,
- gfx::BufferFormat format) {
- NOTIMPLEMENTED();
- return nullptr;
-}
-
-gfx::GpuMemoryBuffer*
-MusGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer(
- ClientBuffer buffer) {
- return gpu::GpuMemoryBufferImpl::FromClientBuffer(buffer);
-}
-
-void MusGpuMemoryBufferManager::SetDestructionSyncToken(
- gfx::GpuMemoryBuffer* buffer,
- const gpu::SyncToken& sync_token) {
- static_cast<gpu::GpuMemoryBufferImpl*>(buffer)->set_destruction_sync_token(
- sync_token);
-}
-
-void MusGpuMemoryBufferManager::DestroyGpuMemoryBuffer(
- gfx::GpuMemoryBufferId id,
- int client_id,
- bool is_native,
- const gpu::SyncToken& sync_token) {
- if (is_native) {
- gpu_service_->gpu_channel_manager()->DestroyGpuMemoryBuffer(id, client_id,
- sync_token);
- }
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/gpu/mus_gpu_memory_buffer_manager.h b/chromium/components/mus/gpu/mus_gpu_memory_buffer_manager.h
deleted file mode 100644
index b705dd68bb8..00000000000
--- a/chromium/components/mus/gpu/mus_gpu_memory_buffer_manager.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2016 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.
-
-#ifndef COMPONENTS_MUS_GPU_MUS_GPU_MEMORY_BUFFER_MANAGER_H_
-#define COMPONENTS_MUS_GPU_MUS_GPU_MEMORY_BUFFER_MANAGER_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
-
-namespace mus {
-
-class GpuServiceMus;
-
-// This GpuMemoryBufferManager is for establishing a GpuChannelHost used by
-// mus locally.
-class MusGpuMemoryBufferManager : public gpu::GpuMemoryBufferManager {
- public:
- MusGpuMemoryBufferManager(GpuServiceMus* gpu_service, int client_id);
- ~MusGpuMemoryBufferManager() override;
-
- static MusGpuMemoryBufferManager* current();
-
- // Overridden from gpu::GpuMemoryBufferManager:
- std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer(
- const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage,
- gpu::SurfaceHandle surface_handle) override;
- std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle(
- const gfx::GpuMemoryBufferHandle& handle,
- const gfx::Size& size,
- gfx::BufferFormat format) override;
- gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer(
- ClientBuffer buffer) override;
- void SetDestructionSyncToken(gfx::GpuMemoryBuffer* buffer,
- const gpu::SyncToken& sync_token) override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MusGpuMemoryBufferManager);
-
- void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
- int client_id,
- bool is_native,
- const gpu::SyncToken& sync_token);
-
- GpuServiceMus* gpu_service_;
- const int client_id_;
- base::WeakPtrFactory<MusGpuMemoryBufferManager> weak_factory_;
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GPU_MUS_GPU_MEMORY_BUFFER_MANAGER_H_
diff --git a/chromium/components/mus/gpu/mus_gpu_unittests_app_manifest.json b/chromium/components/mus/gpu/mus_gpu_unittests_app_manifest.json
deleted file mode 100644
index 26e8caa4802..00000000000
--- a/chromium/components/mus/gpu/mus_gpu_unittests_app_manifest.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "manifest_version": 1,
- "name": "mojo:mus_gpu_unittests_app",
- "display_name": "Mus GPU Unittests",
- "capabilities": {
- "required": {
- "*": { "classes": [ "app" ] }
- }
- }
-}