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

Side by Side Diff: components/mus/mus_app.cc

Issue 1769163002: Add a instance groups to Connect(), and introduce an Identity struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 9 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/profile_service/profile_app.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/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( 89 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion(
90 resource_loader.ReleaseFile(kResourceFileStrings), 90 resource_loader.ReleaseFile(kResourceFileStrings),
91 base::MemoryMappedFile::Region::kWholeFile); 91 base::MemoryMappedFile::Region::kWholeFile);
92 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( 92 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile(
93 resource_loader.ReleaseFile(kResourceFile100), ui::SCALE_FACTOR_100P); 93 resource_loader.ReleaseFile(kResourceFile100), ui::SCALE_FACTOR_100P);
94 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( 94 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile(
95 resource_loader.ReleaseFile(kResourceFile200), ui::SCALE_FACTOR_200P); 95 resource_loader.ReleaseFile(kResourceFile200), ui::SCALE_FACTOR_200P);
96 } 96 }
97 97
98 void MandolineUIServicesApp::Initialize(mojo::Connector* connector, 98 void MandolineUIServicesApp::Initialize(mojo::Connector* connector,
99 const std::string& url, 99 const mojo::Identity& identity,
100 const std::string& user_id,
101 uint32_t id) { 100 uint32_t id) {
102 connector_ = connector; 101 connector_ = connector;
103 surfaces_state_ = new SurfacesState; 102 surfaces_state_ = new SurfacesState;
104 103
105 base::PlatformThread::SetName("mus"); 104 base::PlatformThread::SetName("mus");
106 105
107 #if defined(USE_X11) 106 #if defined(USE_X11)
108 XInitThreads(); 107 XInitThreads();
109 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 108 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
110 if (command_line->HasSwitch(kUseX11TestConfig)) { 109 if (command_line->HasSwitch(kUseX11TestConfig)) {
(...skipping 17 matching lines...) Expand all
128 127
129 #if !defined(OS_ANDROID) 128 #if !defined(OS_ANDROID)
130 event_source_ = ui::PlatformEventSource::CreateDefault(); 129 event_source_ = ui::PlatformEventSource::CreateDefault();
131 #endif 130 #endif
132 131
133 // TODO(rjkroege): It is possible that we might want to generalize the 132 // TODO(rjkroege): It is possible that we might want to generalize the
134 // GpuState object. 133 // GpuState object.
135 gpu_state_ = new GpuState(); 134 gpu_state_ = new GpuState();
136 connection_manager_.reset(new ws::ConnectionManager(this, surfaces_state_)); 135 connection_manager_.reset(new ws::ConnectionManager(this, surfaces_state_));
137 136
138 tracing_.Initialize(connector, url); 137 tracing_.Initialize(connector, identity.name());
139 } 138 }
140 139
141 bool MandolineUIServicesApp::AcceptConnection(Connection* connection) { 140 bool MandolineUIServicesApp::AcceptConnection(Connection* connection) {
142 connection->AddInterface<Gpu>(this); 141 connection->AddInterface<Gpu>(this);
143 connection->AddInterface<mojom::DisplayManager>(this); 142 connection->AddInterface<mojom::DisplayManager>(this);
144 connection->AddInterface<mojom::WindowManagerFactoryService>(this); 143 connection->AddInterface<mojom::WindowManagerFactoryService>(this);
145 connection->AddInterface<mojom::WindowTreeFactory>(this); 144 connection->AddInterface<mojom::WindowTreeFactory>(this);
146 connection->AddInterface<WindowTreeHostFactory>(this); 145 connection->AddInterface<WindowTreeHostFactory>(this);
147 return true; 146 return true;
148 } 147 }
(...skipping 28 matching lines...) Expand all
177 // Display manages its own lifetime. 176 // Display manages its own lifetime.
178 ws::Display* host_impl = new ws::Display( 177 ws::Display* host_impl = new ws::Display(
179 connection_manager_.get(), connector_, gpu_state_, surfaces_state_); 178 connection_manager_.get(), connector_, gpu_state_, surfaces_state_);
180 host_impl->Init(nullptr); 179 host_impl->Init(nullptr);
181 } 180 }
182 181
183 void MandolineUIServicesApp::Create(mojo::Connection* connection, 182 void MandolineUIServicesApp::Create(mojo::Connection* connection,
184 mojom::DisplayManagerRequest request) { 183 mojom::DisplayManagerRequest request) {
185 // TODO(sky): validate id. 184 // TODO(sky): validate id.
186 connection_manager_->display_manager() 185 connection_manager_->display_manager()
187 ->GetUserDisplayManager(connection->GetRemoteUserID()) 186 ->GetUserDisplayManager(connection->GetRemoteIdentity().user_id())
188 ->AddDisplayManagerBinding(std::move(request)); 187 ->AddDisplayManagerBinding(std::move(request));
189 } 188 }
190 189
191 void MandolineUIServicesApp::Create( 190 void MandolineUIServicesApp::Create(
192 mojo::Connection* connection, 191 mojo::Connection* connection,
193 mojom::WindowManagerFactoryServiceRequest request) { 192 mojom::WindowManagerFactoryServiceRequest request) {
194 connection_manager_->window_manager_factory_registry()->Register( 193 connection_manager_->window_manager_factory_registry()->Register(
195 connection->GetRemoteUserID(), std::move(request)); 194 connection->GetRemoteIdentity().user_id(), std::move(request));
196 } 195 }
197 196
198 void MandolineUIServicesApp::Create(Connection* connection, 197 void MandolineUIServicesApp::Create(Connection* connection,
199 mojom::WindowTreeFactoryRequest request) { 198 mojom::WindowTreeFactoryRequest request) {
200 if (!connection_manager_->display_manager()->has_displays()) { 199 if (!connection_manager_->display_manager()->has_displays()) {
201 scoped_ptr<PendingRequest> pending_request(new PendingRequest); 200 scoped_ptr<PendingRequest> pending_request(new PendingRequest);
202 pending_request->wtf_request.reset( 201 pending_request->wtf_request.reset(
203 new mojo::InterfaceRequest<mojom::WindowTreeFactory>( 202 new mojo::InterfaceRequest<mojom::WindowTreeFactory>(
204 std::move(request))); 203 std::move(request)));
205 pending_requests_.push_back(std::move(pending_request)); 204 pending_requests_.push_back(std::move(pending_request));
(...skipping 28 matching lines...) Expand all
234 ws::Display* host_impl = new ws::Display( 233 ws::Display* host_impl = new ws::Display(
235 connection_manager_.get(), connector_, gpu_state_, surfaces_state_); 234 connection_manager_.get(), connector_, gpu_state_, surfaces_state_);
236 235
237 scoped_ptr<ws::DisplayBindingImpl> display_binding(new ws::DisplayBindingImpl( 236 scoped_ptr<ws::DisplayBindingImpl> display_binding(new ws::DisplayBindingImpl(
238 std::move(host), host_impl, std::move(tree_client), 237 std::move(host), host_impl, std::move(tree_client),
239 connection_manager_.get())); 238 connection_manager_.get()));
240 host_impl->Init(std::move(display_binding)); 239 host_impl->Init(std::move(display_binding));
241 } 240 }
242 241
243 } // namespace mus 242 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/mus_app.h ('k') | components/profile_service/profile_app.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698