| Index: services/ui/ws/gpu_host.cc
|
| diff --git a/services/ui/ws/gpu_host.cc b/services/ui/ws/gpu_host.cc
|
| index d8b4eb79b8812ea4f36deaad54403f0e0d32b3be..ac2c22fa609cbc49afd2b5f4f9f76a0d2d45c7b5 100644
|
| --- a/services/ui/ws/gpu_host.cc
|
| +++ b/services/ui/ws/gpu_host.cc
|
| @@ -19,6 +19,10 @@
|
| #include "services/ui/ws/gpu_host_delegate.h"
|
| #include "ui/gfx/buffer_format_util.h"
|
|
|
| +#if defined(OS_WIN)
|
| +#include "ui/gfx/win/rendering_window_manager.h"
|
| +#endif
|
| +
|
| namespace ui {
|
| namespace ws {
|
|
|
| @@ -99,10 +103,10 @@ GpuHost::GpuHost(GpuHostDelegate* delegate)
|
| next_client_id_(kInternalGpuChannelClientId + 1),
|
| main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
|
| gpu_host_binding_(this) {
|
| - gpu_main_impl_ = base::MakeUnique<GpuMain>(MakeRequest(&gpu_main_));
|
| - gpu_main_impl_->OnStart();
|
| // TODO(sad): Once GPU process is split, this would look like:
|
| // connector->ConnectToInterface("gpu", &gpu_main_);
|
| + gpu_main_impl_ = base::MakeUnique<GpuMain>(MakeRequest(&gpu_main_));
|
| + gpu_main_impl_->OnStart();
|
| gpu_main_->CreateGpuService(MakeRequest(&gpu_service_),
|
| gpu_host_binding_.CreateInterfacePtrAndBind());
|
| gpu_memory_buffer_manager_ = base::MakeUnique<ServerGpuMemoryBufferManager>(
|
| @@ -119,12 +123,30 @@ void GpuHost::Add(mojom::GpuRequest request) {
|
| std::move(request));
|
| }
|
|
|
| +void GpuHost::OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) {
|
| +#if defined(OS_WIN)
|
| + gfx::RenderingWindowManager::GetInstance()->RegisterParent(widget);
|
| +#endif
|
| +}
|
| +
|
| +void GpuHost::OnAcceleratedWidgetDestroyed(gfx::AcceleratedWidget widget) {
|
| +#if defined(OS_WIN)
|
| + gfx::RenderingWindowManager::GetInstance()->UnregisterParent(widget);
|
| +#endif
|
| +}
|
| +
|
| void GpuHost::CreateDisplayCompositor(
|
| cc::mojom::DisplayCompositorRequest request,
|
| cc::mojom::DisplayCompositorClientPtr client) {
|
| gpu_main_->CreateDisplayCompositor(std::move(request), std::move(client));
|
| }
|
|
|
| +void GpuHost::OnBadMessageFromGpu() {
|
| + // TODO(sad): Received some unexpected message from the gpu process. We
|
| + // should kill the process and restart it.
|
| + NOTIMPLEMENTED();
|
| +}
|
| +
|
| void GpuHost::DidInitialize(const gpu::GPUInfo& gpu_info) {
|
| gpu_info_ = gpu_info;
|
| delegate_->OnGpuServiceInitialized();
|
| @@ -140,6 +162,28 @@ void GpuHost::DidLoseContext(bool offscreen,
|
| gpu::error::ContextLostReason reason,
|
| const GURL& active_url) {}
|
|
|
| +void GpuHost::SetChildSurface(gpu::SurfaceHandle parent,
|
| + gpu::SurfaceHandle child) {
|
| +#if defined(OS_WIN)
|
| + // Verify that |parent| was created by the window server.
|
| + DWORD process_id = 0;
|
| + DWORD thread_id = GetWindowThreadProcessId(parent, &process_id);
|
| + if (!thread_id || process_id != ::GetCurrentProcessId()) {
|
| + OnBadMessageFromGpu();
|
| + return;
|
| + }
|
| +
|
| + // TODO(sad): Also verify that |child| was created by the mus-gpu process.
|
| +
|
| + if (!gfx::RenderingWindowManager::GetInstance()->RegisterChild(parent,
|
| + child)) {
|
| + OnBadMessageFromGpu();
|
| + }
|
| +#else
|
| + NOTREACHED();
|
| +#endif
|
| +}
|
| +
|
| void GpuHost::StoreShaderToDisk(int32_t client_id,
|
| const std::string& key,
|
| const std::string& shader) {}
|
|
|