Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: components/exo/surface.cc

Issue 2584953002: exo::CompositorFrameSinkHolder's release callbacks hold ref (Closed)
Patch Set: All exo unit tests passed. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 } 651 }
652 652
653 void Surface::SetSurfaceHierarchyNeedsCommitToNewSurfaces() { 653 void Surface::SetSurfaceHierarchyNeedsCommitToNewSurfaces() {
654 needs_commit_to_new_surface_ = true; 654 needs_commit_to_new_surface_ = true;
655 for (auto& sub_surface_entry : pending_sub_surfaces_) { 655 for (auto& sub_surface_entry : pending_sub_surfaces_) {
656 sub_surface_entry.first->SetSurfaceHierarchyNeedsCommitToNewSurfaces(); 656 sub_surface_entry.first->SetSurfaceHierarchyNeedsCommitToNewSurfaces();
657 } 657 }
658 } 658 }
659 659
660 void Surface::UpdateResource(bool client_usage) { 660 void Surface::UpdateResource(bool client_usage) {
661 std::unique_ptr<cc::SingleReleaseCallback> texture_mailbox_release_callback; 661 if (current_buffer_.buffer() &&
662 662 current_buffer_.buffer()->ProduceTransferableResource(
663 cc::TextureMailbox texture_mailbox; 663 compositor_frame_sink_holder_.get(), next_resource_id_,
664 if (current_buffer_.buffer()) { 664 state_.only_visible_on_secure_output, client_usage,
665 texture_mailbox_release_callback = 665 &current_resource_)) {
666 current_buffer_.buffer()->ProduceTextureMailbox( 666 ++next_resource_id_;
reveman 2017/01/03 23:24:47 nit: move the increment above reverse the if-state
Alex Z. 2017/01/03 23:39:15 Done.
667 &texture_mailbox, state_.only_visible_on_secure_output,
668 client_usage);
669 }
670
671 if (texture_mailbox_release_callback) {
672 cc::TransferableResource resource;
673 resource.id = next_resource_id_++;
674 resource.format = cc::RGBA_8888;
675 resource.filter =
676 texture_mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR;
677 resource.size = texture_mailbox.size_in_pixels();
678 resource.mailbox_holder = gpu::MailboxHolder(texture_mailbox.mailbox(),
679 texture_mailbox.sync_token(),
680 texture_mailbox.target());
681 resource.is_overlay_candidate = texture_mailbox.is_overlay_candidate();
682
683 compositor_frame_sink_holder_->AddResourceReleaseCallback(
684 resource.id, std::move(texture_mailbox_release_callback));
685 current_resource_ = resource;
686 } else { 667 } else {
687 current_resource_.id = 0; 668 current_resource_.id = 0;
688 current_resource_.size = gfx::Size(); 669 current_resource_.size = gfx::Size();
689 } 670 }
690 } 671 }
691 672
692 void Surface::UpdateSurface(bool full_damage) { 673 void Surface::UpdateSurface(bool full_damage) {
693 gfx::Size buffer_size = current_resource_.size; 674 gfx::Size buffer_size = current_resource_.size;
694 gfx::SizeF scaled_buffer_size( 675 gfx::SizeF scaled_buffer_size(
695 gfx::ScaleSize(gfx::SizeF(buffer_size), 1.0f / state_.buffer_scale)); 676 gfx::ScaleSize(gfx::SizeF(buffer_size), 1.0f / state_.buffer_scale));
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 776
796 int64_t Surface::GetPropertyInternal(const void* key, 777 int64_t Surface::GetPropertyInternal(const void* key,
797 int64_t default_value) const { 778 int64_t default_value) const {
798 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); 779 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key);
799 if (iter == prop_map_.end()) 780 if (iter == prop_map_.end())
800 return default_value; 781 return default_value;
801 return iter->second.value; 782 return iter->second.value;
802 } 783 }
803 784
804 } // namespace exo 785 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698