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

Unified Diff: content/browser/gpu/gpu_process_host_ui_shim.cc

Issue 338193003: ozone: gpu: Add plumbing for platform-specific gpu messaging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
Index: content/browser/gpu/gpu_process_host_ui_shim.cc
diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc
index 0ef8439fb0cf3625b2036a30bdb2f4c3295a365a..546878c13b474de5b4c3eff50d8f4180a9f5c0d8 100644
--- a/content/browser/gpu/gpu_process_host_ui_shim.cc
+++ b/content/browser/gpu/gpu_process_host_ui_shim.cc
@@ -22,6 +22,10 @@
#include "content/public/browser/browser_thread.h"
#include "ui/gl/gl_switches.h"
+#if defined(USE_OZONE)
+#include "ui/ozone/gpu/gpu_platform_support_host.h"
+#endif
+
namespace content {
namespace {
@@ -108,6 +112,10 @@ void GpuProcessHostUIShim::Destroy(int host_id, const std::string& message) {
logging::LOG_ERROR, "GpuProcessHostUIShim",
message);
+#if defined(USE_OZONE)
+ ui::GpuPlatformSupportHost::GetInstance()->OnHostDestroyed(host_id);
+#endif
+
delete FromID(host_id);
}
@@ -147,10 +155,15 @@ bool GpuProcessHostUIShim::Send(IPC::Message* msg) {
bool GpuProcessHostUIShim::OnMessageReceived(const IPC::Message& message) {
DCHECK(CalledOnValidThread());
- if (message.routing_id() != MSG_ROUTING_CONTROL)
+ if (message.routing_id() == MSG_ROUTING_CONTROL)
+ return OnControlMessageReceived(message);
+
+ IPC::Listener* listener = routes_.Lookup(message.routing_id());
+ if (!listener)
return false;
- return OnControlMessageReceived(message);
+ listener->OnMessageReceived(message);
+ return true;
}
void GpuProcessHostUIShim::SimulateRemoveAllContext() {
@@ -165,6 +178,10 @@ void GpuProcessHostUIShim::SimulateHang() {
Send(new GpuMsg_Hang());
}
+void GpuProcessHostUIShim::AddRoute(int32 routing_id, IPC::Listener* listener) {
+ routes_.AddWithID(listener, routing_id);
+}
+
GpuProcessHostUIShim::~GpuProcessHostUIShim() {
DCHECK(CalledOnValidThread());
g_hosts_by_id.Pointer()->Remove(host_id_);
@@ -195,6 +212,8 @@ bool GpuProcessHostUIShim::OnControlMessageReceived(
IPC_MESSAGE_HANDLER(GpuHostMsg_UpdateVSyncParameters,
OnUpdateVSyncParameters)
IPC_MESSAGE_HANDLER(GpuHostMsg_FrameDrawn, OnFrameDrawn)
+ IPC_MESSAGE_HANDLER(GpuHostMsg_PlatformSupportInitialized,
+ OnPlatformSupportInitialized);
IPC_MESSAGE_UNHANDLED_ERROR()
IPC_END_MESSAGE_MAP()
@@ -287,6 +306,16 @@ void GpuProcessHostUIShim::OnFrameDrawn(
RenderWidgetHostImpl::CompositorFrameDrawn(latency_info);
}
+void GpuProcessHostUIShim::OnPlatformSupportInitialized(int32 host_route_id,
+ int32 gpu_route_id) {
+#if defined(USE_OZONE)
+ ui::GpuPlatformSupportHost* platform_support_host =
+ ui::GpuPlatformSupportHost::GetInstance();
+ AddRoute(host_route_id, platform_support_host);
+ platform_support_host->OnChannelEstablished(host_id_, gpu_route_id, this);
+#endif
+}
+
void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer(
const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) {
TRACE_EVENT0("renderer",

Powered by Google App Engine
This is Rietveld 408576698