| 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 "ui/views/mus/surface_binding.h" | 5 #include "ui/views/mus/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" |
| 11 #include "base/threading/thread_local.h" | 11 #include "base/threading/thread_local.h" |
| 12 #include "cc/output/compositor_frame.h" | 12 #include "cc/output/compositor_frame.h" |
| 13 #include "cc/output/output_surface.h" | 13 #include "cc/output/output_surface.h" |
| 14 #include "cc/output/output_surface_client.h" | 14 #include "cc/output/output_surface_client.h" |
| 15 #include "cc/output/software_output_device.h" | 15 #include "cc/output/software_output_device.h" |
| 16 #include "cc/resources/shared_bitmap_manager.h" | 16 #include "cc/resources/shared_bitmap_manager.h" |
| 17 #include "components/mus/public/cpp/context_provider.h" | 17 #include "components/mus/public/cpp/context_provider.h" |
| 18 #include "components/mus/public/cpp/output_surface.h" | 18 #include "components/mus/public/cpp/output_surface.h" |
| 19 #include "components/mus/public/cpp/window.h" | 19 #include "components/mus/public/cpp/window.h" |
| 20 #include "components/mus/public/cpp/window_tree_connection.h" | 20 #include "components/mus/public/cpp/window_tree_connection.h" |
| 21 #include "components/mus/public/interfaces/gpu.mojom.h" | 21 #include "components/mus/public/interfaces/gpu.mojom.h" |
| 22 #include "mojo/application/public/cpp/application_impl.h" |
| 22 #include "mojo/application/public/cpp/connect.h" | 23 #include "mojo/application/public/cpp/connect.h" |
| 23 #include "mojo/application/public/interfaces/shell.mojom.h" | 24 #include "mojo/application/public/interfaces/shell.mojom.h" |
| 24 #include "mojo/converters/geometry/geometry_type_converters.h" | 25 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 25 #include "mojo/converters/surfaces/surfaces_type_converters.h" | 26 #include "mojo/converters/surfaces/surfaces_type_converters.h" |
| 26 #include "mojo/public/cpp/bindings/binding.h" | 27 #include "mojo/public/cpp/bindings/binding.h" |
| 27 #include "ui/views/mus/window_tree_host_mus.h" | 28 #include "ui/views/mus/window_tree_host_mus.h" |
| 28 | 29 |
| 29 namespace views { | 30 namespace views { |
| 30 namespace { | 31 namespace { |
| 31 void OnGotContentHandlerID(uint32_t content_handler_id) {} | 32 void OnGotContentHandlerID(uint32_t content_handler_id) {} |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 delete window_map; | 122 delete window_map; |
| 122 window_states.Pointer()->Set(nullptr); | 123 window_states.Pointer()->Set(nullptr); |
| 123 } | 124 } |
| 124 } | 125 } |
| 125 | 126 |
| 126 void SurfaceBinding::PerConnectionState::Init() { | 127 void SurfaceBinding::PerConnectionState::Init() { |
| 127 mojo::ServiceProviderPtr service_provider; | 128 mojo::ServiceProviderPtr service_provider; |
| 128 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 129 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 129 request->url = mojo::String::From("mojo:mus"); | 130 request->url = mojo::String::From("mojo:mus"); |
| 130 shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), | 131 shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), |
| 131 nullptr, nullptr, | 132 nullptr, |
| 133 mojo::CreatePermissiveCapabilityFilter(), |
| 132 base::Bind(&OnGotContentHandlerID)); | 134 base::Bind(&OnGotContentHandlerID)); |
| 133 ConnectToService(service_provider.get(), &gpu_); | 135 ConnectToService(service_provider.get(), &gpu_); |
| 134 } | 136 } |
| 135 | 137 |
| 136 // SurfaceBinding -------------------------------------------------------------- | 138 // SurfaceBinding -------------------------------------------------------------- |
| 137 | 139 |
| 138 SurfaceBinding::SurfaceBinding(mojo::Shell* shell, | 140 SurfaceBinding::SurfaceBinding(mojo::Shell* shell, |
| 139 mus::Window* window, | 141 mus::Window* window, |
| 140 mus::mojom::SurfaceType surface_type) | 142 mus::mojom::SurfaceType surface_type) |
| 141 : window_(window), | 143 : window_(window), |
| 142 surface_type_(surface_type), | 144 surface_type_(surface_type), |
| 143 state_(PerConnectionState::Get(shell, window->connection())) {} | 145 state_(PerConnectionState::Get(shell, window->connection())) {} |
| 144 | 146 |
| 145 SurfaceBinding::~SurfaceBinding() {} | 147 SurfaceBinding::~SurfaceBinding() {} |
| 146 | 148 |
| 147 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() { | 149 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() { |
| 148 return state_->CreateOutputSurface(window_, surface_type_); | 150 return state_->CreateOutputSurface(window_, surface_type_); |
| 149 } | 151 } |
| 150 | 152 |
| 151 } // namespace views | 153 } // namespace views |
| OLD | NEW |