Commit 70c01ff9 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

window-service: minor renaming/docs for ClientRoot

This renames UpdatePrimarySurfaceId() to
UpdateLocalSurfaceIdAndClientSurfaceEmbedder(), which better indicates what
it does.

There should be no functional change here, just docs/renaming.

BUG=none
TEST=none

Change-Id: Icfe5643c0225f2e158fe8843b03f08b7dec30495
Reviewed-on: https://chromium-review.googlesource.com/c/1437576
Commit-Queue: Scott Violet <sky@chromium.org>
Commit-Queue: Xiyuan Xia <xiyuan@chromium.org>
Auto-Submit: Scott Violet <sky@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#626212}
parent 0745e0e4
...@@ -74,7 +74,7 @@ void ClientRoot::RegisterVizEmbeddingSupport() { ...@@ -74,7 +74,7 @@ void ClientRoot::RegisterVizEmbeddingSupport() {
frame_sink_id, this, viz::ReportFirstSurfaceActivation::kYes); frame_sink_id, this, viz::ReportFirstSurfaceActivation::kYes);
window_->SetEmbedFrameSinkId(frame_sink_id); window_->SetEmbedFrameSinkId(frame_sink_id);
UpdatePrimarySurfaceId(); UpdateLocalSurfaceIdAndClientSurfaceEmbedder();
} }
bool ClientRoot::ShouldAssignLocalSurfaceId() { bool ClientRoot::ShouldAssignLocalSurfaceId() {
...@@ -106,6 +106,19 @@ void ClientRoot::UpdateLocalSurfaceIdIfNecessary() { ...@@ -106,6 +106,19 @@ void ClientRoot::UpdateLocalSurfaceIdIfNecessary() {
} }
} }
void ClientRoot::UpdateLocalSurfaceIdAndClientSurfaceEmbedder() {
UpdateLocalSurfaceIdIfNecessary();
ProxyWindow* proxy_window = ProxyWindow::GetMayBeNull(window_);
if (proxy_window->local_surface_id().has_value()) {
client_surface_embedder_->SetSurfaceId(viz::SurfaceId(
window_->GetFrameSinkId(), *proxy_window->local_surface_id()));
if (fallback_surface_info_) {
client_surface_embedder_->SetFallbackSurfaceInfo(*fallback_surface_info_);
fallback_surface_info_.reset();
}
}
}
void ClientRoot::OnLocalSurfaceIdChanged() { void ClientRoot::OnLocalSurfaceIdChanged() {
if (ShouldAssignLocalSurfaceId()) if (ShouldAssignLocalSurfaceId())
return; return;
...@@ -165,19 +178,6 @@ void ClientRoot::UnattachChildFrameSinkIdRecursive(ProxyWindow* proxy_window) { ...@@ -165,19 +178,6 @@ void ClientRoot::UnattachChildFrameSinkIdRecursive(ProxyWindow* proxy_window) {
} }
} }
void ClientRoot::UpdatePrimarySurfaceId() {
UpdateLocalSurfaceIdIfNecessary();
ProxyWindow* proxy_window = ProxyWindow::GetMayBeNull(window_);
if (proxy_window->local_surface_id().has_value()) {
client_surface_embedder_->SetSurfaceId(viz::SurfaceId(
window_->GetFrameSinkId(), *proxy_window->local_surface_id()));
if (fallback_surface_info_) {
client_surface_embedder_->SetFallbackSurfaceInfo(*fallback_surface_info_);
fallback_surface_info_.reset();
}
}
}
void ClientRoot::CheckForScaleFactorChange() { void ClientRoot::CheckForScaleFactorChange() {
if (!ShouldAssignLocalSurfaceId() || if (!ShouldAssignLocalSurfaceId() ||
last_device_scale_factor_ == window_->layer()->device_scale_factor()) { last_device_scale_factor_ == window_->layer()->device_scale_factor()) {
...@@ -189,7 +189,7 @@ void ClientRoot::CheckForScaleFactorChange() { ...@@ -189,7 +189,7 @@ void ClientRoot::CheckForScaleFactorChange() {
} }
void ClientRoot::HandleBoundsOrScaleFactorChange(const gfx::Rect& old_bounds) { void ClientRoot::HandleBoundsOrScaleFactorChange(const gfx::Rect& old_bounds) {
UpdatePrimarySurfaceId(); UpdateLocalSurfaceIdAndClientSurfaceEmbedder();
client_surface_embedder_->UpdateSizeAndGutters(); client_surface_embedder_->UpdateSizeAndGutters();
// See comments in WindowTree::SetWindowBoundsImpl() for details on // See comments in WindowTree::SetWindowBoundsImpl() for details on
// why this always notifies the client. // why this always notifies the client.
...@@ -304,7 +304,7 @@ void ClientRoot::OnFirstSurfaceActivation( ...@@ -304,7 +304,7 @@ void ClientRoot::OnFirstSurfaceActivation(
if (proxy_window->local_surface_id().has_value()) { if (proxy_window->local_surface_id().has_value()) {
DCHECK(!fallback_surface_info_); DCHECK(!fallback_surface_info_);
if (!client_surface_embedder_->HasPrimarySurfaceId()) if (!client_surface_embedder_->HasPrimarySurfaceId())
UpdatePrimarySurfaceId(); UpdateLocalSurfaceIdAndClientSurfaceEmbedder();
client_surface_embedder_->SetFallbackSurfaceInfo(surface_info); client_surface_embedder_->SetFallbackSurfaceInfo(surface_info);
} else { } else {
fallback_surface_info_ = std::make_unique<viz::SurfaceInfo>(surface_info); fallback_surface_info_ = std::make_unique<viz::SurfaceInfo>(surface_info);
......
...@@ -80,15 +80,19 @@ class COMPONENT_EXPORT(WINDOW_SERVICE) ClientRoot ...@@ -80,15 +80,19 @@ class COMPONENT_EXPORT(WINDOW_SERVICE) ClientRoot
private: private:
friend class ClientRootTestHelper; friend class ClientRootTestHelper;
void UpdatePrimarySurfaceId();
// Returns true if the WindowService should assign the LocalSurfaceId. A value // Returns true if the WindowService should assign the LocalSurfaceId. A value
// of false means the client is expected to providate the LocalSurfaceId. // of false means the client is expected to providate the LocalSurfaceId.
bool ShouldAssignLocalSurfaceId(); bool ShouldAssignLocalSurfaceId();
// If necessary, this updates the LocalSurfaceId. // If necessary, this updates the LocalSurfaceId. Generally you should call
// UpdateLocalSurfaceIdAndClientSurfaceEmbedder(), not this. If you call this,
// you need to ensure the ClientSurfaceEmbedder is updated at a later time.
void UpdateLocalSurfaceIdIfNecessary(); void UpdateLocalSurfaceIdIfNecessary();
// Calls UpdateLocalSurfaceIdIfNecessary() and if the current LocalSurfaceId
// is valid, updates ClientSurfaceEmbedder.
void UpdateLocalSurfaceIdAndClientSurfaceEmbedder();
// Calls HandleBoundsOrScaleFactorChange() it the scale factor has changed. // Calls HandleBoundsOrScaleFactorChange() it the scale factor has changed.
void CheckForScaleFactorChange(); void CheckForScaleFactorChange();
......
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