Index: ui/ozone/platform/dri/gpu_platform_support_host_gbm.cc |
diff --git a/ui/ozone/platform/dri/gpu_platform_support_host_gbm.cc b/ui/ozone/platform/dri/gpu_platform_support_host_gbm.cc |
index 39478bd427f5af0b2c3b5eba6be9e736997a64e2..4f0394aa5c9fb5f04275e00a11233555b8ec8ca7 100644 |
--- a/ui/ozone/platform/dri/gpu_platform_support_host_gbm.cc |
+++ b/ui/ozone/platform/dri/gpu_platform_support_host_gbm.cc |
@@ -4,6 +4,7 @@ |
#include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" |
+#include "ui/ozone/common/gpu/ozone_gpu_message_params.h" |
#include "ui/ozone/common/gpu/ozone_gpu_messages.h" |
namespace ui { |
@@ -12,10 +13,28 @@ GpuPlatformSupportHostGbm::GpuPlatformSupportHostGbm() |
: host_id_(-1), sender_(NULL) { |
} |
+GpuPlatformSupportHostGbm::~GpuPlatformSupportHostGbm() {} |
+ |
+void GpuPlatformSupportHostGbm::RegisterHandler( |
+ GpuPlatformSupportHost* handler) { |
+ handlers_.push_back(handler); |
+} |
+ |
+void GpuPlatformSupportHostGbm::UnregisterHandler( |
+ GpuPlatformSupportHost* handler) { |
+ std::vector<GpuPlatformSupportHost*>::iterator it = |
+ std::find(handlers_.begin(), handlers_.end(), handler); |
+ if (it != handlers_.end()) |
+ handlers_.erase(it); |
+} |
+ |
void GpuPlatformSupportHostGbm::OnChannelEstablished(int host_id, |
IPC::Sender* sender) { |
host_id_ = host_id; |
sender_ = sender; |
+ |
+ for (size_t i = 0; i < handlers_.size(); ++i) |
+ handlers_[i]->OnChannelEstablished(host_id, sender); |
} |
void GpuPlatformSupportHostGbm::OnChannelDestroyed(int host_id) { |
@@ -23,9 +42,23 @@ void GpuPlatformSupportHostGbm::OnChannelDestroyed(int host_id) { |
host_id_ = -1; |
sender_ = NULL; |
} |
+ |
+ for (size_t i = 0; i < handlers_.size(); ++i) |
+ handlers_[i]->OnChannelDestroyed(host_id); |
} |
bool GpuPlatformSupportHostGbm::OnMessageReceived(const IPC::Message& message) { |
+ for (size_t i = 0; i < handlers_.size(); ++i) |
+ if (handlers_[i]->OnMessageReceived(message)) |
+ return true; |
+ |
+ return false; |
+} |
+ |
+bool GpuPlatformSupportHostGbm::Send(IPC::Message* message) { |
+ if (sender_) |
+ return sender_->Send(message); |
+ |
return false; |
} |