Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "mandoline/ui/aura/surface_binding.h" | 5 #include "mandoline/ui/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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 void SwapBuffers(cc::CompositorFrame* frame) override; | 45 void SwapBuffers(cc::CompositorFrame* frame) override; |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 mojo::View* view_; | 48 mojo::View* view_; |
| 49 mojo::Surface* surface_; | 49 mojo::Surface* surface_; |
| 50 uint32_t id_namespace_; | 50 uint32_t id_namespace_; |
| 51 uint32_t* next_local_id_; // Owned by PerViewManagerState. | 51 uint32_t* next_local_id_; // Owned by PerViewManagerState. |
| 52 uint32_t local_id_; | 52 uint32_t local_id_; |
| 53 gfx::Size surface_size_; | 53 gfx::Size surface_size_; |
| 54 | 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(OutputSurfaceImpl); | |
|
rjkroege
2015/08/06 00:16:22
why did you remove? maybe not a good idea?
Fady Samuel
2015/08/06 16:48:24
accident. Restored.
| |
| 56 }; | 55 }; |
| 57 | 56 |
| 58 OutputSurfaceImpl::OutputSurfaceImpl( | 57 OutputSurfaceImpl::OutputSurfaceImpl( |
| 59 mojo::View* view, | 58 mojo::View* view, |
| 60 const scoped_refptr<cc::ContextProvider>& context_provider, | 59 const scoped_refptr<cc::ContextProvider>& context_provider, |
| 61 mojo::Surface* surface, | 60 mojo::Surface* surface, |
| 62 uint32_t id_namespace, | 61 uint32_t id_namespace, |
| 63 uint32_t* next_local_id) | 62 uint32_t* next_local_id) |
| 64 : cc::OutputSurface(context_provider), | 63 : cc::OutputSurface(context_provider), |
| 65 view_(view), | 64 view_(view), |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 delete view_map; | 197 delete view_map; |
| 199 view_states.Pointer()->Set(nullptr); | 198 view_states.Pointer()->Set(nullptr); |
| 200 } | 199 } |
| 201 } | 200 } |
| 202 | 201 |
| 203 void SurfaceBinding::PerViewManagerState::Init() { | 202 void SurfaceBinding::PerViewManagerState::Init() { |
| 204 DCHECK(!surface_.get()); | 203 DCHECK(!surface_.get()); |
| 205 | 204 |
| 206 mojo::ServiceProviderPtr surfaces_service_provider; | 205 mojo::ServiceProviderPtr surfaces_service_provider; |
| 207 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 206 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 208 request->url = mojo::String::From("mojo:surfaces_service"); | 207 request->url = mojo::String::From("mojo:view_manager"); |
| 209 shell_->ConnectToApplication(request.Pass(), | 208 shell_->ConnectToApplication(request.Pass(), |
| 210 GetProxy(&surfaces_service_provider), | 209 GetProxy(&surfaces_service_provider), |
| 211 nullptr, | 210 nullptr, |
| 212 nullptr); | 211 nullptr); |
| 213 ConnectToService(surfaces_service_provider.get(), &surface_); | 212 ConnectToService(surfaces_service_provider.get(), &surface_); |
| 214 surface_->GetIdNamespace( | 213 surface_->GetIdNamespace( |
| 215 base::Bind(&SurfaceBinding::PerViewManagerState::SetIdNamespace, | 214 base::Bind(&SurfaceBinding::PerViewManagerState::SetIdNamespace, |
| 216 base::Unretained(this))); | 215 base::Unretained(this))); |
| 217 // Block until we receive our id namespace. | 216 // Block until we receive our id namespace. |
| 218 surface_.WaitForIncomingResponse(); | 217 surface_.WaitForIncomingResponse(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 } | 249 } |
| 251 | 250 |
| 252 SurfaceBinding::~SurfaceBinding() { | 251 SurfaceBinding::~SurfaceBinding() { |
| 253 } | 252 } |
| 254 | 253 |
| 255 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() { | 254 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() { |
| 256 return state_->CreateOutputSurface(view_); | 255 return state_->CreateOutputSurface(view_); |
| 257 } | 256 } |
| 258 | 257 |
| 259 } // namespace mandoline | 258 } // namespace mandoline |
| OLD | NEW |