OLD | NEW |
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 if (!binding_) { | 51 if (!binding_) { |
52 for (auto& pair : window_manager_display_root_map_) | 52 for (auto& pair : window_manager_display_root_map_) |
53 pair.second->window_manager_state()->OnDisplayDestroying(this); | 53 pair.second->window_manager_state()->OnDisplayDestroying(this); |
54 } else if (!window_manager_display_root_map_.empty()) { | 54 } else if (!window_manager_display_root_map_.empty()) { |
55 // If there is a |binding_| then the tree was created specifically for this | 55 // If there is a |binding_| then the tree was created specifically for this |
56 // display (which corresponds to a WindowTreeHost). | 56 // display (which corresponds to a WindowTreeHost). |
57 window_server_->DestroyTree(window_manager_display_root_map_.begin() | 57 window_server_->DestroyTree(window_manager_display_root_map_.begin() |
58 ->second->window_manager_state() | 58 ->second->window_manager_state() |
59 ->window_tree()); | 59 ->window_tree()); |
60 } | 60 } |
| 61 |
| 62 if (platform_display_) |
| 63 window_server_->RemovePlatformDisplay(platform_display_); |
61 } | 64 } |
62 | 65 |
63 void Display::Init(const PlatformDisplayInitParams& init_params, | 66 void Display::Init(const PlatformDisplayInitParams& init_params, |
64 std::unique_ptr<DisplayBinding> binding) { | 67 std::unique_ptr<DisplayBinding> binding) { |
65 binding_ = std::move(binding); | 68 binding_ = std::move(binding); |
66 display_manager()->AddDisplay(this); | 69 display_manager()->AddDisplay(this); |
67 | 70 |
68 CreateRootWindow(init_params.metrics.pixel_size); | 71 CreateRootWindow(init_params.metrics.pixel_size); |
69 PlatformDisplayInitParams params_copy = init_params; | 72 PlatformDisplayInitParams params_copy = init_params; |
70 params_copy.root_window = root_.get(); | 73 params_copy.root_window = root_.get(); |
71 | 74 |
72 platform_display_ = PlatformDisplay::Create(params_copy); | 75 std::unique_ptr<PlatformDisplay> platform_display = |
| 76 PlatformDisplay::Create(params_copy); |
| 77 platform_display_ = platform_display.get(); |
73 platform_display_->Init(this); | 78 platform_display_->Init(this); |
| 79 window_server_->AddPlatformDisplay(std::move(platform_display)); |
74 } | 80 } |
75 | 81 |
76 int64_t Display::GetId() const { | 82 int64_t Display::GetId() const { |
77 return platform_display_->GetId(); | 83 return platform_display_->GetId(); |
78 } | 84 } |
79 | 85 |
80 DisplayManager* Display::display_manager() { | 86 DisplayManager* Display::display_manager() { |
81 return window_server_->display_manager(); | 87 return window_server_->display_manager(); |
82 } | 88 } |
83 | 89 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 } | 399 } |
394 | 400 |
395 void Display::OnWindowManagerWindowTreeFactoryReady( | 401 void Display::OnWindowManagerWindowTreeFactoryReady( |
396 WindowManagerWindowTreeFactory* factory) { | 402 WindowManagerWindowTreeFactory* factory) { |
397 if (!binding_) | 403 if (!binding_) |
398 CreateWindowManagerDisplayRootFromFactory(factory); | 404 CreateWindowManagerDisplayRootFromFactory(factory); |
399 } | 405 } |
400 | 406 |
401 } // namespace ws | 407 } // namespace ws |
402 } // namespace ui | 408 } // namespace ui |
OLD | NEW |