| 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/sub_surface.h" | 5 #include "components/exo/sub_surface.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "base/trace_event/trace_event_argument.h" | 9 #include "base/trace_event/trace_event_argument.h" |
| 10 #include "components/exo/surface.h" | 10 #include "components/exo/surface.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 //////////////////////////////////////////////////////////////////////////////// | 91 //////////////////////////////////////////////////////////////////////////////// |
| 92 // SurfaceDelegate overrides: | 92 // SurfaceDelegate overrides: |
| 93 | 93 |
| 94 void SubSurface::OnSurfaceCommit() { | 94 void SubSurface::OnSurfaceCommit() { |
| 95 // Early out if commit should be synchronized with parent. | 95 // Early out if commit should be synchronized with parent. |
| 96 if (IsSurfaceSynchronized()) | 96 if (IsSurfaceSynchronized()) |
| 97 return; | 97 return; |
| 98 | 98 |
| 99 surface_->CheckIfSurfaceHierarchyNeedsCommitToNewSurfaces(); |
| 99 surface_->CommitSurfaceHierarchy(); | 100 surface_->CommitSurfaceHierarchy(); |
| 100 } | 101 } |
| 101 | 102 |
| 102 bool SubSurface::IsSurfaceSynchronized() const { | 103 bool SubSurface::IsSurfaceSynchronized() const { |
| 103 // A sub-surface is effectively synchronized if either its parent is | 104 // A sub-surface is effectively synchronized if either its parent is |
| 104 // synchronized or itself is in synchronized mode. | 105 // synchronized or itself is in synchronized mode. |
| 105 if (is_synchronized_) | 106 if (is_synchronized_) |
| 106 return true; | 107 return true; |
| 107 | 108 |
| 108 return parent_ ? parent_->IsSynchronized() : false; | 109 return parent_ ? parent_->IsSynchronized() : false; |
| 109 } | 110 } |
| 110 | 111 |
| 111 //////////////////////////////////////////////////////////////////////////////// | 112 //////////////////////////////////////////////////////////////////////////////// |
| 112 // SurfaceObserver overrides: | 113 // SurfaceObserver overrides: |
| 113 | 114 |
| 114 void SubSurface::OnSurfaceDestroying(Surface* surface) { | 115 void SubSurface::OnSurfaceDestroying(Surface* surface) { |
| 115 surface->RemoveSurfaceObserver(this); | 116 surface->RemoveSurfaceObserver(this); |
| 116 if (surface == parent_) { | 117 if (surface == parent_) { |
| 117 parent_ = nullptr; | 118 parent_ = nullptr; |
| 118 return; | 119 return; |
| 119 } | 120 } |
| 120 DCHECK(surface == surface_); | 121 DCHECK(surface == surface_); |
| 121 if (parent_) | 122 if (parent_) |
| 122 parent_->RemoveSubSurface(surface_); | 123 parent_->RemoveSubSurface(surface_); |
| 123 surface_ = nullptr; | 124 surface_ = nullptr; |
| 124 } | 125 } |
| 125 | 126 |
| 126 } // namespace exo | 127 } // namespace exo |
| OLD | NEW |