Commit 4a224e7b authored by Ria Jiang's avatar Ria Jiang Committed by Commit Bot

Remove WindowId.ToClientWindowId in WS.

Based on discussions in
https://chromium-review.googlesource.com/c/chromium/src/+/639954,
WindowId.ToClientWindowId is confusing as it implies mapping but we are
only using it to change the data type from WindowId to ClientWindowId.
Remove it and update call sites.

Bug: none
Test: covered by tests
Change-Id: I69bea9c002991955cee0426f85ebbdeca4cfbd09
Reviewed-on: https://chromium-review.googlesource.com/671106Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Ria Jiang <riajiang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#502755}
parent 3eba8015
...@@ -261,7 +261,8 @@ void Display::CreateRootWindow(const gfx::Size& size) { ...@@ -261,7 +261,8 @@ void Display::CreateRootWindow(const gfx::Size& size) {
DCHECK(!root_); DCHECK(!root_);
WindowId id = display_manager()->GetAndAdvanceNextRootId(); WindowId id = display_manager()->GetAndAdvanceNextRootId();
root_.reset(window_server_->CreateServerWindow(id, id.ToClientWindowId(), ClientWindowId client_window_id(id.client_id, id.window_id);
root_.reset(window_server_->CreateServerWindow(id, client_window_id,
ServerWindow::Properties())); ServerWindow::Properties()));
root_->set_event_targeting_policy( root_->set_event_targeting_policy(
mojom::EventTargetingPolicy::DESCENDANTS_ONLY); mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
......
...@@ -63,10 +63,6 @@ struct WindowId { ...@@ -63,10 +63,6 @@ struct WindowId {
std::tie(other.client_id, other.window_id); std::tie(other.client_id, other.window_id);
} }
ClientWindowId ToClientWindowId() const {
return ClientWindowId(client_id, window_id);
}
std::string ToString() const { std::string ToString() const {
return base::StringPrintf("%u:%u", client_id, window_id); return base::StringPrintf("%u:%u", client_id, window_id);
} }
......
...@@ -21,7 +21,10 @@ namespace ui { ...@@ -21,7 +21,10 @@ namespace ui {
namespace ws { namespace ws {
ServerWindow::ServerWindow(ServerWindowDelegate* delegate, const WindowId& id) ServerWindow::ServerWindow(ServerWindowDelegate* delegate, const WindowId& id)
: ServerWindow(delegate, id, id.ToClientWindowId(), Properties()) {} : ServerWindow(delegate,
id,
viz::FrameSinkId(id.client_id, id.window_id),
Properties()) {}
ServerWindow::ServerWindow(ServerWindowDelegate* delegate, ServerWindow::ServerWindow(ServerWindowDelegate* delegate,
const WindowId& id, const WindowId& id,
......
...@@ -26,8 +26,9 @@ WindowManagerDisplayRoot::WindowManagerDisplayRoot(Display* display) ...@@ -26,8 +26,9 @@ WindowManagerDisplayRoot::WindowManagerDisplayRoot(Display* display)
std::vector<uint8_t>(name.begin(), name.end()); std::vector<uint8_t>(name.begin(), name.end());
WindowId id = window_server()->display_manager()->GetAndAdvanceNextRootId(); WindowId id = window_server()->display_manager()->GetAndAdvanceNextRootId();
root_.reset(window_server()->CreateServerWindow(id, id.ToClientWindowId(), ClientWindowId client_window_id(id.client_id, id.window_id);
properties)); root_.reset(
window_server()->CreateServerWindow(id, client_window_id, properties));
root_->set_event_targeting_policy( root_->set_event_targeting_policy(
mojom::EventTargetingPolicy::DESCENDANTS_ONLY); mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
// Our root is always a child of the Display's root. Do this // Our root is always a child of the Display's root. Do this
......
...@@ -579,7 +579,9 @@ TEST_F(WindowManagerStateTest, InterceptingEmbedderReceivesEvents) { ...@@ -579,7 +579,9 @@ TEST_F(WindowManagerStateTest, InterceptingEmbedderReceivesEvents) {
embedder_tree->NewWindow(embed_window_id, ServerWindow::Properties()); embedder_tree->NewWindow(embed_window_id, ServerWindow::Properties());
ServerWindow* embedder_window = ServerWindow* embedder_window =
embedder_tree->GetWindowByClientId(embed_window_id); embedder_tree->GetWindowByClientId(embed_window_id);
ASSERT_TRUE(embedder_tree->AddWindow(embedder_root->id().ToClientWindowId(), ASSERT_TRUE(
embedder_tree->AddWindow(ClientWindowId(embedder_root->id().client_id,
embedder_root->id().window_id),
embed_window_id)); embed_window_id));
TestWindowTreeClient* embedder_client = wm_client(); TestWindowTreeClient* embedder_client = wm_client();
...@@ -639,9 +641,11 @@ TEST_F(WindowManagerStateTest, InterceptingEmbedderReceivesEvents) { ...@@ -639,9 +641,11 @@ TEST_F(WindowManagerStateTest, InterceptingEmbedderReceivesEvents) {
// Embed another tree in the embedded tree. // Embed another tree in the embedded tree.
const ClientWindowId nested_embed_window_id(embed_tree->id(), 23); const ClientWindowId nested_embed_window_id(embed_tree->id(), 23);
embed_tree->NewWindow(nested_embed_window_id, ServerWindow::Properties()); embed_tree->NewWindow(nested_embed_window_id, ServerWindow::Properties());
const ClientWindowId embed_root_id = const WindowId embed_root_window_id = (*embed_tree->roots().begin())->id();
(*embed_tree->roots().begin())->id().ToClientWindowId(); const ClientWindowId embed_root_client_window_id(
ASSERT_TRUE(embed_tree->AddWindow(embed_root_id, nested_embed_window_id)); embed_root_window_id.client_id, embed_root_window_id.window_id);
ASSERT_TRUE(embed_tree->AddWindow(embed_root_client_window_id,
nested_embed_window_id));
WindowTree* nested_embed_tree = nullptr; WindowTree* nested_embed_tree = nullptr;
TestWindowTreeClient* nested_embed_client_proxy = nullptr; TestWindowTreeClient* nested_embed_client_proxy = nullptr;
......
...@@ -850,20 +850,21 @@ TEST_F(WindowTreeTest, ExplicitSetCapture) { ...@@ -850,20 +850,21 @@ TEST_F(WindowTreeTest, ExplicitSetCapture) {
mojom::WindowTree* mojom_window_tree = static_cast<mojom::WindowTree*>(tree); mojom::WindowTree* mojom_window_tree = static_cast<mojom::WindowTree*>(tree);
uint32_t change_id = 42; uint32_t change_id = 42;
mojom_window_tree->SetCapture( mojom_window_tree->SetCapture(
change_id, change_id, tree->ClientWindowIdToTransportId(ClientWindowId(
tree->ClientWindowIdToTransportId(window->id().ToClientWindowId())); window->id().client_id, window->id().window_id)));
Display* display = tree->GetDisplay(window); Display* display = tree->GetDisplay(window);
EXPECT_EQ(window, GetCaptureWindow(display)); EXPECT_EQ(window, GetCaptureWindow(display));
// Only the capture window should be able to release capture // Only the capture window should be able to release capture
mojom_window_tree->ReleaseCapture( mojom_window_tree->ReleaseCapture(
++change_id, ++change_id,
tree->ClientWindowIdToTransportId(root_window->id().ToClientWindowId())); tree->ClientWindowIdToTransportId(ClientWindowId(
root_window->id().client_id, root_window->id().window_id)));
EXPECT_EQ(window, GetCaptureWindow(display)); EXPECT_EQ(window, GetCaptureWindow(display));
mojom_window_tree->ReleaseCapture( mojom_window_tree->ReleaseCapture(
++change_id, ++change_id, tree->ClientWindowIdToTransportId(ClientWindowId(
tree->ClientWindowIdToTransportId(window->id().ToClientWindowId())); window->id().client_id, window->id().window_id)));
EXPECT_EQ(nullptr, GetCaptureWindow(display)); EXPECT_EQ(nullptr, GetCaptureWindow(display));
} }
...@@ -1199,8 +1200,8 @@ TEST_F(WindowTreeTest, SetOpacityFailsOnUnknownWindow) { ...@@ -1199,8 +1200,8 @@ TEST_F(WindowTreeTest, SetOpacityFailsOnUnknownWindow) {
const float new_opacity = 0.5f; const float new_opacity = 0.5f;
ASSERT_NE(new_opacity, unknown_window.opacity()); ASSERT_NE(new_opacity, unknown_window.opacity());
EXPECT_FALSE( EXPECT_FALSE(tree->SetWindowOpacity(
tree->SetWindowOpacity(window_id.ToClientWindowId(), new_opacity)); ClientWindowId(window_id.client_id, window_id.window_id), new_opacity));
EXPECT_NE(new_opacity, unknown_window.opacity()); EXPECT_NE(new_opacity, unknown_window.opacity());
} }
......
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