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

Unified Diff: services/ui/ws/window_tree.cc

Issue 2582823002: WIP: Surface Synchronization System
Patch Set: Only create ClientSurfaceEmbedder if window is visible. Trash it otherwise. Created 3 years, 11 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: services/ui/ws/window_tree.cc
diff --git a/services/ui/ws/window_tree.cc b/services/ui/ws/window_tree.cc
index 1fb3e481e9fa42ffc638627e8c523b92c7417b7c..c21102a295a42c728f73b505d0ae50939751b42b 100644
--- a/services/ui/ws/window_tree.cc
+++ b/services/ui/ws/window_tree.cc
@@ -82,6 +82,7 @@ WindowTree::WindowTree(WindowServer* window_server,
}
WindowTree::~WindowTree() {
+ fprintf(stderr, ">>>%s\n", __PRETTY_FUNCTION__);
DestroyWindows();
// We alert the WindowManagerState that we're destroying this state here
@@ -266,13 +267,14 @@ bool WindowTree::ReleaseCapture(const ClientWindowId& client_window_id) {
bool WindowTree::NewWindow(
const ClientWindowId& client_window_id,
- const std::map<std::string, std::vector<uint8_t>>& properties) {
+ const std::map<std::string, std::vector<uint8_t>>& properties,
+ const cc::LocalFrameId& local_frame_id) {
if (!IsValidIdForNewWindow(client_window_id))
return false;
const WindowId window_id = GenerateNewWindowId();
DCHECK(!GetWindow(window_id));
ServerWindow* window =
- window_server_->CreateServerWindow(window_id, properties);
+ window_server_->CreateServerWindow(window_id, properties, local_frame_id);
created_window_map_[window_id] = window;
client_id_to_window_id_map_[client_window_id] = window_id;
window_id_to_client_id_map_[window_id] = client_window_id;
@@ -486,6 +488,7 @@ void WindowTree::OnWindowManagerCreatedTopLevelWindow(
DCHECK(IsValidIdForNewWindow(
waiting_for_top_level_window_info->client_window_id));
if (!window) {
+ fprintf(stderr, ">>>LOST A WINDOW :S\n");
client()->OnChangeCompleted(client_change_id, false);
return;
}
@@ -497,6 +500,10 @@ void WindowTree::OnWindowManagerCreatedTopLevelWindow(
Display* display = GetDisplay(window);
int64_t display_id = display ? display->GetId() : display::kInvalidDisplayId;
const bool drawn = window->parent() && window->parent()->IsDrawn();
+ fprintf(stderr,
+ ">>>>WindowTree::OnWindowManagerCreatedTopLevelWindow frame_sink_id: "
+ "%d\n",
+ WindowIdToTransportId(window->id()));
client()->OnTopLevelCreated(client_change_id, WindowToWindowData(window),
display_id, drawn);
}
@@ -547,14 +554,17 @@ void WindowTree::ClientJankinessChanged(WindowTree* tree) {
}
}
-void WindowTree::ProcessWindowBoundsChanged(const ServerWindow* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds,
- bool originated_change) {
+void WindowTree::ProcessWindowBoundsChanged(
+ const ServerWindow* window,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds,
+ bool originated_change,
+ const cc::LocalFrameId& local_frame_id) {
ClientWindowId client_window_id;
if (originated_change || !IsWindowKnown(window, &client_window_id))
return;
- client()->OnWindowBoundsChanged(client_window_id.id, old_bounds, new_bounds);
+ client()->OnWindowBoundsChanged(client_window_id.id, old_bounds, new_bounds,
+ local_frame_id);
}
void WindowTree::ProcessClientAreaChanged(
@@ -1043,6 +1053,7 @@ mojom::WindowDataPtr WindowTree::WindowToWindowData(
window_data->bounds = window->bounds();
window_data->properties = mojo::MapToUnorderedMap(window->properties());
window_data->visible = window->visible();
+ window_data->local_frame_id = window->local_frame_id();
return window_data;
}
@@ -1167,13 +1178,15 @@ void WindowTree::NewWindow(
uint32_t change_id,
Id transport_window_id,
const base::Optional<std::unordered_map<std::string, std::vector<uint8_t>>>&
- transport_properties) {
+ transport_properties,
+ const cc::LocalFrameId& local_frame_id) {
std::map<std::string, std::vector<uint8_t>> properties;
if (transport_properties.has_value())
properties = mojo::UnorderedMapToMap(transport_properties.value());
client()->OnChangeCompleted(
- change_id, NewWindow(ClientWindowId(transport_window_id), properties));
+ change_id, NewWindow(ClientWindowId(transport_window_id), properties,
+ local_frame_id));
}
void WindowTree::NewTopLevelWindow(
@@ -1331,7 +1344,8 @@ void WindowTree::StopPointerWatcher() {
void WindowTree::SetWindowBounds(uint32_t change_id,
Id window_id,
- const gfx::Rect& bounds) {
+ const gfx::Rect& bounds,
+ const cc::LocalFrameId& local_frame_id) {
ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
if (window && ShouldRouteToWindowManager(window)) {
const uint32_t wm_change_id =
@@ -1343,7 +1357,7 @@ void WindowTree::SetWindowBounds(uint32_t change_id,
WindowTree* wm_tree = display_root->window_manager_state()->window_tree();
wm_tree->window_manager_internal_->WmSetBounds(
wm_change_id, wm_tree->ClientWindowIdForWindow(window).id,
- std::move(bounds));
+ std::move(bounds), local_frame_id);
return;
}
@@ -1355,7 +1369,7 @@ void WindowTree::SetWindowBounds(uint32_t change_id,
bool success = window && access_policy_->CanSetWindowBounds(window);
if (success) {
Operation op(this, window_server_, OperationType::SET_WINDOW_BOUNDS);
- window->SetBounds(bounds);
+ window->SetBounds(bounds, local_frame_id);
}
client()->OnChangeCompleted(change_id, success);
}
@@ -1898,7 +1912,9 @@ void WindowTree::WmResponse(uint32_t change_id, bool response) {
if (!response && window) {
// Our move loop didn't succeed, which means that we must restore the
// original bounds of the window.
- window->SetBounds(window_server_->GetCurrentMoveLoopRevertBounds());
+ // TODO(fsamuel): Figure out what to do here.
+ window->SetBounds(window_server_->GetCurrentMoveLoopRevertBounds(),
+ cc::LocalFrameId());
}
window_server_->EndMoveLoop();

Powered by Google App Engine
This is Rietveld 408576698