OLD | NEW |
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/view_manager/display_manager.h" | 5 #include "services/view_manager/display_manager.h" |
6 | 6 |
7 #include "base/numerics/safe_conversions.h" | 7 #include "base/numerics/safe_conversions.h" |
8 #include "cc/surfaces/surface_id_allocator.h" | 8 #include "cc/surfaces/surface_id_allocator.h" |
9 #include "mojo/converters/geometry/geometry_type_converters.h" | 9 #include "mojo/converters/geometry/geometry_type_converters.h" |
10 #include "mojo/converters/surfaces/surfaces_type_converters.h" | 10 #include "mojo/converters/surfaces/surfaces_type_converters.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 app_connection_->ConnectToService("mojo:native_viewport_service", | 92 app_connection_->ConnectToService("mojo:native_viewport_service", |
93 &native_viewport_); | 93 &native_viewport_); |
94 native_viewport_.set_error_handler(this); | 94 native_viewport_.set_error_handler(this); |
95 native_viewport_->Create( | 95 native_viewport_->Create( |
96 metrics_.size->Clone(), | 96 metrics_.size->Clone(), |
97 base::Bind(&DefaultDisplayManager::OnCreatedNativeViewport, | 97 base::Bind(&DefaultDisplayManager::OnCreatedNativeViewport, |
98 weak_factory_.GetWeakPtr())); | 98 weak_factory_.GetWeakPtr())); |
99 native_viewport_->Show(); | 99 native_viewport_->Show(); |
100 | 100 |
101 app_connection_->ConnectToService("mojo:surfaces_service", &surface_); | 101 app_connection_->ConnectToService("mojo:surfaces_service", &surface_); |
102 surface_.set_client(this); | 102 surface_->GetIdNamespace(base::Bind(&DefaultDisplayManager::SetIdNamespace, |
| 103 base::Unretained(this))); |
103 | 104 |
104 mojo::NativeViewportEventDispatcherPtr event_dispatcher; | 105 mojo::NativeViewportEventDispatcherPtr event_dispatcher; |
105 app_connection_->ConnectToService(&event_dispatcher); | 106 app_connection_->ConnectToService(&event_dispatcher); |
106 native_viewport_->SetEventDispatcher(event_dispatcher.Pass()); | 107 native_viewport_->SetEventDispatcher(event_dispatcher.Pass()); |
107 } | 108 } |
108 | 109 |
109 DefaultDisplayManager::~DefaultDisplayManager() { | 110 DefaultDisplayManager::~DefaultDisplayManager() { |
110 } | 111 } |
111 | 112 |
112 void DefaultDisplayManager::SchedulePaint(const ServerView* view, | 113 void DefaultDisplayManager::SchedulePaint(const ServerView* view, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 void DefaultDisplayManager::SetIdNamespace(uint32_t id_namespace) { | 187 void DefaultDisplayManager::SetIdNamespace(uint32_t id_namespace) { |
187 id_namespace_ = id_namespace; | 188 id_namespace_ = id_namespace; |
188 if (surface_allocated_) { | 189 if (surface_allocated_) { |
189 auto qualified_id = mojo::SurfaceId::New(); | 190 auto qualified_id = mojo::SurfaceId::New(); |
190 qualified_id->id_namespace = id_namespace_; | 191 qualified_id->id_namespace = id_namespace_; |
191 qualified_id->local = kLocalSurfaceID; | 192 qualified_id->local = kLocalSurfaceID; |
192 native_viewport_->SubmittedFrame(qualified_id.Pass()); | 193 native_viewport_->SubmittedFrame(qualified_id.Pass()); |
193 } | 194 } |
194 } | 195 } |
195 | 196 |
196 void DefaultDisplayManager::ReturnResources( | |
197 mojo::Array<mojo::ReturnedResourcePtr> resources) { | |
198 DCHECK_EQ(0u, resources.size()); | |
199 } | |
200 | |
201 void DefaultDisplayManager::OnConnectionError() { | 197 void DefaultDisplayManager::OnConnectionError() { |
202 // This is called when the native_viewport is torn down before | 198 // This is called when the native_viewport is torn down before |
203 // ~DefaultDisplayManager may be called. | 199 // ~DefaultDisplayManager may be called. |
204 native_viewport_closed_callback_.Run(); | 200 native_viewport_closed_callback_.Run(); |
205 } | 201 } |
206 | 202 |
207 } // namespace view_manager | 203 } // namespace view_manager |
OLD | NEW |