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

Side by Side Diff: services/ui/service.cc

Issue 2179023004: Make Service own ServiceContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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 | « services/ui/service.h ('k') | services/ui/test_wm/test_wm.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 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 "services/ui/service.h" 5 #include "services/ui/service.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"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 if (it != user_id_to_user_state_.end()) 136 if (it != user_id_to_user_state_.end())
137 return it->second.get(); 137 return it->second.get();
138 user_id_to_user_state_[user_id] = base::WrapUnique(new UserState); 138 user_id_to_user_state_[user_id] = base::WrapUnique(new UserState);
139 return user_id_to_user_state_[user_id].get(); 139 return user_id_to_user_state_[user_id].get();
140 } 140 }
141 141
142 void Service::AddUserIfNecessary(const shell::Identity& remote_identity) { 142 void Service::AddUserIfNecessary(const shell::Identity& remote_identity) {
143 window_server_->user_id_tracker()->AddUserId(remote_identity.user_id()); 143 window_server_->user_id_tracker()->AddUserId(remote_identity.user_id());
144 } 144 }
145 145
146 void Service::OnStart(shell::Connector* connector, 146 void Service::OnStart(const shell::Identity& identity) {
147 const shell::Identity& identity,
148 uint32_t id) {
149 platform_display_init_params_.surfaces_state = new SurfacesState; 147 platform_display_init_params_.surfaces_state = new SurfacesState;
150 148
151 base::PlatformThread::SetName("mus"); 149 base::PlatformThread::SetName("mus");
152 tracing_.Initialize(connector, identity.name()); 150 tracing_.Initialize(connector(), identity.name());
153 TRACE_EVENT0("mus", "Service::Initialize started"); 151 TRACE_EVENT0("mus", "Service::Initialize started");
154 152
155 test_config_ = base::CommandLine::ForCurrentProcess()->HasSwitch( 153 test_config_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
156 switches::kUseTestConfig); 154 switches::kUseTestConfig);
157 // TODO(penghuang): Kludge: use mojo command buffer when running on Windows 155 // TODO(penghuang): Kludge: use mojo command buffer when running on Windows
158 // since Chrome command buffer breaks unit tests 156 // since Chrome command buffer breaks unit tests
159 #if defined(OS_WIN) 157 #if defined(OS_WIN)
160 use_chrome_gpu_command_buffer_ = false; 158 use_chrome_gpu_command_buffer_ = false;
161 #else 159 #else
162 use_chrome_gpu_command_buffer_ = 160 use_chrome_gpu_command_buffer_ =
163 !base::CommandLine::ForCurrentProcess()->HasSwitch( 161 !base::CommandLine::ForCurrentProcess()->HasSwitch(
164 switches::kUseMojoGpuCommandBufferInMus); 162 switches::kUseMojoGpuCommandBufferInMus);
165 #endif 163 #endif
166 #if defined(USE_X11) 164 #if defined(USE_X11)
167 XInitThreads(); 165 XInitThreads();
168 if (test_config_) 166 if (test_config_)
169 ui::test::SetUseOverrideRedirectWindowByDefault(true); 167 ui::test::SetUseOverrideRedirectWindowByDefault(true);
170 #endif 168 #endif
171 169
172 InitializeResources(connector); 170 InitializeResources(connector());
173 171
174 #if defined(USE_OZONE) 172 #if defined(USE_OZONE)
175 // The ozone platform can provide its own event source. So initialize the 173 // The ozone platform can provide its own event source. So initialize the
176 // platform before creating the default event source. 174 // platform before creating the default event source.
177 // Because GL libraries need to be initialized before entering the sandbox, 175 // Because GL libraries need to be initialized before entering the sandbox,
178 // in MUS, |InitializeForUI| will load the GL libraries. 176 // in MUS, |InitializeForUI| will load the GL libraries.
179 ui::OzonePlatform::InitParams params; 177 ui::OzonePlatform::InitParams params;
180 params.connector = connector; 178 params.connector = connector();
181 params.single_process = false; 179 params.single_process = false;
182 180
183 ui::OzonePlatform::InitializeForUI(params); 181 ui::OzonePlatform::InitializeForUI(params);
184 182
185 // TODO(kylechar): We might not always want a US keyboard layout. 183 // TODO(kylechar): We might not always want a US keyboard layout.
186 ui::KeyboardLayoutEngineManager::GetKeyboardLayoutEngine() 184 ui::KeyboardLayoutEngineManager::GetKeyboardLayoutEngine()
187 ->SetCurrentLayoutByName("us"); 185 ->SetCurrentLayoutByName("us");
188 client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create(); 186 client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create();
189 ui::ClientNativePixmapFactory::SetInstance( 187 ui::ClientNativePixmapFactory::SetInstance(
190 client_native_pixmap_factory_.get()); 188 client_native_pixmap_factory_.get());
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 // Display manages its own lifetime. 389 // Display manages its own lifetime.
392 ws::Display* host_impl = 390 ws::Display* host_impl =
393 new ws::Display(window_server_.get(), platform_display_init_params_); 391 new ws::Display(window_server_.get(), platform_display_init_params_);
394 host_impl->Init(nullptr); 392 host_impl->Init(nullptr);
395 393
396 if (touch_controller_) 394 if (touch_controller_)
397 touch_controller_->UpdateTouchTransforms(); 395 touch_controller_->UpdateTouchTransforms();
398 } 396 }
399 397
400 } // namespace ui 398 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/service.h ('k') | services/ui/test_wm/test_wm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698