| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "mojo/services/view_manager/root_node_manager.h" | 5 #include "mojo/services/view_manager/root_node_manager.h" |
| 6 #include "mojo/services/view_manager/window_tree_host_impl.h" | 6 #include "mojo/services/view_manager/window_tree_host_impl.h" |
| 7 #include "mojo/public/c/gles2/gles2.h" | 7 #include "mojo/public/c/gles2/gles2.h" |
| 8 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" | 8 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" |
| 9 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h" | 9 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h" |
| 10 #include "mojo/services/view_manager/context_factory_impl.h" | 10 #include "mojo/services/view_manager/context_factory_impl.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 native_viewport_.set_client(this); | 82 native_viewport_.set_client(this); |
| 83 native_viewport_->Create(Rect::From(bounds)); | 83 native_viewport_->Create(Rect::From(bounds)); |
| 84 native_viewport_->Show(); | 84 native_viewport_->Show(); |
| 85 | 85 |
| 86 window()->SetLayoutManager(new RootLayoutManager()); | 86 window()->SetLayoutManager(new RootLayoutManager()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 WindowTreeHostImpl::~WindowTreeHostImpl() { | 89 WindowTreeHostImpl::~WindowTreeHostImpl() { |
| 90 DestroyCompositor(); | 90 DestroyCompositor(); |
| 91 DestroyDispatcher(); | 91 DestroyDispatcher(); |
| 92 delete context_factory_; |
| 93 context_factory_ = NULL; |
| 92 } | 94 } |
| 93 | 95 |
| 94 //////////////////////////////////////////////////////////////////////////////// | 96 //////////////////////////////////////////////////////////////////////////////// |
| 95 // WindowTreeHostImpl, aura::WindowTreeHost implementation: | 97 // WindowTreeHostImpl, aura::WindowTreeHost implementation: |
| 96 | 98 |
| 97 ui::EventSource* WindowTreeHostImpl::GetEventSource() { | 99 ui::EventSource* WindowTreeHostImpl::GetEventSource() { |
| 98 return this; | 100 return this; |
| 99 } | 101 } |
| 100 | 102 |
| 101 gfx::AcceleratedWidget WindowTreeHostImpl::GetAcceleratedWidget() { | 103 gfx::AcceleratedWidget WindowTreeHostImpl::GetAcceleratedWidget() { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // WindowTreeHostImpl, ui::EventSource implementation: | 154 // WindowTreeHostImpl, ui::EventSource implementation: |
| 153 | 155 |
| 154 ui::EventProcessor* WindowTreeHostImpl::GetEventProcessor() { | 156 ui::EventProcessor* WindowTreeHostImpl::GetEventProcessor() { |
| 155 return dispatcher(); | 157 return dispatcher(); |
| 156 } | 158 } |
| 157 | 159 |
| 158 //////////////////////////////////////////////////////////////////////////////// | 160 //////////////////////////////////////////////////////////////////////////////// |
| 159 // WindowTreeHostImpl, NativeViewportClient implementation: | 161 // WindowTreeHostImpl, NativeViewportClient implementation: |
| 160 | 162 |
| 161 void WindowTreeHostImpl::OnCreated(uint64_t native_viewport_id) { | 163 void WindowTreeHostImpl::OnCreated(uint64_t native_viewport_id) { |
| 162 LOG(ERROR) << "OnCreated " << native_viewport_id; | |
| 163 CommandBufferPtr cb; | 164 CommandBufferPtr cb; |
| 164 gpu_service_->CreateOnscreenGLES2Context( | 165 gpu_service_->CreateOnscreenGLES2Context( |
| 165 native_viewport_id, Size::From(bounds_.size()), Get(&cb)); | 166 native_viewport_id, Size::From(bounds_.size()), Get(&cb)); |
| 166 widget_ = bit_cast<gfx::AcceleratedWidget>( | 167 widget_ = bit_cast<gfx::AcceleratedWidget>( |
| 167 static_cast<uintptr_t>(native_viewport_id)); | 168 static_cast<uintptr_t>(native_viewport_id)); |
| 168 | 169 |
| 169 // The ContextFactory must exist before any Compositors are created. | 170 // The ContextFactory must exist before any Compositors are created. |
| 170 if (context_factory_) { | 171 if (context_factory_) { |
| 171 delete context_factory_; | 172 delete context_factory_; |
| 172 context_factory_ = NULL; | 173 context_factory_ = NULL; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 191 } | 192 } |
| 192 | 193 |
| 193 void WindowTreeHostImpl::OnEvent(EventPtr event, | 194 void WindowTreeHostImpl::OnEvent(EventPtr event, |
| 194 const mojo::Callback<void()>& callback) { | 195 const mojo::Callback<void()>& callback) { |
| 195 event_received_callback_.Run(event.Pass()); | 196 event_received_callback_.Run(event.Pass()); |
| 196 callback.Run(); | 197 callback.Run(); |
| 197 }; | 198 }; |
| 198 | 199 |
| 199 } // namespace service | 200 } // namespace service |
| 200 } // namespace mojo | 201 } // namespace mojo |
| OLD | NEW |