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

Side by Side Diff: components/mus/mus_app.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/mus_app.h ('k') | components/mus/public/cpp/context_provider.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/mus_app.h" 5 #include "components/mus/mus_app.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/memory/ptr_util.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "base/threading/platform_thread.h" 13 #include "base/threading/platform_thread.h"
13 #include "build/build_config.h" 14 #include "build/build_config.h"
14 #include "components/mus/common/args.h" 15 #include "components/mus/common/args.h"
15 #include "components/mus/gles2/gpu_impl.h" 16 #include "components/mus/gles2/gpu_impl.h"
16 #include "components/mus/ws/display.h" 17 #include "components/mus/ws/display.h"
17 #include "components/mus/ws/display_binding.h" 18 #include "components/mus/ws/display_binding.h"
18 #include "components/mus/ws/display_manager.h" 19 #include "components/mus/ws/display_manager.h"
19 #include "components/mus/ws/user_display_manager.h" 20 #include "components/mus/ws/user_display_manager.h"
20 #include "components/mus/ws/window_server.h" 21 #include "components/mus/ws/window_server.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 56
56 const char kResourceFileStrings[] = "mus_app_resources_strings.pak"; 57 const char kResourceFileStrings[] = "mus_app_resources_strings.pak";
57 const char kResourceFile100[] = "mus_app_resources_100.pak"; 58 const char kResourceFile100[] = "mus_app_resources_100.pak";
58 const char kResourceFile200[] = "mus_app_resources_200.pak"; 59 const char kResourceFile200[] = "mus_app_resources_200.pak";
59 60
60 } // namespace 61 } // namespace
61 62
62 // TODO(sky): this is a pretty typical pattern, make it easier to do. 63 // TODO(sky): this is a pretty typical pattern, make it easier to do.
63 struct MandolineUIServicesApp::PendingRequest { 64 struct MandolineUIServicesApp::PendingRequest {
64 shell::Connection* connection; 65 shell::Connection* connection;
65 scoped_ptr<mojo::InterfaceRequest<mojom::WindowTreeFactory>> wtf_request; 66 std::unique_ptr<mojo::InterfaceRequest<mojom::WindowTreeFactory>> wtf_request;
66 }; 67 };
67 68
68 struct MandolineUIServicesApp::UserState { 69 struct MandolineUIServicesApp::UserState {
69 scoped_ptr<ws::WindowTreeHostFactory> window_tree_host_factory; 70 std::unique_ptr<ws::WindowTreeHostFactory> window_tree_host_factory;
70 }; 71 };
71 72
72 MandolineUIServicesApp::MandolineUIServicesApp() : test_config_(false) {} 73 MandolineUIServicesApp::MandolineUIServicesApp() : test_config_(false) {}
73 74
74 MandolineUIServicesApp::~MandolineUIServicesApp() { 75 MandolineUIServicesApp::~MandolineUIServicesApp() {
75 // Destroy |window_server_| first, since it depends on |event_source_|. 76 // Destroy |window_server_| first, since it depends on |event_source_|.
76 // WindowServer (or more correctly its Displays) may have state that needs to 77 // WindowServer (or more correctly its Displays) may have state that needs to
77 // be destroyed before GpuState as well. 78 // be destroyed before GpuState as well.
78 window_server_.reset(); 79 window_server_.reset();
79 80
(...skipping 25 matching lines...) Expand all
105 rb.AddDataPackFromFile(loader.ReleaseFile(kResourceFile200), 106 rb.AddDataPackFromFile(loader.ReleaseFile(kResourceFile200),
106 ui::SCALE_FACTOR_200P); 107 ui::SCALE_FACTOR_200P);
107 } 108 }
108 109
109 MandolineUIServicesApp::UserState* MandolineUIServicesApp::GetUserState( 110 MandolineUIServicesApp::UserState* MandolineUIServicesApp::GetUserState(
110 shell::Connection* connection) { 111 shell::Connection* connection) {
111 const ws::UserId& user_id = connection->GetRemoteIdentity().user_id(); 112 const ws::UserId& user_id = connection->GetRemoteIdentity().user_id();
112 auto it = user_id_to_user_state_.find(user_id); 113 auto it = user_id_to_user_state_.find(user_id);
113 if (it != user_id_to_user_state_.end()) 114 if (it != user_id_to_user_state_.end())
114 return it->second.get(); 115 return it->second.get();
115 user_id_to_user_state_[user_id] = make_scoped_ptr(new UserState); 116 user_id_to_user_state_[user_id] = base::WrapUnique(new UserState);
116 return user_id_to_user_state_[user_id].get(); 117 return user_id_to_user_state_[user_id].get();
117 } 118 }
118 119
119 void MandolineUIServicesApp::AddUserIfNecessary(shell::Connection* connection) { 120 void MandolineUIServicesApp::AddUserIfNecessary(shell::Connection* connection) {
120 window_server_->user_id_tracker()->AddUserId( 121 window_server_->user_id_tracker()->AddUserId(
121 connection->GetRemoteIdentity().user_id()); 122 connection->GetRemoteIdentity().user_id());
122 } 123 }
123 124
124 void MandolineUIServicesApp::Initialize(shell::Connector* connector, 125 void MandolineUIServicesApp::Initialize(shell::Connector* connector,
125 const shell::Identity& identity, 126 const shell::Identity& identity,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 mojom::WindowManagerFactoryServiceRequest request) { 227 mojom::WindowManagerFactoryServiceRequest request) {
227 AddUserIfNecessary(connection); 228 AddUserIfNecessary(connection);
228 window_server_->window_manager_factory_registry()->Register( 229 window_server_->window_manager_factory_registry()->Register(
229 connection->GetRemoteIdentity().user_id(), std::move(request)); 230 connection->GetRemoteIdentity().user_id(), std::move(request));
230 } 231 }
231 232
232 void MandolineUIServicesApp::Create(Connection* connection, 233 void MandolineUIServicesApp::Create(Connection* connection,
233 mojom::WindowTreeFactoryRequest request) { 234 mojom::WindowTreeFactoryRequest request) {
234 AddUserIfNecessary(connection); 235 AddUserIfNecessary(connection);
235 if (!window_server_->display_manager()->has_displays()) { 236 if (!window_server_->display_manager()->has_displays()) {
236 scoped_ptr<PendingRequest> pending_request(new PendingRequest); 237 std::unique_ptr<PendingRequest> pending_request(new PendingRequest);
237 pending_request->connection = connection; 238 pending_request->connection = connection;
238 pending_request->wtf_request.reset( 239 pending_request->wtf_request.reset(
239 new mojo::InterfaceRequest<mojom::WindowTreeFactory>( 240 new mojo::InterfaceRequest<mojom::WindowTreeFactory>(
240 std::move(request))); 241 std::move(request)));
241 pending_requests_.push_back(std::move(pending_request)); 242 pending_requests_.push_back(std::move(pending_request));
242 return; 243 return;
243 } 244 }
244 AddUserIfNecessary(connection); 245 AddUserIfNecessary(connection);
245 new ws::WindowTreeFactory( 246 new ws::WindowTreeFactory(
246 window_server_.get(), connection->GetRemoteIdentity().user_id(), 247 window_server_.get(), connection->GetRemoteIdentity().user_id(),
(...skipping 19 matching lines...) Expand all
266 new ws::WindowServerTestImpl(window_server_.get(), std::move(request)); 267 new ws::WindowServerTestImpl(window_server_.get(), std::move(request));
267 } 268 }
268 269
269 void MandolineUIServicesApp::Create(shell::Connection* connection, 270 void MandolineUIServicesApp::Create(shell::Connection* connection,
270 mojom::GpuRequest request) { 271 mojom::GpuRequest request) {
271 DCHECK(platform_display_init_params_.gpu_state); 272 DCHECK(platform_display_init_params_.gpu_state);
272 new GpuImpl(std::move(request), platform_display_init_params_.gpu_state); 273 new GpuImpl(std::move(request), platform_display_init_params_.gpu_state);
273 } 274 }
274 275
275 } // namespace mus 276 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/mus_app.h ('k') | components/mus/public/cpp/context_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698