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

Unified Diff: content/gpu/gpu_child_thread.cc

Issue 2701233002: gpu: Use mojom.GpuService API for memory allocation. (Closed)
Patch Set: . Created 3 years, 9 months 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
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/gpu/gpu_child_thread.cc
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc
index ee298d1e961d7638fbdf82c1706b29f94b78704a..bd874a6701fd8a7ca25c4fb503ad3b9e7683736e 100644
--- a/content/gpu/gpu_child_thread.cc
+++ b/content/gpu/gpu_child_thread.cc
@@ -55,61 +55,9 @@
namespace content {
namespace {
-// Message filter used to to handle GpuMsg_CreateGpuMemoryBuffer messages
-// on the IO thread. This allows the UI thread in the browser process to remain
-// fast at all times.
-class GpuMemoryBufferMessageFilter : public IPC::MessageFilter {
- public:
- explicit GpuMemoryBufferMessageFilter(
- gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory)
- : gpu_memory_buffer_factory_(gpu_memory_buffer_factory),
- sender_(nullptr) {}
-
- // Overridden from IPC::MessageFilter:
- void OnFilterAdded(IPC::Channel* channel) override {
- DCHECK(!sender_);
- sender_ = channel;
- }
- void OnFilterRemoved() override {
- DCHECK(sender_);
- sender_ = nullptr;
- }
- bool OnMessageReceived(const IPC::Message& message) override {
- DCHECK(sender_);
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(GpuMemoryBufferMessageFilter, message)
- IPC_MESSAGE_HANDLER(GpuMsg_CreateGpuMemoryBuffer, OnCreateGpuMemoryBuffer)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
- }
-
- protected:
- ~GpuMemoryBufferMessageFilter() override {}
-
- void OnCreateGpuMemoryBuffer(
- const GpuMsg_CreateGpuMemoryBuffer_Params& params) {
- TRACE_EVENT2("gpu", "GpuMemoryBufferMessageFilter::OnCreateGpuMemoryBuffer",
- "id", params.id.id, "client_id", params.client_id);
-
- DCHECK(gpu_memory_buffer_factory_);
- sender_->Send(new GpuHostMsg_GpuMemoryBufferCreated(
- gpu_memory_buffer_factory_->CreateGpuMemoryBuffer(
- params.id, params.size, params.format, params.usage,
- params.client_id, params.surface_handle)));
- }
-
- gpu::GpuMemoryBufferFactory* const gpu_memory_buffer_factory_;
- IPC::Sender* sender_;
-};
-
-ChildThreadImpl::Options GetOptions(
- gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) {
+ChildThreadImpl::Options GetOptions() {
ChildThreadImpl::Options::Builder builder;
- builder.AddStartupFilter(
- new GpuMemoryBufferMessageFilter(gpu_memory_buffer_factory));
-
#if defined(USE_OZONE)
IPC::MessageFilter* message_filter =
ui::OzonePlatform::GetInstance()->GetGpuMessageFilter();
@@ -131,7 +79,7 @@ GpuChildThread::GpuChildThread(
const gpu::GpuFeatureInfo& gpu_feature_info,
DeferredMessages deferred_messages,
gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory)
- : GpuChildThread(GetOptions(gpu_memory_buffer_factory),
+ : GpuChildThread(GetOptions(),
std::move(watchdog_thread),
dead_on_arrival,
false /* in_browser_process */,
@@ -148,8 +96,6 @@ GpuChildThread::GpuChildThread(
gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory)
: GpuChildThread(ChildThreadImpl::Options::Builder()
.InBrowserProcess(params)
- .AddStartupFilter(new GpuMemoryBufferMessageFilter(
- gpu_memory_buffer_factory))
.ConnectToBrowser(true)
.Build(),
nullptr /* watchdog_thread */,
@@ -237,21 +183,6 @@ bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) {
return handled;
}
-bool GpuChildThread::OnMessageReceived(const IPC::Message& msg) {
- if (ChildThreadImpl::OnMessageReceived(msg))
- return true;
-
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg)
- IPC_MESSAGE_HANDLER(GpuMsg_DestroyGpuMemoryBuffer, OnDestroyGpuMemoryBuffer)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- if (handled)
- return true;
-
- return false;
-}
-
void GpuChildThread::OnAssociatedInterfaceRequest(
const std::string& name,
mojo::ScopedInterfaceEndpointHandle handle) {
@@ -319,14 +250,6 @@ void GpuChildThread::OnGpuSwitched() {
ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched();
}
-void GpuChildThread::OnDestroyGpuMemoryBuffer(
- gfx::GpuMemoryBufferId id,
- int client_id,
- const gpu::SyncToken& sync_token) {
- if (gpu_channel_manager())
- gpu_channel_manager()->DestroyGpuMemoryBuffer(id, client_id, sync_token);
-}
-
void GpuChildThread::BindServiceFactoryRequest(
service_manager::mojom::ServiceFactoryRequest request) {
DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest";
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698