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

Side by Side Diff: mojo/aura/surface_binding.cc

Issue 668483002: Change mojo URLs from mojo://mojo_foo to mojo://foo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 2 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
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 "mojo/aura/surface_binding.h" 5 #include "mojo/aura/surface_binding.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 if (view_map->empty()) { 198 if (view_map->empty()) {
199 delete view_map; 199 delete view_map;
200 view_states.Pointer()->Set(nullptr); 200 view_states.Pointer()->Set(nullptr);
201 } 201 }
202 } 202 }
203 203
204 void SurfaceBinding::PerViewManagerState::Init() { 204 void SurfaceBinding::PerViewManagerState::Init() {
205 DCHECK(!surfaces_service_.get()); 205 DCHECK(!surfaces_service_.get());
206 206
207 ServiceProviderPtr surfaces_service_provider; 207 ServiceProviderPtr surfaces_service_provider;
208 shell_->ConnectToApplication("mojo:mojo_surfaces_service", 208 shell_->ConnectToApplication("mojo:surfaces_service",
209 GetProxy(&surfaces_service_provider)); 209 GetProxy(&surfaces_service_provider));
210 ConnectToService(surfaces_service_provider.get(), &surfaces_service_); 210 ConnectToService(surfaces_service_provider.get(), &surfaces_service_);
211 // base::Unretained is ok here as we block until the call is received. 211 // base::Unretained is ok here as we block until the call is received.
212 surfaces_service_->CreateSurfaceConnection( 212 surfaces_service_->CreateSurfaceConnection(
213 base::Bind(&PerViewManagerState::OnCreatedSurfaceConnection, 213 base::Bind(&PerViewManagerState::OnCreatedSurfaceConnection,
214 base::Unretained(this))); 214 base::Unretained(this)));
215 // Block until we get the surface. This is done to make it easy for client 215 // Block until we get the surface. This is done to make it easy for client
216 // code. OTOH blocking is ick and leads to all sorts of problems. 216 // code. OTOH blocking is ick and leads to all sorts of problems.
217 // TODO(sky): ick! There needs to be a better way to deal with this. 217 // TODO(sky): ick! There needs to be a better way to deal with this.
218 surfaces_service_.WaitForIncomingMethodCall(); 218 surfaces_service_.WaitForIncomingMethodCall();
219 DCHECK(surface_.get()); 219 DCHECK(surface_.get());
220 surface_client_.reset(new SurfaceClientImpl); 220 surface_client_.reset(new SurfaceClientImpl);
221 surface_.set_client(surface_client_.get()); 221 surface_.set_client(surface_client_.get());
222 222
223 ServiceProviderPtr gpu_service_provider; 223 ServiceProviderPtr gpu_service_provider;
224 // TODO(jamesr): Should be mojo:mojo_gpu_service 224 // TODO(jamesr): Should be mojo:gpu_service
225 shell_->ConnectToApplication("mojo:mojo_native_viewport_service", 225 shell_->ConnectToApplication("mojo:native_viewport_service",
226 GetProxy(&gpu_service_provider)); 226 GetProxy(&gpu_service_provider));
227 ConnectToService(gpu_service_provider.get(), &gpu_); 227 ConnectToService(gpu_service_provider.get(), &gpu_);
228 } 228 }
229 229
230 void SurfaceBinding::PerViewManagerState::OnCreatedSurfaceConnection( 230 void SurfaceBinding::PerViewManagerState::OnCreatedSurfaceConnection(
231 SurfacePtr surface, 231 SurfacePtr surface,
232 uint32_t id_namespace) { 232 uint32_t id_namespace) {
233 surface_id_allocator_.reset(new cc::SurfaceIdAllocator(id_namespace)); 233 surface_id_allocator_.reset(new cc::SurfaceIdAllocator(id_namespace));
234 surface_ = surface.Pass(); 234 surface_ = surface.Pass();
235 } 235 }
236 236
237 // SurfaceBinding -------------------------------------------------------------- 237 // SurfaceBinding --------------------------------------------------------------
238 238
239 SurfaceBinding::SurfaceBinding(Shell* shell, View* view) 239 SurfaceBinding::SurfaceBinding(Shell* shell, View* view)
240 : view_(view), 240 : view_(view),
241 state_(PerViewManagerState::Get(shell, view->view_manager())) { 241 state_(PerViewManagerState::Get(shell, view->view_manager())) {
242 } 242 }
243 243
244 SurfaceBinding::~SurfaceBinding() { 244 SurfaceBinding::~SurfaceBinding() {
245 } 245 }
246 246
247 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() { 247 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() {
248 return state_->CreateOutputSurface(view_); 248 return state_->CreateOutputSurface(view_);
249 } 249 }
250 250
251 } // namespace mojo 251 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698