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

Side by Side Diff: components/mus/ws/display_manager.cc

Issue 1906623003: Convert //components/mus from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « components/mus/ws/display_manager.h ('k') | components/mus/ws/display_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/mus/ws/display_manager.h" 5 #include "components/mus/ws/display_manager.h"
6 6
7 #include "base/memory/ptr_util.h"
7 #include "components/mus/ws/display.h" 8 #include "components/mus/ws/display.h"
8 #include "components/mus/ws/display_manager_delegate.h" 9 #include "components/mus/ws/display_manager_delegate.h"
9 #include "components/mus/ws/server_window.h" 10 #include "components/mus/ws/server_window.h"
10 #include "components/mus/ws/user_display_manager.h" 11 #include "components/mus/ws/user_display_manager.h"
11 12
12 namespace mus { 13 namespace mus {
13 namespace ws { 14 namespace ws {
14 15
15 DisplayManager::DisplayManager(DisplayManagerDelegate* delegate) 16 DisplayManager::DisplayManager(DisplayManagerDelegate* delegate)
16 // |next_root_id_| is used as the lower bits, so that starting at 0 is 17 // |next_root_id_| is used as the lower bits, so that starting at 0 is
17 // fine. |next_display_id_| is used by itself, so we start at 1 to reserve 18 // fine. |next_display_id_| is used by itself, so we start at 1 to reserve
18 // 0 as invalid. 19 // 0 as invalid.
19 : delegate_(delegate), 20 : delegate_(delegate),
20 next_root_id_(0), 21 next_root_id_(0),
21 next_display_id_(1) {} 22 next_display_id_(1) {}
22 23
23 DisplayManager::~DisplayManager() { 24 DisplayManager::~DisplayManager() {
24 DestroyAllDisplays(); 25 DestroyAllDisplays();
25 } 26 }
26 27
27 UserDisplayManager* DisplayManager::GetUserDisplayManager( 28 UserDisplayManager* DisplayManager::GetUserDisplayManager(
28 const UserId& user_id) { 29 const UserId& user_id) {
29 if (!user_display_managers_.count(user_id)) { 30 if (!user_display_managers_.count(user_id)) {
30 user_display_managers_[user_id] = 31 user_display_managers_[user_id] =
31 make_scoped_ptr(new UserDisplayManager(this, user_id)); 32 base::WrapUnique(new UserDisplayManager(this, user_id));
32 } 33 }
33 return user_display_managers_[user_id].get(); 34 return user_display_managers_[user_id].get();
34 } 35 }
35 36
36 void DisplayManager::AddDisplay(Display* display) { 37 void DisplayManager::AddDisplay(Display* display) {
37 DCHECK_EQ(0u, pending_displays_.count(display)); 38 DCHECK_EQ(0u, pending_displays_.count(display));
38 pending_displays_.insert(display); 39 pending_displays_.insert(display);
39 } 40 }
40 41
41 void DisplayManager::DestroyDisplay(Display* display) { 42 void DisplayManager::DestroyDisplay(Display* display) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 DCHECK_EQ(0u, displays_.count(display)); 138 DCHECK_EQ(0u, displays_.count(display));
138 const bool is_first_display = displays_.empty(); 139 const bool is_first_display = displays_.empty();
139 displays_.insert(display); 140 displays_.insert(display);
140 pending_displays_.erase(display); 141 pending_displays_.erase(display);
141 if (is_first_display) 142 if (is_first_display)
142 delegate_->OnFirstDisplayReady(); 143 delegate_->OnFirstDisplayReady();
143 } 144 }
144 145
145 } // namespace ws 146 } // namespace ws
146 } // namespace mus 147 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/display_manager.h ('k') | components/mus/ws/display_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698