| 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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
| 14 #include "base/trace_event/trace_event_argument.h" | 14 #include "base/trace_event/trace_event_argument.h" |
| 15 #include "cc/quads/render_pass.h" | 15 #include "cc/quads/render_pass.h" |
| 16 #include "cc/quads/shared_quad_state.h" | 16 #include "cc/quads/shared_quad_state.h" |
| 17 #include "cc/quads/solid_color_draw_quad.h" | 17 #include "cc/quads/solid_color_draw_quad.h" |
| 18 #include "cc/quads/texture_draw_quad.h" | 18 #include "cc/quads/texture_draw_quad.h" |
| 19 #include "cc/resources/single_release_callback.h" | 19 #include "cc/resources/single_release_callback.h" |
| 20 #include "cc/surfaces/sequence_surface_reference_factory.h" | 20 #include "cc/surfaces/sequence_surface_reference_factory.h" |
| 21 #include "cc/surfaces/surface.h" | 21 #include "cc/surfaces/surface.h" |
| 22 #include "cc/surfaces/surface_id_allocator.h" | 22 #include "cc/surfaces/surface_id_allocator.h" |
| 23 #include "components/exo/ax_tree_source_surface.h" |
| 23 #include "components/exo/buffer.h" | 24 #include "components/exo/buffer.h" |
| 24 #include "components/exo/surface_delegate.h" | 25 #include "components/exo/surface_delegate.h" |
| 25 #include "components/exo/surface_observer.h" | 26 #include "components/exo/surface_observer.h" |
| 26 #include "third_party/khronos/GLES2/gl2.h" | 27 #include "third_party/khronos/GLES2/gl2.h" |
| 27 #include "ui/aura/env.h" | 28 #include "ui/aura/env.h" |
| 28 #include "ui/aura/window_delegate.h" | 29 #include "ui/aura/window_delegate.h" |
| 29 #include "ui/aura/window_property.h" | 30 #include "ui/aura/window_property.h" |
| 30 #include "ui/aura/window_targeter.h" | 31 #include "ui/aura/window_targeter.h" |
| 31 #include "ui/base/cursor/cursor.h" | 32 #include "ui/base/cursor/cursor.h" |
| 32 #include "ui/base/hit_test.h" | 33 #include "ui/base/hit_test.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 // Surface, public: | 171 // Surface, public: |
| 171 | 172 |
| 172 // TODO(fsamuel): exo should not use context_factory_private. Instead, we should | 173 // TODO(fsamuel): exo should not use context_factory_private. Instead, we should |
| 173 // request a CompositorFrameSink from the aura::Window. Setting up the | 174 // request a CompositorFrameSink from the aura::Window. Setting up the |
| 174 // BeginFrame hierarchy should be an internal implementation detail of aura or | 175 // BeginFrame hierarchy should be an internal implementation detail of aura or |
| 175 // mus in aura-mus. | 176 // mus in aura-mus. |
| 176 Surface::Surface() | 177 Surface::Surface() |
| 177 : window_(new aura::Window(new CustomWindowDelegate(this))), | 178 : window_(new aura::Window(new CustomWindowDelegate(this))), |
| 178 frame_sink_id_(aura::Env::GetInstance() | 179 frame_sink_id_(aura::Env::GetInstance() |
| 179 ->context_factory_private() | 180 ->context_factory_private() |
| 180 ->AllocateFrameSinkId()) { | 181 ->AllocateFrameSinkId()), |
| 182 ax_tree_source_(nullptr) { |
| 181 compositor_frame_sink_holder_ = new CompositorFrameSinkHolder( | 183 compositor_frame_sink_holder_ = new CompositorFrameSinkHolder( |
| 182 this, frame_sink_id_, | 184 this, frame_sink_id_, |
| 183 aura::Env::GetInstance()->context_factory_private()->GetSurfaceManager()); | 185 aura::Env::GetInstance()->context_factory_private()->GetSurfaceManager()); |
| 184 surface_reference_factory_ = | 186 surface_reference_factory_ = |
| 185 new CustomSurfaceReferenceFactory(compositor_frame_sink_holder_.get()); | 187 new CustomSurfaceReferenceFactory(compositor_frame_sink_holder_.get()); |
| 186 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 188 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
| 187 window_->SetName("ExoSurface"); | 189 window_->SetName("ExoSurface"); |
| 188 window_->SetProperty(kSurfaceKey, this); | 190 window_->SetProperty(kSurfaceKey, this); |
| 189 window_->Init(ui::LAYER_SOLID_COLOR); | 191 window_->Init(ui::LAYER_SOLID_COLOR); |
| 190 window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); | 192 window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 | 845 |
| 844 int64_t Surface::GetPropertyInternal(const void* key, | 846 int64_t Surface::GetPropertyInternal(const void* key, |
| 845 int64_t default_value) const { | 847 int64_t default_value) const { |
| 846 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); | 848 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); |
| 847 if (iter == prop_map_.end()) | 849 if (iter == prop_map_.end()) |
| 848 return default_value; | 850 return default_value; |
| 849 return iter->second.value; | 851 return iter->second.value; |
| 850 } | 852 } |
| 851 | 853 |
| 852 } // namespace exo | 854 } // namespace exo |
| OLD | NEW |