Chromium Code Reviews| 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 COMPONENTS_EXO_SURFACE_H_ | 5 #ifndef COMPONENTS_EXO_SURFACE_H_ |
| 6 #define COMPONENTS_EXO_SURFACE_H_ | 6 #define COMPONENTS_EXO_SURFACE_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 void OnCompositingDidCommit(ui::Compositor* compositor) override; | 212 void OnCompositingDidCommit(ui::Compositor* compositor) override; |
| 213 void OnCompositingStarted(ui::Compositor* compositor, | 213 void OnCompositingStarted(ui::Compositor* compositor, |
| 214 base::TimeTicks start_time) override; | 214 base::TimeTicks start_time) override; |
| 215 void OnCompositingEnded(ui::Compositor* compositor) override; | 215 void OnCompositingEnded(ui::Compositor* compositor) override; |
| 216 void OnCompositingAborted(ui::Compositor* compositor) override; | 216 void OnCompositingAborted(ui::Compositor* compositor) override; |
| 217 void OnCompositingLockStateChanged(ui::Compositor* compositor) override {} | 217 void OnCompositingLockStateChanged(ui::Compositor* compositor) override {} |
| 218 void OnCompositingShuttingDown(ui::Compositor* compositor) override; | 218 void OnCompositingShuttingDown(ui::Compositor* compositor) override; |
| 219 | 219 |
| 220 void WillDraw(cc::SurfaceId surface_id); | 220 void WillDraw(cc::SurfaceId surface_id); |
| 221 | 221 |
| 222 // Check whether this Surface and its children need to create new cc::Surface | |
| 223 // IDs for their contents next time they get new buffer contents. | |
| 224 void CheckForCommittingToNewSurface(); | |
| 225 | |
| 222 private: | 226 private: |
| 223 bool needs_commit_surface_hierarchy() const { | 227 bool needs_commit_surface_hierarchy() const { |
| 224 return needs_commit_surface_hierarchy_; | 228 return needs_commit_surface_hierarchy_; |
| 225 } | 229 } |
| 226 | 230 |
| 231 // Returns true if any child surface needs a commit and has | |
| 232 // modified_layer_info_ true. | |
| 233 bool HaveChildLayersChanged(); | |
| 234 | |
| 235 // Sets that all children must create new cc::SurfaceIds for their contents. | |
| 236 void SetChildrenCommitToNewSurface(); | |
| 237 | |
| 227 // Commit the current attached buffer to a TextureLayer. | 238 // Commit the current attached buffer to a TextureLayer. |
| 228 void CommitTextureContents(); | 239 void CommitTextureContents(); |
| 229 | 240 |
| 230 // Commit the current attached buffer to a SurfaceLayer. | 241 // Commit the current attached buffer to a SurfaceLayer. |
| 231 void CommitSurfaceContents(); | 242 void CommitSurfaceContents(); |
| 232 | 243 |
| 233 // Set TextureLayer contents to the current buffer. | 244 // Set TextureLayer contents to the current buffer. |
| 234 void SetTextureLayerContents(ui::Layer* layer); | 245 void SetTextureLayerContents(ui::Layer* layer); |
| 235 | 246 |
| 236 // Set SurfaceLayer contents to the current buffer. | 247 // Set SurfaceLayer contents to the current buffer. |
| 237 void SetSurfaceLayerContents(ui::Layer* layer); | 248 void SetSurfaceLayerContents(ui::Layer* layer); |
| 238 | 249 |
| 239 // This returns true when the surface has some contents assigned to it. | 250 // This returns true when the surface has some contents assigned to it. |
| 240 bool has_contents() const { return !!current_buffer_; } | 251 bool has_contents() const { return !!current_buffer_; } |
| 241 | 252 |
| 242 // This is true if the buffer contents should be put in a SurfaceLayer | 253 // This is true if the buffer contents should be put in a SurfaceLayer |
| 243 // rather than a TextureLayer. | 254 // rather than a TextureLayer. |
| 244 static bool use_surface_layer_; | 255 static bool use_surface_layer_; |
| 245 | 256 |
| 257 // This is true if it's possible that the layer properties (size, opacity, | |
| 258 // etc.) may have been modified since the last commit. Attaching a new | |
| 259 // buffer with the same size as the old shouldn't set this to true. | |
| 260 bool modified_layer_info_ = true; | |
| 261 | |
| 262 // This is true if the next commit to this surface should put its contents | |
| 263 // into a new cc::SurfaceId. This allows for synchronization between Surface | |
| 264 // and layer changes. | |
| 265 bool commit_to_new_surface_ = true; | |
| 266 | |
|
reveman
2016/06/09 14:19:29
Check my comments in the .cc file but I'm curious
| |
| 246 // This is true when Attach() has been called and new contents should take | 267 // This is true when Attach() has been called and new contents should take |
| 247 // effect next time Commit() is called. | 268 // effect next time Commit() is called. |
| 248 bool has_pending_contents_; | 269 bool has_pending_contents_; |
| 249 | 270 |
| 250 // The buffer that will become the content of surface when Commit() is called. | 271 // The buffer that will become the content of surface when Commit() is called. |
| 251 base::WeakPtr<Buffer> pending_buffer_; | 272 base::WeakPtr<Buffer> pending_buffer_; |
| 252 | 273 |
| 253 cc::SurfaceManager* surface_manager_; | 274 cc::SurfaceManager* surface_manager_; |
| 254 | 275 |
| 255 scoped_refptr<SurfaceFactoryOwner> factory_owner_; | 276 scoped_refptr<SurfaceFactoryOwner> factory_owner_; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 350 | 371 |
| 351 // Surface observer list. Surface does not own the observers. | 372 // Surface observer list. Surface does not own the observers. |
| 352 base::ObserverList<SurfaceObserver, true> observers_; | 373 base::ObserverList<SurfaceObserver, true> observers_; |
| 353 | 374 |
| 354 DISALLOW_COPY_AND_ASSIGN(Surface); | 375 DISALLOW_COPY_AND_ASSIGN(Surface); |
| 355 }; | 376 }; |
| 356 | 377 |
| 357 } // namespace exo | 378 } // namespace exo |
| 358 | 379 |
| 359 #endif // COMPONENTS_EXO_SURFACE_H_ | 380 #endif // COMPONENTS_EXO_SURFACE_H_ |
| OLD | NEW |