| 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 #ifndef SERVICES_UI_VIEW_MANAGER_VIEW_REGISTRY_H_ | 5 #ifndef SERVICES_UI_VIEW_MANAGER_VIEW_REGISTRY_H_ |
| 6 #define SERVICES_UI_VIEW_MANAGER_VIEW_REGISTRY_H_ | 6 #define SERVICES_UI_VIEW_MANAGER_VIEW_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 | 10 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // Destroys |view_state| if an error occurs. | 93 // Destroys |view_state| if an error occurs. |
| 94 void ConnectToViewService(ViewState* view_state, | 94 void ConnectToViewService(ViewState* view_state, |
| 95 const mojo::String& service_name, | 95 const mojo::String& service_name, |
| 96 mojo::ScopedMessagePipeHandle client_handle); | 96 mojo::ScopedMessagePipeHandle client_handle); |
| 97 | 97 |
| 98 // Called when one of the view pipes is closed remotely. | 98 // Called when one of the view pipes is closed remotely. |
| 99 void OnViewDied(ViewState* view_state, const std::string& reason); | 99 void OnViewDied(ViewState* view_state, const std::string& reason); |
| 100 | 100 |
| 101 // VIEW TREE REQUESTS | 101 // VIEW TREE REQUESTS |
| 102 | 102 |
| 103 // Sets the view tree's renderer. |
| 104 // Destroys |tree_state| if an error occurs. |
| 105 void SetRenderer(ViewTreeState* tree_state, |
| 106 mojo::gfx::composition::RendererPtr renderer); |
| 107 |
| 103 // Requests layout. | 108 // Requests layout. |
| 104 // Destroys |tree_state| if an error occurs. | 109 // Destroys |tree_state| if an error occurs. |
| 105 void RequestLayout(ViewTreeState* tree_state); | 110 void RequestLayout(ViewTreeState* tree_state); |
| 106 | 111 |
| 107 // Sets the root of the view tree. | 112 // Sets the root of the view tree. |
| 108 // Destroys |tree_state| if an error occurs. | 113 // Destroys |tree_state| if an error occurs. |
| 109 void SetRoot(ViewTreeState* tree_state, | 114 void SetRoot(ViewTreeState* tree_state, |
| 110 uint32_t root_key, | 115 uint32_t root_key, |
| 111 mojo::InterfaceHandle<mojo::ui::ViewOwner> root_view_owner); | 116 mojo::InterfaceHandle<mojo::ui::ViewOwner> root_view_owner); |
| 112 | 117 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 void IssueNextViewTreeLayoutRequest(ViewTreeState* tree_state); | 171 void IssueNextViewTreeLayoutRequest(ViewTreeState* tree_state); |
| 167 void OnViewLayoutResult(base::WeakPtr<ViewState> view_state_weak, | 172 void OnViewLayoutResult(base::WeakPtr<ViewState> view_state_weak, |
| 168 mojo::ui::ViewLayoutResultPtr result); | 173 mojo::ui::ViewLayoutResultPtr result); |
| 169 void OnViewTreeLayoutResult(base::WeakPtr<ViewTreeState> tree_state_weak); | 174 void OnViewTreeLayoutResult(base::WeakPtr<ViewTreeState> tree_state_weak); |
| 170 | 175 |
| 171 // SCENE MANAGEMENT | 176 // SCENE MANAGEMENT |
| 172 | 177 |
| 173 void OnSceneCreated(base::WeakPtr<ViewState> view_state_weak, | 178 void OnSceneCreated(base::WeakPtr<ViewState> view_state_weak, |
| 174 mojo::gfx::composition::SceneTokenPtr scene_token); | 179 mojo::gfx::composition::SceneTokenPtr scene_token); |
| 175 | 180 |
| 181 // RENDERING |
| 182 |
| 183 void UpdateViewTreeRootScene(ViewTreeState* view_tree); |
| 184 void OnRendererDied(ViewTreeState* view_tree); |
| 185 |
| 176 // SIGNALING | 186 // SIGNALING |
| 177 | 187 |
| 178 void SendChildUnavailable(ViewState* parent_state, uint32_t child_key); | 188 void SendChildUnavailable(ViewState* parent_state, uint32_t child_key); |
| 179 void SendRootUnavailable(ViewTreeState* tree_state, uint32_t root_key); | 189 void SendRootUnavailable(ViewTreeState* tree_state, uint32_t root_key); |
| 190 void SendRendererDied(ViewTreeState* tree_state); |
| 180 | 191 |
| 181 bool IsViewStateRegisteredDebug(ViewState* view_state) { | 192 bool IsViewStateRegisteredDebug(ViewState* view_state) { |
| 182 return view_state && FindView(view_state->view_token()->value); | 193 return view_state && FindView(view_state->view_token()->value); |
| 183 } | 194 } |
| 184 | 195 |
| 185 bool IsViewTreeStateRegisteredDebug(ViewTreeState* tree_state) { | 196 bool IsViewTreeStateRegisteredDebug(ViewTreeState* tree_state) { |
| 186 return tree_state && FindViewTree(tree_state->view_tree_token()->value); | 197 return tree_state && FindViewTree(tree_state->view_tree_token()->value); |
| 187 } | 198 } |
| 188 | 199 |
| 189 mojo::gfx::composition::CompositorPtr compositor_; | 200 mojo::gfx::composition::CompositorPtr compositor_; |
| 190 ViewAssociateTable associate_table_; | 201 ViewAssociateTable associate_table_; |
| 191 | 202 |
| 192 uint32_t next_view_token_value_ = 1u; | 203 uint32_t next_view_token_value_ = 1u; |
| 193 uint32_t next_view_tree_token_value_ = 1u; | 204 uint32_t next_view_tree_token_value_ = 1u; |
| 194 std::unordered_map<uint32_t, ViewState*> views_by_token_; | 205 std::unordered_map<uint32_t, ViewState*> views_by_token_; |
| 195 std::unordered_map<uint32_t, ViewTreeState*> view_trees_by_token_; | 206 std::unordered_map<uint32_t, ViewTreeState*> view_trees_by_token_; |
| 196 | 207 |
| 197 DISALLOW_COPY_AND_ASSIGN(ViewRegistry); | 208 DISALLOW_COPY_AND_ASSIGN(ViewRegistry); |
| 198 }; | 209 }; |
| 199 | 210 |
| 200 } // namespace view_manager | 211 } // namespace view_manager |
| 201 | 212 |
| 202 #endif // SERVICES_UI_VIEW_MANAGER_VIEW_REGISTRY_H_ | 213 #endif // SERVICES_UI_VIEW_MANAGER_VIEW_REGISTRY_H_ |
| OLD | NEW |