Commit 897c707e authored by sadrul's avatar sadrul Committed by Commit bot

mus: More gpu-related renames.

. GpuServiceProxy -> GpuHost
. GpuServiceProxyDelegate -> GpuHostDelegate
. GpuServiceHost -> GpuHost
. GpuServiceImpl -> GpuClient
. GpuServiceInternal -> GpuService

BUG=none

Review-Url: https://codereview.chromium.org/2559183003
Cr-Commit-Position: refs/heads/master@{#437606}
parent 6cbb9199
......@@ -8,12 +8,12 @@
#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 "services/ui/gpu/interfaces/gpu_service_internal.mojom.h"
#include "services/ui/gpu/interfaces/gpu_service.mojom.h"
namespace ui {
ServerGpuMemoryBufferManager::ServerGpuMemoryBufferManager(
mojom::GpuServiceInternal* gpu_service,
mojom::GpuService* gpu_service,
int client_id)
: gpu_service_(gpu_service),
client_id_(client_id),
......
......@@ -12,7 +12,7 @@
#include "base/threading/thread_checker.h"
#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
#include "gpu/ipc/host/gpu_memory_buffer_support.h"
#include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h"
#include "services/ui/gpu/interfaces/gpu_service.mojom.h"
namespace ui {
......@@ -21,8 +21,7 @@ namespace ui {
class ServerGpuMemoryBufferManager : public gpu::GpuMemoryBufferManager,
public base::ThreadChecker {
public:
ServerGpuMemoryBufferManager(mojom::GpuServiceInternal* gpu_service,
int client_id);
ServerGpuMemoryBufferManager(mojom::GpuService* gpu_service, int client_id);
~ServerGpuMemoryBufferManager() override;
void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
......@@ -53,7 +52,7 @@ class ServerGpuMemoryBufferManager : public gpu::GpuMemoryBufferManager,
const gpu::SyncToken& sync_token) override;
private:
mojom::GpuServiceInternal* gpu_service_;
mojom::GpuService* gpu_service_;
const int client_id_;
int next_gpu_memory_id_ = 1;
......
......@@ -12,8 +12,8 @@ source_set("gpu") {
sources = [
"gpu_main.cc",
"gpu_main.h",
"gpu_service_internal.cc",
"gpu_service_internal.h",
"gpu_service.cc",
"gpu_service.h",
]
defines = [ "NOTIMPLEMENTED_POLICY=5" ]
......
......@@ -11,7 +11,7 @@
#include "gpu/ipc/service/gpu_memory_buffer_factory.h"
#include "gpu/ipc/service/gpu_watchdog_thread.h"
#include "services/ui/common/server_gpu_memory_buffer_manager.h"
#include "services/ui/gpu/gpu_service_internal.h"
#include "services/ui/gpu/gpu_service.h"
namespace {
......@@ -110,8 +110,8 @@ void GpuMain::OnStart() {
io_thread_.task_runner(), compositor_thread_.task_runner()));
}
void GpuMain::CreateGpuService(mojom::GpuServiceInternalRequest request,
mojom::GpuServiceHostPtr gpu_host) {
void GpuMain::CreateGpuService(mojom::GpuServiceRequest request,
mojom::GpuHostPtr gpu_host) {
// |this| will outlive the gpu thread and so it's safe to use
// base::Unretained here.
gpu_thread_.task_runner()->PostTask(
......@@ -124,7 +124,7 @@ void GpuMain::CreateGpuService(mojom::GpuServiceInternalRequest request,
void GpuMain::CreateDisplayCompositor(
cc::mojom::DisplayCompositorRequest request,
cc::mojom::DisplayCompositorClientPtr client) {
if (!gpu_service_internal_) {
if (!gpu_service_) {
pending_display_compositor_request_ = std::move(request);
pending_display_compositor_client_info_ = client.PassInterface();
return;
......@@ -147,7 +147,7 @@ void GpuMain::InitOnGpuThread(
gpu::GpuMemoryBufferFactory::CreateNativeType();
}
gpu_service_internal_ = base::MakeUnique<GpuServiceInternal>(
gpu_service_ = base::MakeUnique<GpuService>(
gpu_init_->gpu_info(), gpu_init_->TakeWatchdogThread(),
gpu_memory_buffer_factory_.get(), io_runner);
}
......@@ -157,23 +157,21 @@ void GpuMain::CreateDisplayCompositorInternal(
cc::mojom::DisplayCompositorClientPtrInfo client_info) {
DCHECK(!gpu_command_service_);
gpu_command_service_ = new gpu::GpuInProcessThreadService(
gpu_thread_.task_runner(), gpu_service_internal_->sync_point_manager(),
gpu_service_internal_->mailbox_manager(),
gpu_service_internal_->share_group());
gpu_thread_.task_runner(), gpu_service_->sync_point_manager(),
gpu_service_->mailbox_manager(), gpu_service_->share_group());
// |gpu_memory_buffer_factory_| is null in tests.
gpu::ImageFactory* image_factory =
gpu_memory_buffer_factory_ ? gpu_memory_buffer_factory_->AsImageFactory()
: nullptr;
mojom::GpuServiceInternalPtr gpu_service;
mojom::GpuServiceInternalRequest gpu_service_request =
mojo::GetProxy(&gpu_service);
mojom::GpuServicePtr gpu_service;
mojom::GpuServiceRequest gpu_service_request = mojo::GetProxy(&gpu_service);
if (gpu_thread_.task_runner()->BelongsToCurrentThread()) {
// If the DisplayCompositor creation was delayed because GpuServiceInternal
// If the DisplayCompositor creation was delayed because GpuService
// had not been created yet, then this is called, in gpu thread, right after
// GpuServiceInternal is created.
// GpuService is created.
BindGpuInternalOnGpuThread(std::move(gpu_service_request));
} else {
gpu_thread_.task_runner()->PostTask(
......@@ -192,7 +190,7 @@ void GpuMain::CreateDisplayCompositorInternal(
void GpuMain::CreateDisplayCompositorOnCompositorThread(
gpu::ImageFactory* image_factory,
mojom::GpuServiceInternalPtrInfo gpu_service_info,
mojom::GpuServicePtrInfo gpu_service_info,
cc::mojom::DisplayCompositorRequest request,
cc::mojom::DisplayCompositorClientPtrInfo client_info) {
DCHECK(!display_compositor_);
......@@ -213,18 +211,18 @@ void GpuMain::TearDownOnCompositorThread() {
}
void GpuMain::TearDownOnGpuThread() {
gpu_service_internal_.reset();
gpu_service_.reset();
gpu_memory_buffer_factory_.reset();
gpu_init_.reset();
}
void GpuMain::CreateGpuServiceOnGpuThread(
mojom::GpuServiceInternalRequest request,
mojom::GpuServiceHostPtrInfo gpu_host_info) {
mojom::GpuServiceHostPtr gpu_host;
mojom::GpuServiceRequest request,
mojom::GpuHostPtrInfo gpu_host_info) {
mojom::GpuHostPtr gpu_host;
gpu_host.Bind(std::move(gpu_host_info));
gpu_service_internal_->InitializeWithHost(std::move(gpu_host));
gpu_service_internal_->Bind(std::move(request));
gpu_service_->InitializeWithHost(std::move(gpu_host));
gpu_service_->Bind(std::move(request));
if (pending_display_compositor_request_.is_pending()) {
CreateDisplayCompositorInternal(
......@@ -233,9 +231,8 @@ void GpuMain::CreateGpuServiceOnGpuThread(
}
}
void GpuMain::BindGpuInternalOnGpuThread(
mojom::GpuServiceInternalRequest request) {
gpu_service_internal_->Bind(std::move(request));
void GpuMain::BindGpuInternalOnGpuThread(mojom::GpuServiceRequest request) {
gpu_service_->Bind(std::move(request));
}
void GpuMain::PreSandboxStartup() {
......
......@@ -9,7 +9,7 @@
#include "gpu/ipc/in_process_command_buffer.h"
#include "gpu/ipc/service/gpu_init.h"
#include "services/ui/gpu/interfaces/gpu_main.mojom.h"
#include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h"
#include "services/ui/gpu/interfaces/gpu_service.mojom.h"
#include "services/ui/surfaces/display_compositor.h"
namespace gpu {
......@@ -19,7 +19,7 @@ class ImageFactory;
namespace ui {
class GpuServiceInternal;
class GpuService;
class GpuMain : public gpu::GpuSandboxHelper, public mojom::GpuMain {
public:
......@@ -27,15 +27,15 @@ class GpuMain : public gpu::GpuSandboxHelper, public mojom::GpuMain {
~GpuMain() override;
// mojom::GpuMain implementation:
void CreateGpuService(mojom::GpuServiceInternalRequest request,
mojom::GpuServiceHostPtr gpu_host) override;
void CreateGpuService(mojom::GpuServiceRequest request,
mojom::GpuHostPtr gpu_host) override;
void CreateDisplayCompositor(
cc::mojom::DisplayCompositorRequest request,
cc::mojom::DisplayCompositorClientPtr client) override;
void OnStart();
GpuServiceInternal* gpu_service() { return gpu_service_internal_.get(); }
GpuService* gpu_service() { return gpu_service_.get(); }
private:
void InitOnGpuThread(
......@@ -47,12 +47,12 @@ class GpuMain : public gpu::GpuSandboxHelper, public mojom::GpuMain {
cc::mojom::DisplayCompositorClientPtrInfo client_info);
void CreateDisplayCompositorOnCompositorThread(
gpu::ImageFactory* image_factory,
mojom::GpuServiceInternalPtrInfo gpu_service_info,
mojom::GpuServicePtrInfo gpu_service_info,
cc::mojom::DisplayCompositorRequest request,
cc::mojom::DisplayCompositorClientPtrInfo client_info);
void CreateGpuServiceOnGpuThread(mojom::GpuServiceInternalRequest request,
mojom::GpuServiceHostPtrInfo gpu_host_info);
void BindGpuInternalOnGpuThread(mojom::GpuServiceInternalRequest request);
void CreateGpuServiceOnGpuThread(mojom::GpuServiceRequest request,
mojom::GpuHostPtrInfo gpu_host_info);
void BindGpuInternalOnGpuThread(mojom::GpuServiceRequest request);
void TearDownOnCompositorThread();
void TearDownOnGpuThread();
......@@ -63,11 +63,11 @@ class GpuMain : public gpu::GpuSandboxHelper, public mojom::GpuMain {
gpu::GpuWatchdogThread* watchdog_thread) override;
std::unique_ptr<gpu::GpuInit> gpu_init_;
std::unique_ptr<GpuServiceInternal> gpu_service_internal_;
std::unique_ptr<GpuService> gpu_service_;
// The message-pipe used by the DisplayCompositor to request gpu memory
// buffers.
mojom::GpuServiceInternalPtr gpu_internal_;
mojom::GpuServicePtr gpu_internal_;
// The InCommandCommandBuffer::Service used by the display compositor.
scoped_refptr<gpu::InProcessCommandBuffer::Service> gpu_command_service_;
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "services/ui/gpu/gpu_service_internal.h"
#include "services/ui/gpu/gpu_service.h"
#include "base/bind.h"
#include "base/memory/shared_memory.h"
......@@ -36,11 +36,10 @@
namespace ui {
GpuServiceInternal::GpuServiceInternal(
const gpu::GPUInfo& gpu_info,
std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread,
gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory,
scoped_refptr<base::SingleThreadTaskRunner> io_runner)
GpuService::GpuService(const gpu::GPUInfo& gpu_info,
std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread,
gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory,
scoped_refptr<base::SingleThreadTaskRunner> io_runner)
: io_runner_(std::move(io_runner)),
shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL,
base::WaitableEvent::InitialState::NOT_SIGNALED),
......@@ -48,7 +47,7 @@ GpuServiceInternal::GpuServiceInternal(
gpu_memory_buffer_factory_(gpu_memory_buffer_factory),
gpu_info_(gpu_info) {}
GpuServiceInternal::~GpuServiceInternal() {
GpuService::~GpuService() {
bindings_.CloseAllBindings();
media_gpu_channel_manager_.reset();
gpu_channel_manager_.reset();
......@@ -61,7 +60,7 @@ GpuServiceInternal::~GpuServiceInternal() {
shutdown_event_.Signal();
}
void GpuServiceInternal::InitializeWithHost(mojom::GpuServiceHostPtr gpu_host) {
void GpuService::InitializeWithHost(mojom::GpuHostPtr gpu_host) {
DCHECK(CalledOnValidThread());
DCHECK(!gpu_host_);
gpu_host_ = std::move(gpu_host);
......@@ -91,11 +90,11 @@ void GpuServiceInternal::InitializeWithHost(mojom::GpuServiceHostPtr gpu_host) {
new media::MediaGpuChannelManager(gpu_channel_manager_.get()));
}
void GpuServiceInternal::Bind(mojom::GpuServiceInternalRequest request) {
void GpuService::Bind(mojom::GpuServiceRequest request) {
bindings_.AddBinding(this, std::move(request));
}
void GpuServiceInternal::CreateGpuMemoryBuffer(
void GpuService::CreateGpuMemoryBuffer(
gfx::GpuMemoryBufferId id,
const gfx::Size& size,
gfx::BufferFormat format,
......@@ -108,53 +107,52 @@ void GpuServiceInternal::CreateGpuMemoryBuffer(
id, size, format, usage, client_id, surface_handle));
}
void GpuServiceInternal::DestroyGpuMemoryBuffer(
gfx::GpuMemoryBufferId id,
int client_id,
const gpu::SyncToken& sync_token) {
void GpuService::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 GpuServiceInternal::DidCreateOffscreenContext(const GURL& active_url) {
void GpuService::DidCreateOffscreenContext(const GURL& active_url) {
gpu_host_->DidCreateOffscreenContext(active_url);
}
void GpuServiceInternal::DidDestroyChannel(int client_id) {
void GpuService::DidDestroyChannel(int client_id) {
media_gpu_channel_manager_->RemoveChannel(client_id);
gpu_host_->DidDestroyChannel(client_id);
}
void GpuServiceInternal::DidDestroyOffscreenContext(const GURL& active_url) {
void GpuService::DidDestroyOffscreenContext(const GURL& active_url) {
gpu_host_->DidDestroyOffscreenContext(active_url);
}
void GpuServiceInternal::DidLoseContext(bool offscreen,
gpu::error::ContextLostReason reason,
const GURL& active_url) {
void GpuService::DidLoseContext(bool offscreen,
gpu::error::ContextLostReason reason,
const GURL& active_url) {
gpu_host_->DidLoseContext(offscreen, reason, active_url);
}
void GpuServiceInternal::StoreShaderToDisk(int client_id,
const std::string& key,
const std::string& shader) {
void GpuService::StoreShaderToDisk(int client_id,
const std::string& key,
const std::string& shader) {
gpu_host_->StoreShaderToDisk(client_id, key, shader);
}
#if defined(OS_WIN)
void GpuServiceInternal::SendAcceleratedSurfaceCreatedChildWindow(
void GpuService::SendAcceleratedSurfaceCreatedChildWindow(
gpu::SurfaceHandle parent_window,
gpu::SurfaceHandle child_window) {
::SetParent(child_window, parent_window);
}
#endif
void GpuServiceInternal::SetActiveURL(const GURL& url) {
void GpuService::SetActiveURL(const GURL& url) {
// TODO(penghuang): implement this function.
}
void GpuServiceInternal::EstablishGpuChannel(
void GpuService::EstablishGpuChannel(
int32_t client_id,
uint64_t client_tracing_id,
bool is_gpu_host,
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_
#define SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_
#ifndef SERVICES_UI_GPU_GPU_SERVICE_H_
#define SERVICES_UI_GPU_GPU_SERVICE_H_
#include "base/callback.h"
#include "base/synchronization/waitable_event.h"
......@@ -21,8 +21,8 @@
#include "gpu/ipc/service/x_util.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "services/ui/gpu/interfaces/gpu_service_host.mojom.h"
#include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h"
#include "services/ui/gpu/interfaces/gpu_host.mojom.h"
#include "services/ui/gpu/interfaces/gpu_service.mojom.h"
#include "ui/gfx/native_widget_types.h"
namespace gpu {
......@@ -42,19 +42,19 @@ class GpuMain;
// This runs in the GPU process, and communicates with the gpu host (which is
// the window server) over the mojom APIs. This is responsible for setting up
// the connection to clients, allocating/free'ing gpu memory etc.
class GpuServiceInternal : public gpu::GpuChannelManagerDelegate,
public mojom::GpuServiceInternal,
public base::NonThreadSafe {
class GpuService : public gpu::GpuChannelManagerDelegate,
public mojom::GpuService,
public base::NonThreadSafe {
public:
GpuServiceInternal(const gpu::GPUInfo& gpu_info,
std::unique_ptr<gpu::GpuWatchdogThread> watchdog,
gpu::GpuMemoryBufferFactory* memory_buffer_factory,
scoped_refptr<base::SingleThreadTaskRunner> io_runner);
GpuService(const gpu::GPUInfo& gpu_info,
std::unique_ptr<gpu::GpuWatchdogThread> watchdog,
gpu::GpuMemoryBufferFactory* memory_buffer_factory,
scoped_refptr<base::SingleThreadTaskRunner> io_runner);
~GpuServiceInternal() override;
~GpuService() override;
void InitializeWithHost(mojom::GpuServiceHostPtr gpu_host);
void Bind(mojom::GpuServiceInternalRequest request);
void InitializeWithHost(mojom::GpuHostPtr gpu_host);
void Bind(mojom::GpuServiceRequest request);
private:
friend class GpuMain;
......@@ -97,7 +97,7 @@ class GpuServiceInternal : public gpu::GpuChannelManagerDelegate,
#endif
void SetActiveURL(const GURL& url) override;
// mojom::GpuServiceInternal:
// mojom::GpuService:
void EstablishGpuChannel(
int32_t client_id,
uint64_t client_tracing_id,
......@@ -129,15 +129,15 @@ class GpuServiceInternal : public gpu::GpuChannelManagerDelegate,
// Information about the GPU, such as device and vendor ID.
gpu::GPUInfo gpu_info_;
mojom::GpuServiceHostPtr gpu_host_;
mojom::GpuHostPtr gpu_host_;
std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_;
std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_;
std::unique_ptr<media::MediaGpuChannelManager> media_gpu_channel_manager_;
mojo::BindingSet<mojom::GpuServiceInternal> bindings_;
mojo::BindingSet<mojom::GpuService> bindings_;
DISALLOW_COPY_AND_ASSIGN(GpuServiceInternal);
DISALLOW_COPY_AND_ASSIGN(GpuService);
};
} // namespace ui
#endif // SERVICES_UI_GPU_GPU_SERVICE_INTERNAL_H_
#endif // SERVICES_UI_GPU_GPU_SERVICE_H_
......@@ -7,9 +7,9 @@ import("//mojo/public/tools/bindings/mojom.gni")
mojom("interfaces") {
sources = [
"context_lost_reason.mojom",
"gpu_host.mojom",
"gpu_main.mojom",
"gpu_service_host.mojom",
"gpu_service_internal.mojom",
"gpu_service.mojom",
]
public_deps = [
......
......@@ -8,7 +8,7 @@ import "gpu/ipc/common/gpu_info.mojom";
import "services/ui/gpu/interfaces/context_lost_reason.mojom";
import "url/mojo/url.mojom";
interface GpuServiceHost {
interface GpuHost {
DidInitialize(gpu.mojom.GpuInfo gpu_info);
DidCreateOffscreenContext(url.mojom.Url url);
DidDestroyOffscreenContext(url.mojom.Url url);
......
......@@ -5,8 +5,8 @@
module ui.mojom;
import "cc/ipc/display_compositor.mojom";
import "services/ui/gpu/interfaces/gpu_service_host.mojom";
import "services/ui/gpu/interfaces/gpu_service_internal.mojom";
import "services/ui/gpu/interfaces/gpu_host.mojom";
import "services/ui/gpu/interfaces/gpu_service.mojom";
// This is the primordial interface used to (re)start the mus-gpu bundle
// of services.
......@@ -15,6 +15,6 @@ interface GpuMain {
cc.mojom.DisplayCompositor& display_compositor,
cc.mojom.DisplayCompositorClient display_compositor_client);
CreateGpuService(GpuServiceInternal& gpu_service,
GpuServiceHost gpu_host);
CreateGpuService(GpuService& gpu_service,
GpuHost gpu_host);
};
......@@ -11,7 +11,7 @@ import "gpu/ipc/common/sync_token.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom";
import "ui/gfx/mojo/buffer_types.mojom";
interface GpuServiceInternal {
interface GpuService {
// Tells the GPU service to create a new channel for communication with a
// client. The GPU service responds with an IPC handle.
EstablishGpuChannel(int32 client_id,
......
......@@ -31,7 +31,7 @@
#include "services/ui/ws/display.h"
#include "services/ui/ws/display_binding.h"
#include "services/ui/ws/display_manager.h"
#include "services/ui/ws/gpu_service_proxy.h"
#include "services/ui/ws/gpu_host.h"
#include "services/ui/ws/user_activity_monitor.h"
#include "services/ui/ws/user_display_manager.h"
#include "services/ui/ws/window_server.h"
......@@ -298,7 +298,7 @@ void Service::Create(const service_manager::Identity& remote_identity,
void Service::Create(const service_manager::Identity& remote_identity,
mojom::GpuRequest request) {
window_server_->gpu_proxy()->Add(std::move(request));
window_server_->gpu_host()->Add(std::move(request));
}
void Service::Create(const service_manager::Identity& remote_identity,
......
......@@ -39,9 +39,9 @@ static_library("lib") {
"focus_controller_observer.h",
"frame_generator.cc",
"frame_generator.h",
"gpu_service_proxy.cc",
"gpu_service_proxy.h",
"gpu_service_proxy_delegate.h",
"gpu_host.cc",
"gpu_host.h",
"gpu_host_delegate.h",
"modal_window_controller.cc",
"modal_window_controller.h",
"operation.cc",
......
......@@ -8,7 +8,7 @@ include_rules = [
]
specific_include_rules = {
"gpu_service_proxy.h": [
"gpu_host.h": [
"+services/ui/gpu/gpu_main.h",
],
}
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "services/ui/ws/gpu_service_proxy.h"
#include "services/ui/ws/gpu_host.h"
#include "base/memory/shared_memory.h"
#include "base/message_loop/message_loop.h"
......@@ -15,7 +15,7 @@
#include "mojo/public/cpp/system/platform_handle.h"
#include "services/service_manager/public/cpp/connection.h"
#include "services/ui/common/server_gpu_memory_buffer_manager.h"
#include "services/ui/ws/gpu_service_proxy_delegate.h"
#include "services/ui/ws/gpu_host_delegate.h"
#include "ui/gfx/buffer_format_util.h"
namespace ui {
......@@ -27,21 +27,21 @@ namespace {
const int32_t kInternalGpuChannelClientId = 2;
// The implementation that relays requests from clients to the real
// service implementation in the GPU process over mojom.GpuServiceInternal.
class GpuServiceImpl : public mojom::Gpu {
// service implementation in the GPU process over mojom.GpuService.
class GpuClient : public mojom::Gpu {
public:
GpuServiceImpl(int client_id,
gpu::GPUInfo* gpu_info,
ServerGpuMemoryBufferManager* gpu_memory_buffer_manager,
mojom::GpuServiceInternal* gpu_service_internal)
GpuClient(int client_id,
gpu::GPUInfo* gpu_info,
ServerGpuMemoryBufferManager* gpu_memory_buffer_manager,
mojom::GpuService* gpu_service)
: client_id_(client_id),
gpu_info_(gpu_info),
gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
gpu_service_internal_(gpu_service_internal) {
gpu_service_(gpu_service) {
DCHECK(gpu_memory_buffer_manager_);
DCHECK(gpu_service_internal_);
DCHECK(gpu_service_);
}
~GpuServiceImpl() override {
~GpuClient() override {
gpu_memory_buffer_manager_->DestroyAllGpuMemoryBufferForClient(client_id_);
}
......@@ -58,10 +58,10 @@ class GpuServiceImpl : public mojom::Gpu {
// tracing id.
const uint64_t client_tracing_id = 0;
constexpr bool is_gpu_host = false;
gpu_service_internal_->EstablishGpuChannel(
gpu_service_->EstablishGpuChannel(
client_id_, client_tracing_id, is_gpu_host,
base::Bind(&GpuServiceImpl::OnGpuChannelEstablished,
base::Unretained(this), callback));
base::Bind(&GpuClient::OnGpuChannelEstablished, base::Unretained(this),
callback));
}
void CreateGpuMemoryBuffer(
......@@ -83,18 +83,17 @@ class GpuServiceImpl : public mojom::Gpu {
const int client_id_;
// The objects these pointers refer to are owned by the GpuServiceProxy
// object.
// The objects these pointers refer to are owned by the GpuHost object.
const gpu::GPUInfo* gpu_info_;
ServerGpuMemoryBufferManager* gpu_memory_buffer_manager_;
mojom::GpuServiceInternal* gpu_service_internal_;
mojom::GpuService* gpu_service_;
DISALLOW_COPY_AND_ASSIGN(GpuServiceImpl);
DISALLOW_COPY_AND_ASSIGN(GpuClient);
};
} // namespace
GpuServiceProxy::GpuServiceProxy(GpuServiceProxyDelegate* delegate)
GpuHost::GpuHost(GpuHostDelegate* delegate)
: delegate_(delegate),
next_client_id_(kInternalGpuChannelClientId + 1),
main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
......@@ -109,41 +108,40 @@ GpuServiceProxy::GpuServiceProxy(GpuServiceProxyDelegate* delegate)
gpu_service_.get(), next_client_id_++);
}
GpuServiceProxy::~GpuServiceProxy() {
}
GpuHost::~GpuHost() {}
void GpuServiceProxy::Add(mojom::GpuRequest request) {
void GpuHost::Add(mojom::GpuRequest request) {
mojo::MakeStrongBinding(
base::MakeUnique<GpuServiceImpl>(next_client_id_++, &gpu_info_,
gpu_memory_buffer_manager_.get(),
gpu_service_.get()),
base::MakeUnique<GpuClient>(next_client_id_++, &gpu_info_,
gpu_memory_buffer_manager_.get(),
gpu_service_.get()),
std::move(request));
}
void GpuServiceProxy::CreateDisplayCompositor(
void GpuHost::CreateDisplayCompositor(
cc::mojom::DisplayCompositorRequest request,
cc::mojom::DisplayCompositorClientPtr client) {
gpu_main_->CreateDisplayCompositor(std::move(request), std::move(client));
}
void GpuServiceProxy::DidInitialize(const gpu::GPUInfo& gpu_info) {
void GpuHost::DidInitialize(const gpu::GPUInfo& gpu_info) {
gpu_info_ = gpu_info;
delegate_->OnGpuServiceInitialized();
}
void GpuServiceProxy::DidCreateOffscreenContext(const GURL& url) {}
void GpuHost::DidCreateOffscreenContext(const GURL& url) {}
void GpuServiceProxy::DidDestroyOffscreenContext(const GURL& url) {}
void GpuHost::DidDestroyOffscreenContext(const GURL& url) {}
void GpuServiceProxy::DidDestroyChannel(int32_t client_id) {}
void GpuHost::DidDestroyChannel(int32_t client_id) {}
void GpuServiceProxy::DidLoseContext(bool offscreen,
gpu::error::ContextLostReason reason,
const GURL& active_url) {}
void GpuHost::DidLoseContext(bool offscreen,
gpu::error::ContextLostReason reason,
const GURL& active_url) {}
void GpuServiceProxy::StoreShaderToDisk(int32_t client_id,
const std::string& key,
const std::string& shader) {}
void GpuHost::StoreShaderToDisk(int32_t client_id,
const std::string& key,
const std::string& shader) {}
} // namespace ws
} // namespace ui
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_UI_WS_GPU_SERVICE_PROXY_H_
#define SERVICES_UI_WS_GPU_SERVICE_PROXY_H_
#ifndef SERVICES_UI_WS_GPU_HOST_H_
#define SERVICES_UI_WS_GPU_HOST_H_
#include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h"
......@@ -13,8 +13,8 @@
#include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "services/ui/gpu/gpu_main.h"
#include "services/ui/gpu/interfaces/gpu_service_host.mojom.h"
#include "services/ui/gpu/interfaces/gpu_service_internal.mojom.h"
#include "services/ui/gpu/interfaces/gpu_host.mojom.h"
#include "services/ui/gpu/interfaces/gpu_service.mojom.h"
#include "services/ui/public/interfaces/gpu.mojom.h"
namespace ui {
......@@ -23,14 +23,14 @@ class ServerGpuMemoryBufferManager;
namespace ws {
class GpuServiceProxyDelegate;
class GpuHostDelegate;
// Sets up connection from clients to the real service implementation in the GPU
// process.
class GpuServiceProxy : public mojom::GpuServiceHost {
class GpuHost : public mojom::GpuHost {
public:
explicit GpuServiceProxy(GpuServiceProxyDelegate* delegate);
~GpuServiceProxy() override;
explicit GpuHost(GpuHostDelegate* delegate);
~GpuHost() override;
void Add(mojom::GpuRequest request);
......@@ -39,7 +39,7 @@ class GpuServiceProxy : public mojom::GpuServiceHost {
cc::mojom::DisplayCompositorClientPtr client);
private:
// mojom::GpuServiceHost:
// mojom::GpuHost:
void DidInitialize(const gpu::GPUInfo& gpu_info) override;
void DidCreateOffscreenContext(const GURL& url) override;
void DidDestroyOffscreenContext(const GURL& url) override;
......@@ -51,24 +51,24 @@ class GpuServiceProxy : public mojom::GpuServiceHost {
const std::string& key,
const std::string& shader) override;
GpuServiceProxyDelegate* const delegate_;
GpuHostDelegate* const delegate_;
int32_t next_client_id_;
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
mojom::GpuServiceInternalPtr gpu_service_;
mojo::Binding<mojom::GpuServiceHost> gpu_host_binding_;
mojom::GpuServicePtr gpu_service_;
mojo::Binding<mojom::GpuHost> gpu_host_binding_;
gpu::GPUInfo gpu_info_;
std::unique_ptr<ServerGpuMemoryBufferManager> gpu_memory_buffer_manager_;
mojom::GpuMainPtr gpu_main_;
// TODO(fsamuel): GpuServiceProxy should not be holding onto |gpu_main_impl|
// TODO(fsamuel): GpuHost should not be holding onto |gpu_main_impl|
// because that will live in another process soon.
std::unique_ptr<GpuMain> gpu_main_impl_;
DISALLOW_COPY_AND_ASSIGN(GpuServiceProxy);
DISALLOW_COPY_AND_ASSIGN(GpuHost);
};
} // namespace ws
} // namespace ui
#endif // SERVICES_UI_WS_GPU_SERVICE_PROXY_H_
#endif // SERVICES_UI_WS_GPU_HOST_H_
......@@ -10,9 +10,9 @@
namespace ui {
namespace ws {
class GpuServiceProxyDelegate {
class GpuHostDelegate {
public:
virtual ~GpuServiceProxyDelegate() {}
virtual ~GpuHostDelegate() {}
virtual void OnGpuServiceInitialized() = 0;
};
......
......@@ -14,7 +14,7 @@
#include "services/ui/ws/display.h"
#include "services/ui/ws/display_manager.h"
#include "services/ui/ws/frame_generator.h"
#include "services/ui/ws/gpu_service_proxy.h"
#include "services/ui/ws/gpu_host.h"
#include "services/ui/ws/operation.h"
#include "services/ui/ws/server_window.h"
#include "services/ui/ws/server_window_compositor_frame_sink_manager.h"
......@@ -46,7 +46,7 @@ struct WindowServer::CurrentDragLoopState {
};
// TODO(fsamuel): DisplayCompositor should be a mojo interface dispensed by
// GpuServiceProxy.
// GpuHost.
WindowServer::WindowServer(WindowServerDelegate* delegate)
: delegate_(delegate),
next_client_id_(1),
......@@ -54,12 +54,12 @@ WindowServer::WindowServer(WindowServerDelegate* delegate)
current_operation_(nullptr),
in_destructor_(false),
next_wm_change_id_(0),
gpu_proxy_(new GpuServiceProxy(this)),
gpu_host_(new GpuHost(this)),
window_manager_window_tree_factory_set_(this, &user_id_tracker_),
display_compositor_client_binding_(this) {
user_id_tracker_.AddObserver(this);
OnUserIdAdded(user_id_tracker_.active_id());
gpu_proxy_->CreateDisplayCompositor(
gpu_host_->CreateDisplayCompositor(
mojo::GetProxy(&display_compositor_),
display_compositor_client_binding_.CreateInterfacePtrAndBind());
}
......@@ -761,7 +761,7 @@ void WindowServer::OnTransientWindowRemoved(ServerWindow* window,
void WindowServer::OnGpuServiceInitialized() {
// TODO(kylechar): When gpu channel is removed, this can instead happen
// earlier, after GpuServiceProxy::OnInitialized().
// earlier, after GpuHost::OnInitialized().
delegate_->StartDisplayInit();
}
......
......@@ -20,7 +20,7 @@
#include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom.h"
#include "services/ui/public/interfaces/window_tree.mojom.h"
#include "services/ui/ws/display.h"
#include "services/ui/ws/gpu_service_proxy_delegate.h"
#include "services/ui/ws/gpu_host_delegate.h"
#include "services/ui/ws/ids.h"
#include "services/ui/ws/operation.h"
#include "services/ui/ws/server_window_delegate.h"
......@@ -35,7 +35,7 @@ namespace ws {
class AccessPolicy;
class DisplayManager;
class GpuServiceProxy;
class GpuHost;
class ServerWindow;
class UserActivityMonitor;
class WindowManagerState;
......@@ -47,7 +47,7 @@ class WindowTreeBinding;
// WindowTrees) as well as providing the root of the hierarchy.
class WindowServer : public ServerWindowDelegate,
public ServerWindowObserver,
public GpuServiceProxyDelegate,
public GpuHostDelegate,
public UserDisplayManagerDelegate,
public UserIdTrackerObserver,
public cc::mojom::DisplayCompositorClient {
......@@ -65,7 +65,7 @@ class WindowServer : public ServerWindowDelegate,
return display_manager_.get();
}
GpuServiceProxy* gpu_proxy() { return gpu_proxy_.get(); }
GpuHost* gpu_host() { return gpu_host_.get(); }
// Creates a new ServerWindow. The return value is owned by the caller, but
// must be destroyed before WindowServer.
......@@ -324,7 +324,7 @@ class WindowServer : public ServerWindowDelegate,
void OnTransientWindowRemoved(ServerWindow* window,
ServerWindow* transient_child) override;
// GpuServiceProxyDelegate:
// GpuHostDelegate:
void OnGpuServiceInitialized() override;
// cc::mojom::DisplayCompositorClient:
......@@ -369,7 +369,7 @@ class WindowServer : public ServerWindowDelegate,
// Next id supplied to the window manager.
uint32_t next_wm_change_id_;
std::unique_ptr<GpuServiceProxy> gpu_proxy_;
std::unique_ptr<GpuHost> gpu_host_;
base::Callback<void(ServerWindow*)> window_paint_callback_;
UserActivityMonitorMap activity_monitor_map_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment