Commit 6fd9b242 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

moves GpuHost files into own directory

So that they can be shared with ash.

BUG=837686
TEST=covered by tests
TBR=tsepez@chromium.org

Change-Id: Ide4e36e141454c4c120ad2f04544bf201f402550
Reviewed-on: https://chromium-review.googlesource.com/1102079Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567650}
parent eb6fedfe
......@@ -60,6 +60,7 @@ source_set("lib") {
"//services/catalog/public/cpp",
"//services/catalog/public/mojom:constants",
"//services/service_manager/public/cpp",
"//services/ui/gpu_host",
"//services/ui/ime:lib",
"//services/ui/input_devices",
"//services/ui/public/interfaces",
......
# Copyright 2018 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.
source_set("gpu_host") {
sources = [
"gpu_client.cc",
"gpu_client.h",
"gpu_host.cc",
"gpu_host.h",
"gpu_host_delegate.h",
]
deps = [
"//base",
"//components/discardable_memory/service",
"//components/viz/host",
"//components/viz/service/main", # TODO(sad): Temporary until GPU process split.
"//gpu/command_buffer/client",
"//gpu/command_buffer/client:gles2_interface",
"//gpu/ipc/client",
"//gpu/ipc/common",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/system",
"//services/service_manager/public/cpp",
"//ui/gfx",
"//ui/gl",
]
public_deps = [
"//services/ui/public/interfaces",
"//services/viz/privileged/interfaces",
"//services/viz/public/interfaces",
]
if (is_chromeos) {
sources += [
"arc_client.cc",
"arc_client.h",
]
}
# ui service should not depend on below components.
assert_no_deps = [
"//ash",
"//content/public/browser",
"//content/public/common",
"//ui/aura",
"//ui/views",
]
}
static_library("test_support") {
testonly = true
sources = [
"test_gpu_host.cc",
"test_gpu_host.h",
]
deps = [
":gpu_host",
"//base",
"//components/viz/test:test_support",
]
}
source_set("tests") {
testonly = true
sources = [
"gpu_host_unittest.cc",
]
deps = [
":gpu_host",
"//base",
"//base/test:test_config",
"//base/test:test_support",
"//components/discardable_memory/service",
"//components/viz/service",
"//components/viz/service/main",
"//components/viz/test:test_support",
"//gpu/ipc/client",
"//mojo/public/cpp/bindings:bindings",
"//services/service_manager/public/cpp",
"//services/service_manager/public/cpp:service_test_support",
"//services/service_manager/public/mojom",
"//services/ui/common:mus_common",
"//services/ui/common:task_runner_test_base",
"//services/ui/public/cpp",
"//services/ui/public/interfaces",
"//testing/gtest",
"//third_party/mesa:osmesa",
"//ui/aura",
"//ui/aura:test_support",
"//ui/events",
"//ui/gfx",
"//ui/gfx:test_support",
"//ui/gfx/geometry",
"//ui/gfx/geometry/mojo",
"//ui/gl",
"//ui/gl/init",
]
}
include_rules = [
"+base",
"+components/viz/common",
"+components/viz/host",
"+gpu/command_buffer/client",
"+gpu/config",
"+gpu/ipc/client",
"+gpu/ipc/common",
"+mojo/public",
"+services/ui/public",
"+services/ui/gpu_host",
"+services/viz/privileged/interfaces",
"+services/viz/public/interfaces",
"+ui",
]
specific_include_rules = {
# TODO(crbug.com/620927): This can be removed after ozone-mojo.
"gpu_host.h": [
"+components/viz/service/main/viz_main_impl.h",
],
"gpu_host_unittest.cc": [
"+components/viz/service/gl/gpu_service_impl.h",
],
"test_gpu_host.h": [
"+components/viz/test",
],
".*_(unit|pixel|perf)test.*\.cc": [
"+components/viz/test",
],
}
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "services/ui/ws/arc_client.h"
#include "services/ui/gpu_host/arc_client.h"
#include "services/viz/privileged/interfaces/gl/gpu_service.mojom.h"
namespace ui {
namespace ws {
namespace gpu_host {
ArcClient::ArcClient(viz::mojom::GpuService* gpu_service)
: gpu_service_(gpu_service) {}
......@@ -35,5 +35,5 @@ void ArcClient::CreateProtectedBufferManager(
gpu_service_->CreateArcProtectedBufferManager(std::move(pbm_request));
}
} // namespace ws
} // namespace gpu_host
} // 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_ARC_CLIENT_H_
#define SERVICES_UI_WS_ARC_CLIENT_H_
#ifndef SERVICES_UI_GPU_HOST_ARC_CLIENT_H_
#define SERVICES_UI_GPU_HOST_ARC_CLIENT_H_
#include "services/ui/public/interfaces/arc.mojom.h"
......@@ -14,7 +14,7 @@ class GpuService;
} // namespace viz
namespace ui {
namespace ws {
namespace gpu_host {
// The implementation that relays requests from clients to the real
// service implementation in the GPU process over mojom.GpuService.
......@@ -43,7 +43,7 @@ class ArcClient : public mojom::Arc {
DISALLOW_COPY_AND_ASSIGN(ArcClient);
};
} // namespace ws
} // namespace gpu_host
} // namespace ui
#endif // SERVICES_UI_WS_ARC_CLIENT_H_
#endif // SERVICES_UI_GPU_HOST_ARC_CLIENT_H_
......@@ -2,13 +2,13 @@
// 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_client.h"
#include "services/ui/gpu_host/gpu_client.h"
#include "components/viz/host/server_gpu_memory_buffer_manager.h"
#include "services/viz/privileged/interfaces/gl/gpu_service.mojom.h"
namespace ui {
namespace ws {
namespace gpu_host {
GpuClient::GpuClient(
int client_id,
......@@ -44,7 +44,7 @@ void GpuClient::OnGpuChannelEstablished(
// mojom::Gpu overrides:
void GpuClient::EstablishGpuChannel(EstablishGpuChannelCallback callback) {
// TODO(sad): crbug.com/617415 figure out how to generate a meaningful
// TODO(sad): https://crbug.com/617415 figure out how to generate a meaningful
// tracing id.
const uint64_t client_tracing_id = 0;
constexpr bool is_gpu_host = false;
......@@ -92,5 +92,5 @@ void GpuClient::CreateGpuMemoryBufferFactory(
gpu_memory_buffer_factory_bindings_.AddBinding(this, std::move(request));
}
} // namespace ws
} // namespace gpu_host
} // 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_CLIENT_H_
#define SERVICES_UI_WS_GPU_CLIENT_H_
#ifndef SERVICES_UI_GPU_HOST_GPU_CLIENT_H_
#define SERVICES_UI_GPU_HOST_GPU_CLIENT_H_
#include "base/memory/weak_ptr.h"
#include "gpu/config/gpu_feature_info.h"
......@@ -17,11 +17,10 @@ class GpuService;
} // namespace mojom
class ServerGpuMemoryBufferManager;
}
} // namespace viz
namespace ui {
namespace ws {
namespace gpu_host {
namespace test {
class GpuHostTest;
......@@ -82,7 +81,7 @@ class GpuClient : public ui::mojom::GpuMemoryBufferFactory,
DISALLOW_COPY_AND_ASSIGN(GpuClient);
};
} // namespace ws
} // namespace gpu_host
} // namespace ui
#endif // SERVICES_UI_WS_GPU_CLIENT_H_
#endif // SERVICES_UI_GPU_HOST_GPU_CLIENT_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_host.h"
#include "services/ui/gpu_host/gpu_host.h"
#include "base/command_line.h"
#include "base/memory/shared_memory.h"
......@@ -17,8 +17,8 @@
#include "mojo/public/cpp/system/buffer.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/ui/ws/gpu_client.h"
#include "services/ui/ws/gpu_host_delegate.h"
#include "services/ui/gpu_host/gpu_client.h"
#include "services/ui/gpu_host/gpu_host_delegate.h"
#include "services/viz/public/interfaces/constants.mojom.h"
#include "ui/gfx/buffer_format_util.h"
......@@ -27,11 +27,11 @@
#endif
#if defined(OS_CHROMEOS)
#include "services/ui/ws/arc_client.h"
#include "services/ui/gpu_host/arc_client.h"
#endif
namespace ui {
namespace ws {
namespace gpu_host {
namespace {
......@@ -212,5 +212,5 @@ void DefaultGpuHost::RecordLogMessage(int32_t severity,
const std::string& header,
const std::string& message) {}
} // namespace ws
} // namespace gpu_host
} // 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_HOST_H_
#define SERVICES_UI_WS_GPU_HOST_H_
#ifndef SERVICES_UI_GPU_HOST_GPU_HOST_H_
#define SERVICES_UI_GPU_HOST_GPU_HOST_H_
#include "base/single_thread_task_runner.h"
#include "base/threading/thread.h"
......@@ -36,8 +36,7 @@ class ServerGpuMemoryBufferManager;
}
namespace ui {
namespace ws {
namespace gpu_host {
class GpuClient;
......@@ -142,7 +141,7 @@ class DefaultGpuHost : public GpuHost, public viz::mojom::GpuHost {
DISALLOW_COPY_AND_ASSIGN(DefaultGpuHost);
};
} // namespace ws
} // namespace gpu_host
} // namespace ui
#endif // SERVICES_UI_WS_GPU_HOST_H_
#endif // SERVICES_UI_GPU_HOST_GPU_HOST_H_
......@@ -2,13 +2,13 @@
// 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_DELEGATEH_
#define SERVICES_UI_WS_GPU_SERVICE_PROXY_DELEGATEH_
#ifndef SERVICES_UI_GPU_HOST_GPU_HOST_DELEGATE_H_
#define SERVICES_UI_GPU_HOST_GPU_HOST_DELEGATE_H_
#include "base/memory/ref_counted.h"
namespace ui {
namespace ws {
namespace gpu_host {
class GpuHostDelegate {
public:
......@@ -17,7 +17,7 @@ class GpuHostDelegate {
virtual void OnGpuServiceInitialized() = 0;
};
} // namespace ws
} // namespace gpu_host
} // namespace ui
#endif // SERVICES_UI_WS_GPU_SERVICE_PROXY_DELEGATEH_
#endif // SERVICES_UI_GPU_HOST_GPU_HOST_DELEGATE_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_host.h"
#include "services/ui/gpu_host/gpu_host.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
......@@ -11,15 +11,14 @@
#include "components/discardable_memory/service/discardable_shared_memory_manager.h"
#include "components/viz/service/gl/gpu_service_impl.h"
#include "gpu/config/gpu_info.h"
#include "services/ui/gpu_host/gpu_client.h"
#include "services/ui/gpu_host/gpu_host_delegate.h"
#include "services/ui/public/interfaces/gpu.mojom.h"
#include "services/ui/ws/gpu_client.h"
#include "services/ui/ws/gpu_host_delegate.h"
#include "ui/gl/init/gl_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gl/init/gl_factory.h"
namespace ui {
namespace ws {
namespace gpu_host {
namespace test {
namespace {
......@@ -145,5 +144,5 @@ TEST_F(GpuHostTest, GpuClientDestroyedWhileChannelRequestInFlight) {
}
} // namespace test
} // namespace ws
} // namespace gpu_host
} // namespace ui
......@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "services/ui/ws/test_gpu_host.h"
#include "services/ui/gpu_host/test_gpu_host.h"
namespace ui {
namespace ws {
namespace gpu_host {
TestGpuHost::TestGpuHost() = default;
......@@ -20,5 +20,5 @@ void TestGpuHost::CreateFrameSinkManager(
std::move(client));
}
} // namespace ws
} // namespace gpu_host
} // namespace ui
......@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_UI_WS_TEST_GPU_HOST_H_
#define SERVICES_UI_WS_TEST_GPU_HOST_H_
#ifndef SERVICES_UI_GPU_HOST_TEST_GPU_HOST_H_
#define SERVICES_UI_GPU_HOST_TEST_GPU_HOST_H_
#include "base/macros.h"
#include "components/viz/test/test_frame_sink_manager.h"
#include "services/ui/ws/gpu_host.h"
#include "services/ui/gpu_host/gpu_host.h"
namespace ui {
namespace ws {
namespace gpu_host {
class TestGpuHost : public GpuHost {
class TestGpuHost : public gpu_host::GpuHost {
public:
TestGpuHost();
~TestGpuHost() override;
......@@ -32,7 +32,7 @@ class TestGpuHost : public GpuHost {
DISALLOW_COPY_AND_ASSIGN(TestGpuHost);
};
} // namespace ws
} // namespace gpu_host
} // namespace ui
#endif // SERVICES_UI_WS_TEST_GPU_HOST_H_
#endif // SERVICES_UI_GPU_HOST_TEST_GPU_HOST_H_
......@@ -22,6 +22,7 @@
#include "services/ui/common/image_cursors_set.h"
#include "services/ui/common/switches.h"
#include "services/ui/display/screen_manager.h"
#include "services/ui/gpu_host/gpu_host.h"
#include "services/ui/ime/ime_driver_bridge.h"
#include "services/ui/ime/ime_registrar_impl.h"
#include "services/ui/ws/accessibility_manager.h"
......@@ -29,7 +30,6 @@
#include "services/ui/ws/display_creation_config.h"
#include "services/ui/ws/display_manager.h"
#include "services/ui/ws/event_injector.h"
#include "services/ui/ws/gpu_host.h"
#include "services/ui/ws/threaded_image_cursors.h"
#include "services/ui/ws/threaded_image_cursors_factory.h"
#include "services/ui/ws/user_activity_monitor.h"
......@@ -259,8 +259,8 @@ void Service::OnStart() {
window_server_ = std::make_unique<ws::WindowServer>(this, should_host_viz_);
if (should_host_viz_) {
std::unique_ptr<ws::GpuHost> gpu_host =
std::make_unique<ws::DefaultGpuHost>(
std::unique_ptr<gpu_host::GpuHost> gpu_host =
std::make_unique<gpu_host::DefaultGpuHost>(
window_server_.get(), context()->connector(),
discardable_shared_memory_manager_);
window_server_->SetGpuHost(std::move(gpu_host));
......
......@@ -66,11 +66,6 @@ static_library("lib") {
"focus_controller_observer.h",
"frame_generator.cc",
"frame_generator.h",
"gpu_client.cc",
"gpu_client.h",
"gpu_host.cc",
"gpu_host.h",
"gpu_host_delegate.h",
"modal_window_controller.cc",
"modal_window_controller.h",
"operation.cc",
......@@ -135,6 +130,7 @@ static_library("lib") {
"//gpu/command_buffer/client:gles2_interface",
"//gpu/ipc/client",
"//gpu/ipc/common",
"//services/ui/gpu_host",
"//services/viz/privileged/interfaces",
]
......@@ -170,10 +166,6 @@ static_library("lib") {
public_deps += [ "//ui/ozone" ]
}
if (is_chromeos) {
sources += [
"arc_client.cc",
"arc_client.h",
]
public_deps += [ "//ui/chromeos/events" ]
if (use_ozone) {
public_deps += [ "//ui/events/ozone:events_ozone" ]
......@@ -263,11 +255,8 @@ source_set("tests") {
"event_processor_unittest.cc",
"focus_controller_unittest.cc",
"frame_generator_unittest.cc",
"gpu_host_unittest.cc",
"modal_window_controller_unittest.cc",
"server_window_drawn_tracker_unittest.cc",
"test_gpu_host.cc",
"test_gpu_host.h",
"test_server_window_delegate.cc",
"test_server_window_delegate.h",
"test_utils.cc",
......@@ -312,6 +301,8 @@ source_set("tests") {
"//services/service_manager/public/mojom",
"//services/ui/common:mus_common",
"//services/ui/common:task_runner_test_base",
"//services/ui/gpu_host",
"//services/ui/gpu_host:test_support",
"//services/ui/public/cpp",
"//services/ui/public/interfaces",
"//testing/gtest",
......
......@@ -10,16 +10,6 @@ include_rules = [
]
specific_include_rules = {
# TODO(crbug.com/620927): This can be removed after ozone-mojo.
"gpu_host.h": [
"+components/viz/service/main/viz_main_impl.h",
],
"gpu_host_unittest.cc": [
"+components/viz/service/gl/gpu_service_impl.h",
],
"test_gpu_host.h": [
"+components/viz/test",
],
".*_(unit|pixel|perf)test.*\.cc": [
"+components/viz/test",
],
......
......@@ -13,12 +13,12 @@
#include "gpu/ipc/client/gpu_channel_host.h"
#include "services/service_manager/public/mojom/connector.mojom.h"
#include "services/ui/common/image_cursors_set.h"
#include "services/ui/gpu_host/test_gpu_host.h"
#include "services/ui/public/interfaces/cursor/cursor.mojom.h"
#include "services/ui/ws/cursor_location_manager.h"
#include "services/ui/ws/display_binding.h"
#include "services/ui/ws/display_creation_config.h"
#include "services/ui/ws/display_manager.h"
#include "services/ui/ws/test_gpu_host.h"
#include "services/ui/ws/threaded_image_cursors.h"
#include "services/ui/ws/threaded_image_cursors_factory.h"
#include "services/ui/ws/window_manager_access_policy.h"
......@@ -583,7 +583,8 @@ WindowServerTestHelper::WindowServerTestHelper()
PlatformDisplay::set_factory_for_testing(&platform_display_factory_);
window_server_ = std::make_unique<WindowServer>(&window_server_delegate_,
true /* should_host_viz */);
std::unique_ptr<GpuHost> gpu_host = std::make_unique<TestGpuHost>();
std::unique_ptr<gpu_host::GpuHost> gpu_host =
std::make_unique<gpu_host::TestGpuHost>();
window_server_->SetGpuHost(std::move(gpu_host));
window_server_delegate_.set_window_server(window_server_.get());
}
......
......@@ -19,6 +19,7 @@
#include "services/service_manager/public/cpp/bind_source_info.h"
#include "services/ui/display/screen_manager.h"
#include "services/ui/display/viewport_metrics.h"
#include "services/ui/gpu_host/gpu_host.h"
#include "services/ui/public/interfaces/screen_provider.mojom.h"
#include "services/ui/public/interfaces/window_tree.mojom.h"
#include "services/ui/ws/display.h"
......@@ -27,7 +28,6 @@
#include "services/ui/ws/event_dispatcher_impl_test_api.h"
#include "services/ui/ws/event_processor.h"
#include "services/ui/ws/event_targeter.h"
#include "services/ui/ws/gpu_host.h"
#include "services/ui/ws/platform_display.h"
#include "services/ui/ws/platform_display_factory.h"
#include "services/ui/ws/test_change_tracker.h"
......
......@@ -11,11 +11,11 @@
#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
#include "components/viz/common/switches.h"
#include "services/ui/gpu_host/gpu_host.h"
#include "services/ui/ws/display.h"
#include "services/ui/ws/display_creation_config.h"
#include "services/ui/ws/display_manager.h"
#include "services/ui/ws/frame_generator.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/user_activity_monitor.h"
......@@ -177,7 +177,7 @@ void WindowServer::SetDisplayCreationConfig(DisplayCreationConfig config) {
display_manager_->OnDisplayCreationConfigSet();
}
void WindowServer::SetGpuHost(std::unique_ptr<GpuHost> gpu_host) {
void WindowServer::SetGpuHost(std::unique_ptr<gpu_host::GpuHost> gpu_host) {
DCHECK(host_frame_sink_manager_);
gpu_host_ = std::move(gpu_host);
CreateFrameSinkManager();
......
......@@ -19,10 +19,10 @@
#include "components/viz/common/surfaces/frame_sink_id.h"
#include "components/viz/host/host_frame_sink_manager.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "services/ui/gpu_host/gpu_host_delegate.h"
#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/async_event_dispatcher_lookup.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"
......@@ -32,12 +32,16 @@
#include "services/ui/ws/video_detector_impl.h"
namespace ui {
namespace gpu_host {
class GpuHost;
}
namespace ws {
class AccessPolicy;
class Display;
class DisplayManager;
class GpuHost;
class ServerWindow;
class ThreadedImageCursorsFactory;
class UserActivityMonitor;
......@@ -59,7 +63,7 @@ struct WindowTreeAndWindowId {
// WindowTrees) as well as providing the root of the hierarchy.
class WindowServer : public ServerWindowDelegate,
public ServerWindowObserver,
public GpuHostDelegate,
public gpu_host::GpuHostDelegate,
public UserDisplayManagerDelegate,
public AsyncEventDispatcherLookup {
public:
......@@ -78,8 +82,8 @@ class WindowServer : public ServerWindowDelegate,
return display_creation_config_;
}
void SetGpuHost(std::unique_ptr<GpuHost> gpu_host);
GpuHost* gpu_host() { return gpu_host_.get(); }
void SetGpuHost(std::unique_ptr<gpu_host::GpuHost> gpu_host);
gpu_host::GpuHost* gpu_host() { return gpu_host_.get(); }
bool is_hosting_viz() const { return !!host_frame_sink_manager_; }
......@@ -408,7 +412,7 @@ class WindowServer : public ServerWindowDelegate,
// Next id supplied to the window manager.
uint32_t next_wm_change_id_;
std::unique_ptr<GpuHost> gpu_host_;
std::unique_ptr<gpu_host::GpuHost> gpu_host_;
base::OnceCallback<void(ServerWindow*)> surface_activation_callback_;
std::unique_ptr<UserActivityMonitor> user_activity_monitor_;
......
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