Commit 515bc373 authored by rjkroege's avatar rjkroege Committed by Commit bot

Renamed ChannelObserver to better describe its purpose

In the ozone drm platform, the ChannelObserver watches for changes
on the IPC channel. However, ozone/drm will soon support execute in
an in-process mode for MUS and the existing multi-process mode.
Rename the class to reflect this.

BUG=558602

Review URL: https://codereview.chromium.org/1603213002

Cr-Commit-Position: refs/heads/master@{#371920}
parent 6adbc801
......@@ -87,7 +87,6 @@ source_set("gbm") {
"gpu/scanout_buffer.h",
"gpu/screen_manager.cc",
"gpu/screen_manager.h",
"host/channel_observer.h",
"host/drm_cursor.cc",
"host/drm_cursor.h",
"host/drm_cursor_core.cc",
......@@ -114,6 +113,7 @@ source_set("gbm") {
"host/drm_window_host.h",
"host/drm_window_host_manager.cc",
"host/drm_window_host_manager.h",
"host/gpu_thread_observer.h",
"ozone_platform_gbm.cc",
"ozone_platform_gbm.h",
]
......
......@@ -121,7 +121,6 @@
'gpu/proxy_helpers.h',
'gpu/screen_manager.cc',
'gpu/screen_manager.h',
'host/channel_observer.h',
'host/drm_cursor.cc',
'host/drm_cursor.h',
'host/drm_cursor_core.cc',
......@@ -148,6 +147,7 @@
'host/drm_window_host.h',
'host/drm_window_host_manager.cc',
'host/drm_window_host_manager.h',
'host/gpu_thread_observer.h',
'ozone_platform_gbm.cc',
'ozone_platform_gbm.h',
],
......
......@@ -18,11 +18,11 @@ DrmDisplayHost::DrmDisplayHost(DrmGpuPlatformSupportHost* sender,
: sender_(sender),
snapshot_(new DisplaySnapshotProxy(params)),
is_dummy_(is_dummy) {
sender_->AddChannelObserver(this);
sender_->AddGpuThreadObserver(this);
}
DrmDisplayHost::~DrmDisplayHost() {
sender_->RemoveChannelObserver(this);
sender_->RemoveGpuThreadObserver(this);
ClearCallbacks();
}
......@@ -107,7 +107,7 @@ void DrmDisplayHost::SetGammaRamp(const std::vector<GammaRampRGBEntry>& lut) {
sender_->Send(new OzoneGpuMsg_SetGammaRamp(snapshot_->display_id(), lut));
}
void DrmDisplayHost::OnChannelEstablished() {
void DrmDisplayHost::OnGpuThreadReady() {
is_dummy_ = false;
// Note: These responses are done here since the OnChannelDestroyed() is
......@@ -115,8 +115,7 @@ void DrmDisplayHost::OnChannelEstablished() {
ClearCallbacks();
}
void DrmDisplayHost::OnChannelDestroyed() {
}
void DrmDisplayHost::OnGpuThreadRetired() {}
void DrmDisplayHost::ClearCallbacks() {
if (!configure_callback_.is_null())
......
......@@ -9,7 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "ui/display/types/display_constants.h"
#include "ui/display/types/native_display_delegate.h"
#include "ui/ozone/platform/drm/host/channel_observer.h"
#include "ui/ozone/platform/drm/host/gpu_thread_observer.h"
namespace ui {
......@@ -17,7 +17,7 @@ struct DisplaySnapshot_Params;
class DisplaySnapshot;
class DrmGpuPlatformSupportHost;
class DrmDisplayHost : public ChannelObserver {
class DrmDisplayHost : public GpuThreadObserver {
public:
DrmDisplayHost(DrmGpuPlatformSupportHost* sender,
const DisplaySnapshot_Params& params,
......@@ -40,9 +40,9 @@ class DrmDisplayHost : public ChannelObserver {
void OnHDCPStateReceived(bool status, HDCPState state);
void OnHDCPStateUpdated(bool status);
// ChannelObserver:
void OnChannelEstablished() override;
void OnChannelDestroyed() override;
// GpuThreadObserver:
void OnGpuThreadReady() override;
void OnGpuThreadRetired() override;
private:
// Calls all the callbacks with failure.
......
......@@ -9,8 +9,8 @@
#include "base/trace_event/trace_event.h"
#include "ui/ozone/common/gpu/ozone_gpu_message_params.h"
#include "ui/ozone/common/gpu/ozone_gpu_messages.h"
#include "ui/ozone/platform/drm/host/channel_observer.h"
#include "ui/ozone/platform/drm/host/drm_cursor.h"
#include "ui/ozone/platform/drm/host/gpu_thread_observer.h"
namespace ui {
......@@ -37,16 +37,17 @@ void DrmGpuPlatformSupportHost::UnregisterHandler(
handlers_.erase(it);
}
void DrmGpuPlatformSupportHost::AddChannelObserver(ChannelObserver* observer) {
channel_observers_.AddObserver(observer);
void DrmGpuPlatformSupportHost::AddGpuThreadObserver(
GpuThreadObserver* observer) {
gpu_thread_observers_.AddObserver(observer);
if (IsConnected())
observer->OnChannelEstablished();
observer->OnGpuThreadReady();
}
void DrmGpuPlatformSupportHost::RemoveChannelObserver(
ChannelObserver* observer) {
channel_observers_.RemoveObserver(observer);
void DrmGpuPlatformSupportHost::RemoveGpuThreadObserver(
GpuThreadObserver* observer) {
gpu_thread_observers_.RemoveObserver(observer);
}
bool DrmGpuPlatformSupportHost::IsConnected() {
......@@ -66,8 +67,8 @@ void DrmGpuPlatformSupportHost::OnChannelEstablished(
for (size_t i = 0; i < handlers_.size(); ++i)
handlers_[i]->OnChannelEstablished(host_id, send_runner_, send_callback_);
FOR_EACH_OBSERVER(ChannelObserver, channel_observers_,
OnChannelEstablished());
FOR_EACH_OBSERVER(GpuThreadObserver, gpu_thread_observers_,
OnGpuThreadReady());
// The cursor is special since it will process input events on the IO thread
// and can by-pass the UI thread. This means that we need to special case it
......@@ -86,8 +87,8 @@ void DrmGpuPlatformSupportHost::OnChannelDestroyed(int host_id) {
host_id_ = -1;
send_runner_ = nullptr;
send_callback_.Reset();
FOR_EACH_OBSERVER(ChannelObserver, channel_observers_,
OnChannelDestroyed());
FOR_EACH_OBSERVER(GpuThreadObserver, gpu_thread_observers_,
OnGpuThreadRetired());
}
for (size_t i = 0; i < handlers_.size(); ++i)
......
......@@ -20,8 +20,8 @@ class Point;
namespace ui {
class ChannelObserver;
class DrmCursor;
class GpuThreadObserver;
class DrmGpuPlatformSupportHost : public GpuPlatformSupportHost,
public IPC::Sender {
......@@ -32,8 +32,8 @@ class DrmGpuPlatformSupportHost : public GpuPlatformSupportHost,
void RegisterHandler(GpuPlatformSupportHost* handler);
void UnregisterHandler(GpuPlatformSupportHost* handler);
void AddChannelObserver(ChannelObserver* observer);
void RemoveChannelObserver(ChannelObserver* observer);
void AddGpuThreadObserver(GpuThreadObserver* observer);
void RemoveGpuThreadObserver(GpuThreadObserver* observer);
bool IsConnected();
......@@ -58,7 +58,7 @@ class DrmGpuPlatformSupportHost : public GpuPlatformSupportHost,
std::vector<GpuPlatformSupportHost*> handlers_; // Not owned.
DrmCursor* cursor_; // Not owned.
base::ObserverList<ChannelObserver> channel_observers_;
base::ObserverList<GpuThreadObserver> gpu_thread_observers_;
};
} // namespace ui
......
......@@ -47,12 +47,12 @@ DrmWindowHost::~DrmWindowHost() {
window_manager_->RemoveWindow(widget_);
cursor_->OnWindowRemoved(widget_);
sender_->RemoveChannelObserver(this);
sender_->RemoveGpuThreadObserver(this);
sender_->Send(new OzoneGpuMsg_DestroyWindow(widget_));
}
void DrmWindowHost::Initialize() {
sender_->AddChannelObserver(this);
sender_->AddGpuThreadObserver(this);
PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
cursor_->OnWindowAdded(widget_, bounds_, GetCursorConfinedBounds());
delegate_->OnAcceleratedWidgetAvailable(widget_, 1.f);
......@@ -188,13 +188,12 @@ uint32_t DrmWindowHost::DispatchEvent(const PlatformEvent& native_event) {
return POST_DISPATCH_STOP_PROPAGATION;
}
void DrmWindowHost::OnChannelEstablished() {
void DrmWindowHost::OnGpuThreadReady() {
sender_->Send(new OzoneGpuMsg_CreateWindow(widget_));
SendBoundsChange();
}
void DrmWindowHost::OnChannelDestroyed() {
}
void DrmWindowHost::OnGpuThreadRetired() {}
void DrmWindowHost::SendBoundsChange() {
// Update the cursor before the window so that the cursor stays within the
......
......@@ -13,7 +13,7 @@
#include "ui/events/platform/platform_event_dispatcher.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/ozone/platform/drm/host/channel_observer.h"
#include "ui/ozone/platform/drm/host/gpu_thread_observer.h"
#include "ui/platform_window/platform_window.h"
namespace ui {
......@@ -38,7 +38,7 @@ class EventFactoryEvdev;
// associated with the window (the surface is created on the GPU process).
class DrmWindowHost : public PlatformWindow,
public PlatformEventDispatcher,
public ChannelObserver {
public GpuThreadObserver {
public:
DrmWindowHost(PlatformWindowDelegate* delegate,
const gfx::Rect& bounds,
......@@ -79,8 +79,8 @@ class DrmWindowHost : public PlatformWindow,
uint32_t DispatchEvent(const PlatformEvent& event) override;
// ChannelObserver:
void OnChannelEstablished() override;
void OnChannelDestroyed() override;
void OnGpuThreadReady() override;
void OnGpuThreadRetired() override;
private:
void SendBoundsChange();
......
......@@ -17,7 +17,6 @@ class Point;
namespace ui {
class DrmGpuPlatformSupportHost;
class DrmWindowHost;
// Responsible for keeping the mapping between the allocated widgets and
......
......@@ -2,20 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_OZONE_PLATFORM_DRM_HOST_CHANNEL_OBSERVER_H_
#define UI_OZONE_PLATFORM_DRM_HOST_CHANNEL_OBSERVER_H_
#ifndef UI_OZONE_PLATFORM_DRM_HOST_GPU_THREAD_OBSERVER_H_
#define UI_OZONE_PLATFORM_DRM_HOST_GPU_THREAD_OBSERVER_H_
namespace ui {
// Observes the channel state.
class ChannelObserver {
class GpuThreadObserver {
public:
virtual ~ChannelObserver() {}
virtual ~GpuThreadObserver() {}
virtual void OnChannelEstablished() = 0;
virtual void OnChannelDestroyed() = 0;
// Called when a GPU thread implementation has become available.
virtual void OnGpuThreadReady() = 0;
// Called when the GPU thread implementation has ceased to be
// available.
virtual void OnGpuThreadRetired() = 0;
};
} // namespace ui
#endif // UI_OZONE_PLATFORM_DRM_HOST_CHANNEL_OBSERVER_H_
#endif // UI_OZONE_PLATFORM_DRM_HOST_GPU_THREAD_OBSERVER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment