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

Side by Side Diff: services/ui/ws/display.cc

Issue 2582823002: WIP: Surface Synchronization System
Patch Set: Only create ClientSurfaceEmbedder if window is visible. Trash it otherwise. Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/ui/ws/display.h" 5 #include "services/ui/ws/display.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 window_manager_state->window_tree()->AddRootForWindowManager( 247 window_manager_state->window_tree()->AddRootForWindowManager(
248 display_root->root()); 248 display_root->root());
249 window_manager_state->AddWindowManagerDisplayRoot( 249 window_manager_state->AddWindowManagerDisplayRoot(
250 std::move(display_root_ptr)); 250 std::move(display_root_ptr));
251 } 251 }
252 252
253 void Display::CreateRootWindow(const gfx::Size& size) { 253 void Display::CreateRootWindow(const gfx::Size& size) {
254 DCHECK(!root_); 254 DCHECK(!root_);
255 255
256 root_.reset(window_server_->CreateServerWindow( 256 root_.reset(window_server_->CreateServerWindow(
257 display_manager()->GetAndAdvanceNextRootId(), 257 display_manager()->GetAndAdvanceNextRootId(), ServerWindow::Properties(),
258 ServerWindow::Properties())); 258 allocator_.GenerateId()));
259 root_->SetBounds(gfx::Rect(size)); 259 root_->SetBounds(gfx::Rect(size), allocator_.GenerateId());
260 root_->SetVisible(true); 260 root_->SetVisible(true);
261 focus_controller_ = base::MakeUnique<FocusController>(this, root_.get()); 261 focus_controller_ = base::MakeUnique<FocusController>(this, root_.get());
262 focus_controller_->AddObserver(this); 262 focus_controller_->AddObserver(this);
263 } 263 }
264 264
265 display::Display Display::GetDisplay() { 265 display::Display Display::GetDisplay() {
266 return ToDisplay(); 266 return ToDisplay();
267 } 267 }
268 268
269 ServerWindow* Display::GetRootWindow() { 269 ServerWindow* Display::GetRootWindow() {
(...skipping 24 matching lines...) Expand all
294 if (display_root) 294 if (display_root)
295 display_root->window_manager_state()->SetCapture(nullptr, kInvalidClientId); 295 display_root->window_manager_state()->SetCapture(nullptr, kInvalidClientId);
296 } 296 }
297 297
298 void Display::OnViewportMetricsChanged( 298 void Display::OnViewportMetricsChanged(
299 const display::ViewportMetrics& metrics) { 299 const display::ViewportMetrics& metrics) {
300 if (root_->bounds().size() == metrics.pixel_size) 300 if (root_->bounds().size() == metrics.pixel_size)
301 return; 301 return;
302 302
303 gfx::Rect new_bounds(metrics.pixel_size); 303 gfx::Rect new_bounds(metrics.pixel_size);
304 root_->SetBounds(new_bounds); 304 root_->SetBounds(new_bounds, allocator_.GenerateId());
305 for (auto& pair : window_manager_display_root_map_) 305 for (auto& pair : window_manager_display_root_map_)
306 pair.second->root()->SetBounds(new_bounds); 306 pair.second->root()->SetBounds(new_bounds, allocator_.GenerateId());
307 } 307 }
308 308
309 ServerWindow* Display::GetActiveRootWindow() { 309 ServerWindow* Display::GetActiveRootWindow() {
310 WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot(); 310 WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot();
311 if (display_root) 311 if (display_root)
312 return display_root->root(); 312 return display_root->root();
313 return nullptr; 313 return nullptr;
314 } 314 }
315 315
316 bool Display::CanHaveActiveChildren(ServerWindow* window) const { 316 bool Display::CanHaveActiveChildren(ServerWindow* window) const {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 391 }
392 392
393 void Display::OnWindowManagerWindowTreeFactoryReady( 393 void Display::OnWindowManagerWindowTreeFactoryReady(
394 WindowManagerWindowTreeFactory* factory) { 394 WindowManagerWindowTreeFactory* factory) {
395 if (!binding_) 395 if (!binding_)
396 CreateWindowManagerDisplayRootFromFactory(factory); 396 CreateWindowManagerDisplayRootFromFactory(factory);
397 } 397 }
398 398
399 } // namespace ws 399 } // namespace ws
400 } // namespace ui 400 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698