Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Unified Diff: services/ui/ws/gpu_service_proxy.cc

Issue 2481263002: Introduce Display Compositor mojo interface. Use InProcessContextProvider. (Closed)
Patch Set: Speculative fix for android build issue Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: services/ui/ws/gpu_service_proxy.cc
diff --git a/services/ui/ws/gpu_service_proxy.cc b/services/ui/ws/gpu_service_proxy.cc
index 64441648ff8fd8728849e5bdd3c149dac1871c90..46a4c2500a68bf07f6557dba2a7aab14e99a4056 100644
--- a/services/ui/ws/gpu_service_proxy.cc
+++ b/services/ui/ws/gpu_service_proxy.cc
@@ -14,7 +14,6 @@
#include "mojo/public/cpp/system/platform_handle.h"
#include "services/service_manager/public/cpp/connection.h"
#include "services/ui/ws/gpu_service_proxy_delegate.h"
-#include "services/ui/ws/mus_gpu_memory_buffer_manager.h"
#include "ui/gfx/buffer_format_util.h"
namespace ui {
@@ -22,17 +21,15 @@ namespace ws {
namespace {
-const int32_t kInternalGpuChannelClientId = 1;
-const uint64_t kInternalGpuChannelClientTracingId = 1;
+// The client Id 1 is reserved for the display compositor.
+const int32_t kInternalGpuChannelClientId = 2;
} // namespace
GpuServiceProxy::GpuServiceProxy(GpuServiceProxyDelegate* delegate)
: delegate_(delegate),
next_client_id_(kInternalGpuChannelClientId + 1),
- main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
- shutdown_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
- base::WaitableEvent::InitialState::NOT_SIGNALED) {
+ main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()) {
gpu_main_.OnStart();
// TODO(sad): Once GPU process is split, this would look like:
// connector->ConnectToInterface("gpu", &gpu_service_);
@@ -42,39 +39,22 @@ GpuServiceProxy::GpuServiceProxy(GpuServiceProxyDelegate* delegate)
}
GpuServiceProxy::~GpuServiceProxy() {
- if (gpu_channel_)
- gpu_channel_->DestroyChannel();
}
void GpuServiceProxy::Add(mojom::GpuServiceRequest request) {
bindings_.AddBinding(this, std::move(request));
}
+void GpuServiceProxy::CreateDisplayCompositor(
+ cc::mojom::DisplayCompositorRequest request,
+ cc::mojom::DisplayCompositorClientPtr client) {
+ gpu_service_->CreateDisplayCompositor(std::move(request), std::move(client));
+}
+
void GpuServiceProxy::OnInitialized(const gpu::GPUInfo& gpu_info) {
gpu_info_ = gpu_info;
- constexpr bool is_gpu_host = true;
- gpu_service_->EstablishGpuChannel(
- kInternalGpuChannelClientId, kInternalGpuChannelClientTracingId,
- is_gpu_host, base::Bind(&GpuServiceProxy::OnInternalGpuChannelEstablished,
- base::Unretained(this)));
-}
-
-void GpuServiceProxy::OnInternalGpuChannelEstablished(
- mojo::ScopedMessagePipeHandle channel_handle) {
- io_thread_ = base::MakeUnique<base::Thread>("GPUIOThread");
- base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0);
- thread_options.priority = base::ThreadPriority::NORMAL;
- CHECK(io_thread_->StartWithOptions(thread_options));
-
- gpu_memory_buffer_manager_ = base::MakeUnique<MusGpuMemoryBufferManager>(
- gpu_service_.get(), kInternalGpuChannelClientId);
- gpu_channel_ = gpu::GpuChannelHost::Create(
- this, kInternalGpuChannelClientId, gpu_info_,
- IPC::ChannelHandle(channel_handle.release()), &shutdown_event_,
- gpu_memory_buffer_manager_.get());
- if (delegate_)
- delegate_->OnGpuChannelEstablished(gpu_channel_);
+ delegate_->OnGpuServiceInitialized();
}
void GpuServiceProxy::OnGpuChannelEstablished(
@@ -119,22 +99,5 @@ void GpuServiceProxy::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
// NOTIMPLEMENTED();
}
-bool GpuServiceProxy::IsMainThread() {
- return main_thread_task_runner_->BelongsToCurrentThread();
-}
-
-scoped_refptr<base::SingleThreadTaskRunner>
-GpuServiceProxy::GetIOThreadTaskRunner() {
- return io_thread_->task_runner();
-}
-
-std::unique_ptr<base::SharedMemory> GpuServiceProxy::AllocateSharedMemory(
- size_t size) {
- std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory());
- if (!shm->CreateAnonymous(size))
- shm.reset();
- return shm;
-}
-
} // namespace ws
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698