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 "components/exo/surface.h" | 5 #include "components/exo/surface.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 SurfaceFactoryOwner::~SurfaceFactoryOwner() { | 198 SurfaceFactoryOwner::~SurfaceFactoryOwner() { |
199 if (surface_factory_->manager()) | 199 if (surface_factory_->manager()) |
200 surface_factory_->manager()->InvalidateFrameSinkId(frame_sink_id_); | 200 surface_factory_->manager()->InvalidateFrameSinkId(frame_sink_id_); |
201 } | 201 } |
202 | 202 |
203 //////////////////////////////////////////////////////////////////////////////// | 203 //////////////////////////////////////////////////////////////////////////////// |
204 // Surface, public: | 204 // Surface, public: |
205 | 205 |
206 Surface::Surface() | 206 Surface::Surface() |
207 : window_(new aura::Window(new CustomWindowDelegate(this))), | 207 : window_(new aura::Window(new CustomWindowDelegate(this))), |
208 surface_manager_( | 208 surface_manager_(aura::Env::GetInstance() |
209 aura::Env::GetInstance()->context_factory()->GetSurfaceManager()), | 209 ->context_factory_private() |
| 210 ->GetSurfaceManager()), |
210 factory_owner_(new SurfaceFactoryOwner) { | 211 factory_owner_(new SurfaceFactoryOwner) { |
211 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 212 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
212 window_->SetName("ExoSurface"); | 213 window_->SetName("ExoSurface"); |
213 window_->SetProperty(kSurfaceKey, this); | 214 window_->SetProperty(kSurfaceKey, this); |
214 window_->Init(ui::LAYER_SOLID_COLOR); | 215 window_->Init(ui::LAYER_SOLID_COLOR); |
215 window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); | 216 window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); |
216 window_->set_owned_by_parent(false); | 217 window_->set_owned_by_parent(false); |
217 window_->AddObserver(this); | 218 window_->AddObserver(this); |
218 factory_owner_->surface_ = this; | 219 factory_owner_->surface_ = this; |
219 factory_owner_->frame_sink_id_ = | 220 factory_owner_->frame_sink_id_ = aura::Env::GetInstance() |
220 aura::Env::GetInstance()->context_factory()->AllocateFrameSinkId(); | 221 ->context_factory_private() |
| 222 ->AllocateFrameSinkId(); |
221 factory_owner_->id_allocator_.reset(new cc::SurfaceIdAllocator()); | 223 factory_owner_->id_allocator_.reset(new cc::SurfaceIdAllocator()); |
222 surface_manager_->RegisterFrameSinkId(factory_owner_->frame_sink_id_); | 224 surface_manager_->RegisterFrameSinkId(factory_owner_->frame_sink_id_); |
223 surface_manager_->RegisterSurfaceFactoryClient(factory_owner_->frame_sink_id_, | 225 surface_manager_->RegisterSurfaceFactoryClient(factory_owner_->frame_sink_id_, |
224 factory_owner_.get()); | 226 factory_owner_.get()); |
225 factory_owner_->surface_factory_.reset(new cc::SurfaceFactory( | 227 factory_owner_->surface_factory_.reset(new cc::SurfaceFactory( |
226 factory_owner_->frame_sink_id_, surface_manager_, factory_owner_.get())); | 228 factory_owner_->frame_sink_id_, surface_manager_, factory_owner_.get())); |
227 aura::Env::GetInstance()->context_factory()->AddObserver(this); | 229 aura::Env::GetInstance()->context_factory()->AddObserver(this); |
228 } | 230 } |
229 | 231 |
230 Surface::~Surface() { | 232 Surface::~Surface() { |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 | 876 |
875 int64_t Surface::GetPropertyInternal(const void* key, | 877 int64_t Surface::GetPropertyInternal(const void* key, |
876 int64_t default_value) const { | 878 int64_t default_value) const { |
877 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); | 879 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); |
878 if (iter == prop_map_.end()) | 880 if (iter == prop_map_.end()) |
879 return default_value; | 881 return default_value; |
880 return iter->second.value; | 882 return iter->second.value; |
881 } | 883 } |
882 | 884 |
883 } // namespace exo | 885 } // namespace exo |
OLD | NEW |