| 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 "services/ui/view_manager/view_registry.h" | 5 #include "services/ui/view_manager/view_registry.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 tree_state->LinkRoot(root_key, std::unique_ptr<ViewStub>(new ViewStub( | 327 tree_state->LinkRoot(root_key, std::unique_ptr<ViewStub>(new ViewStub( |
| 328 this, root_view_owner.Pass()))); | 328 this, root_view_owner.Pass()))); |
| 329 UpdateViewTreeRootScene(tree_state); | 329 UpdateViewTreeRootScene(tree_state); |
| 330 | 330 |
| 331 // Schedule layout of the tree on behalf of its newly added root. | 331 // Schedule layout of the tree on behalf of its newly added root. |
| 332 // We don't need to schedule layout of the root until the tree provides | 332 // We don't need to schedule layout of the root until the tree provides |
| 333 // new layout parameters. | 333 // new layout parameters. |
| 334 InvalidateLayoutForRoot(tree_state); | 334 InvalidateLayoutForRoot(tree_state); |
| 335 } | 335 } |
| 336 | 336 |
| 337 void ViewRegistry::ResetRoot(ViewTreeState* tree_state, | 337 void ViewRegistry::ClearRoot(ViewTreeState* tree_state, |
| 338 mojo::InterfaceRequest<mojo::ui::ViewOwner> | 338 mojo::InterfaceRequest<mojo::ui::ViewOwner> |
| 339 transferred_view_owner_request) { | 339 transferred_view_owner_request) { |
| 340 DCHECK(IsViewTreeStateRegisteredDebug(tree_state)); | 340 DCHECK(IsViewTreeStateRegisteredDebug(tree_state)); |
| 341 DVLOG(1) << "ResetRoot: tree=" << tree_state; | 341 DVLOG(1) << "ClearRoot: tree=" << tree_state; |
| 342 | 342 |
| 343 // Ensure there is a root. | 343 // Ensure there is a root. |
| 344 if (!tree_state->root()) { | 344 if (!tree_state->root()) { |
| 345 LOG(ERROR) | 345 LOG(ERROR) |
| 346 << "View tree attempted to reset the root but there is none: tree=" | 346 << "View tree attempted to reset the root but there is none: tree=" |
| 347 << tree_state; | 347 << tree_state; |
| 348 UnregisterViewTree(tree_state); | 348 UnregisterViewTree(tree_state); |
| 349 return; | 349 return; |
| 350 } | 350 } |
| 351 | 351 |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 mojo::Rect viewport; | 766 mojo::Rect viewport; |
| 767 viewport.width = root_state->layout_result()->size->width; | 767 viewport.width = root_state->layout_result()->size->width; |
| 768 viewport.height = root_state->layout_result()->size->height; | 768 viewport.height = root_state->layout_result()->size->height; |
| 769 tree_state->renderer()->SetRootScene( | 769 tree_state->renderer()->SetRootScene( |
| 770 tree_state->root()->state()->scene_token()->Clone(), | 770 tree_state->root()->state()->scene_token()->Clone(), |
| 771 mojo::gfx::composition::kSceneVersionNone, viewport.Clone()); | 771 mojo::gfx::composition::kSceneVersionNone, viewport.Clone()); |
| 772 return; | 772 return; |
| 773 } | 773 } |
| 774 } | 774 } |
| 775 | 775 |
| 776 tree_state->renderer()->ResetRootScene(); | 776 tree_state->renderer()->ClearRootScene(); |
| 777 } | 777 } |
| 778 | 778 |
| 779 void ViewRegistry::OnRendererDied(ViewTreeState* tree_state) { | 779 void ViewRegistry::OnRendererDied(ViewTreeState* tree_state) { |
| 780 DCHECK(IsViewTreeStateRegisteredDebug(tree_state)); | 780 DCHECK(IsViewTreeStateRegisteredDebug(tree_state)); |
| 781 DVLOG(1) << "UpdateViewTreeRootScene: tree_state=" << tree_state; | 781 DVLOG(1) << "UpdateViewTreeRootScene: tree_state=" << tree_state; |
| 782 | 782 |
| 783 tree_state->SetRenderer(nullptr); | 783 tree_state->SetRenderer(nullptr); |
| 784 SendRendererDied(tree_state); | 784 SendRendererDied(tree_state); |
| 785 } | 785 } |
| 786 | 786 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 809 void ViewRegistry::SendRendererDied(ViewTreeState* tree_state) { | 809 void ViewRegistry::SendRendererDied(ViewTreeState* tree_state) { |
| 810 DCHECK(IsViewTreeStateRegisteredDebug(tree_state)); | 810 DCHECK(IsViewTreeStateRegisteredDebug(tree_state)); |
| 811 | 811 |
| 812 // TODO: Detect ANRs | 812 // TODO: Detect ANRs |
| 813 DVLOG(1) << "SendRendererDied: tree_state=" << tree_state; | 813 DVLOG(1) << "SendRendererDied: tree_state=" << tree_state; |
| 814 tree_state->view_tree_listener()->OnRendererDied( | 814 tree_state->view_tree_listener()->OnRendererDied( |
| 815 base::Bind(&base::DoNothing)); | 815 base::Bind(&base::DoNothing)); |
| 816 } | 816 } |
| 817 | 817 |
| 818 } // namespace view_manager | 818 } // namespace view_manager |
| OLD | NEW |