| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 // TODO(fsamuel): exo should not use context_factory_private. Instead, we should | 172 // TODO(fsamuel): exo should not use context_factory_private. Instead, we should |
| 173 // request a CompositorFrameSink from the aura::Window. Setting up the | 173 // request a CompositorFrameSink from the aura::Window. Setting up the |
| 174 // BeginFrame hierarchy should be an internal implementation detail of aura or | 174 // BeginFrame hierarchy should be an internal implementation detail of aura or |
| 175 // mus in aura-mus. | 175 // mus in aura-mus. |
| 176 Surface::Surface() | 176 Surface::Surface() |
| 177 : window_(new aura::Window(new CustomWindowDelegate(this))), | 177 : window_(new aura::Window(new CustomWindowDelegate(this))), |
| 178 frame_sink_id_(aura::Env::GetInstance() | 178 frame_sink_id_(aura::Env::GetInstance() |
| 179 ->context_factory_private() | 179 ->context_factory_private() |
| 180 ->AllocateFrameSinkId()) { | 180 ->AllocateFrameSinkId()) { |
| 181 cc::mojom::MojoCompositorFrameSinkClientPtr frame_sink_holder_ptr; | |
| 182 cc::mojom::MojoCompositorFrameSinkClientRequest frame_sink_client_request( | |
| 183 &frame_sink_holder_ptr); | |
| 184 std::unique_ptr<CompositorFrameSink> frame_sink(new CompositorFrameSink( | |
| 185 frame_sink_id_, | |
| 186 aura::Env::GetInstance()->context_factory_private()->GetSurfaceManager(), | |
| 187 std::move(frame_sink_holder_ptr))); | |
| 188 compositor_frame_sink_holder_ = new CompositorFrameSinkHolder( | 181 compositor_frame_sink_holder_ = new CompositorFrameSinkHolder( |
| 189 this, std::move(frame_sink), std::move(frame_sink_client_request)); | 182 this, frame_sink_id_, |
| 183 aura::Env::GetInstance()->context_factory_private()->GetSurfaceManager()); |
| 190 surface_reference_factory_ = | 184 surface_reference_factory_ = |
| 191 new CustomSurfaceReferenceFactory(compositor_frame_sink_holder_.get()); | 185 new CustomSurfaceReferenceFactory(compositor_frame_sink_holder_.get()); |
| 192 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 186 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
| 193 window_->SetName("ExoSurface"); | 187 window_->SetName("ExoSurface"); |
| 194 window_->SetProperty(kSurfaceKey, this); | 188 window_->SetProperty(kSurfaceKey, this); |
| 195 window_->Init(ui::LAYER_SOLID_COLOR); | 189 window_->Init(ui::LAYER_SOLID_COLOR); |
| 196 window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); | 190 window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); |
| 197 window_->set_owned_by_parent(false); | 191 window_->set_owned_by_parent(false); |
| 198 window_->AddObserver(this); | 192 window_->AddObserver(this); |
| 199 aura::Env::GetInstance()->context_factory()->AddObserver(this); | 193 aura::Env::GetInstance()->context_factory()->AddObserver(this); |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 | 843 |
| 850 int64_t Surface::GetPropertyInternal(const void* key, | 844 int64_t Surface::GetPropertyInternal(const void* key, |
| 851 int64_t default_value) const { | 845 int64_t default_value) const { |
| 852 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); | 846 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); |
| 853 if (iter == prop_map_.end()) | 847 if (iter == prop_map_.end()) |
| 854 return default_value; | 848 return default_value; |
| 855 return iter->second.value; | 849 return iter->second.value; |
| 856 } | 850 } |
| 857 | 851 |
| 858 } // namespace exo | 852 } // namespace exo |
| OLD | NEW |