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/surface.h" | 5 #include "components/exo/surface.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 has_pending_layer_changes_ = true; | 447 has_pending_layer_changes_ = true; |
448 } | 448 } |
449 } | 449 } |
450 | 450 |
451 if (delegate_) { | 451 if (delegate_) { |
452 delegate_->OnSurfaceCommit(); | 452 delegate_->OnSurfaceCommit(); |
453 } else { | 453 } else { |
454 CheckIfSurfaceHierarchyNeedsCommitToNewSurfaces(); | 454 CheckIfSurfaceHierarchyNeedsCommitToNewSurfaces(); |
455 CommitSurfaceHierarchy(); | 455 CommitSurfaceHierarchy(); |
456 } | 456 } |
| 457 |
| 458 cc::BeginFrameAck ack(last_begin_frame_args_.source_id, |
| 459 last_begin_frame_args_.sequence_number, |
| 460 last_begin_frame_args_.sequence_number, 0, true); |
| 461 if (begin_frame_source_) |
| 462 begin_frame_source_->DidFinishFrame(this, ack); |
457 } | 463 } |
458 | 464 |
459 void Surface::CommitSurfaceHierarchy() { | 465 void Surface::CommitSurfaceHierarchy() { |
460 DCHECK(needs_commit_surface_hierarchy_); | 466 DCHECK(needs_commit_surface_hierarchy_); |
461 needs_commit_surface_hierarchy_ = false; | 467 needs_commit_surface_hierarchy_ = false; |
462 has_pending_layer_changes_ = false; | 468 has_pending_layer_changes_ = false; |
463 | 469 |
464 state_ = pending_state_; | 470 state_ = pending_state_; |
465 pending_state_.only_visible_on_secure_output = false; | 471 pending_state_.only_visible_on_secure_output = false; |
466 | 472 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 factory_owner_->frame_sink_id_); | 646 factory_owner_->frame_sink_id_); |
641 } | 647 } |
642 | 648 |
643 void Surface::OnWindowRemovingFromRootWindow(aura::Window* window, | 649 void Surface::OnWindowRemovingFromRootWindow(aura::Window* window, |
644 aura::Window* new_root) { | 650 aura::Window* new_root) { |
645 window->layer()->GetCompositor()->RemoveFrameSink( | 651 window->layer()->GetCompositor()->RemoveFrameSink( |
646 factory_owner_->frame_sink_id_); | 652 factory_owner_->frame_sink_id_); |
647 } | 653 } |
648 | 654 |
649 void Surface::OnBeginFrame(const cc::BeginFrameArgs& args) { | 655 void Surface::OnBeginFrame(const cc::BeginFrameArgs& args) { |
| 656 last_begin_frame_args_ = args; |
650 while (!active_frame_callbacks_.empty()) { | 657 while (!active_frame_callbacks_.empty()) { |
651 active_frame_callbacks_.front().Run(args.frame_time); | 658 active_frame_callbacks_.front().Run(args.frame_time); |
652 active_frame_callbacks_.pop_front(); | 659 active_frame_callbacks_.pop_front(); |
653 } | 660 } |
654 last_begin_frame_args_ = args; | |
655 } | 661 } |
656 | 662 |
657 const cc::BeginFrameArgs& Surface::LastUsedBeginFrameArgs() const { | 663 const cc::BeginFrameArgs& Surface::LastUsedBeginFrameArgs() const { |
658 return last_begin_frame_args_; | 664 return last_begin_frame_args_; |
659 } | 665 } |
660 | 666 |
661 Surface::State::State() : input_region(SkIRect::MakeLargest()) {} | 667 Surface::State::State() : input_region(SkIRect::MakeLargest()) {} |
662 | 668 |
663 Surface::State::~State() = default; | 669 Surface::State::~State() = default; |
664 | 670 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 | 880 |
875 int64_t Surface::GetPropertyInternal(const void* key, | 881 int64_t Surface::GetPropertyInternal(const void* key, |
876 int64_t default_value) const { | 882 int64_t default_value) const { |
877 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); | 883 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); |
878 if (iter == prop_map_.end()) | 884 if (iter == prop_map_.end()) |
879 return default_value; | 885 return default_value; |
880 return iter->second.value; | 886 return iter->second.value; |
881 } | 887 } |
882 | 888 |
883 } // namespace exo | 889 } // namespace exo |
OLD | NEW |