OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/pepper/pepper_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bit_cast.h" | 10 #include "base/bit_cast.h" |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
771 // of us or the view renders via the accelerated compositor which is | 771 // of us or the view renders via the accelerated compositor which is |
772 // incompatible with the move and backfill scrolling model. | 772 // incompatible with the move and backfill scrolling model. |
773 InvalidateRect(rect); | 773 InvalidateRect(rect); |
774 } | 774 } |
775 } | 775 } |
776 } | 776 } |
777 | 777 |
778 void PepperPluginInstanceImpl::CommitTextureMailbox( | 778 void PepperPluginInstanceImpl::CommitTextureMailbox( |
779 const cc::TextureMailbox& texture_mailbox) { | 779 const cc::TextureMailbox& texture_mailbox) { |
780 if (committed_texture_.IsValid() && !IsTextureInUse(committed_texture_)) { | 780 if (committed_texture_.IsValid() && !IsTextureInUse(committed_texture_)) { |
781 bound_graphics_3d_->ReturnFrontBuffer( | 781 bound_graphics_3d_->ReturnFrontBuffer( |
erikchen
2016/05/05 20:15:29
I don't think this one needs a nullcheck, as there
| |
782 committed_texture_.mailbox(), committed_texture_consumed_sync_token_, | 782 committed_texture_.mailbox(), committed_texture_consumed_sync_token_, |
783 false); | 783 false); |
784 } | 784 } |
785 | 785 |
786 committed_texture_ = texture_mailbox; | 786 committed_texture_ = texture_mailbox; |
787 committed_texture_consumed_sync_token_ = gpu::SyncToken(); | 787 committed_texture_consumed_sync_token_ = gpu::SyncToken(); |
788 | 788 |
789 if (!texture_layer_) { | 789 if (!texture_layer_) { |
790 UpdateLayer(true); | 790 UpdateLayer(true); |
791 return; | 791 return; |
(...skipping 24 matching lines...) Expand all Loading... | |
816 bool is_lost) { | 816 bool is_lost) { |
817 bool removed = DecrementTextureReferenceCount(texture_mailbox); | 817 bool removed = DecrementTextureReferenceCount(texture_mailbox); |
818 bool is_committed_texture = | 818 bool is_committed_texture = |
819 committed_texture_.mailbox() == texture_mailbox.mailbox(); | 819 committed_texture_.mailbox() == texture_mailbox.mailbox(); |
820 | 820 |
821 if (is_committed_texture && !is_lost) { | 821 if (is_committed_texture && !is_lost) { |
822 committed_texture_consumed_sync_token_ = sync_token; | 822 committed_texture_consumed_sync_token_ = sync_token; |
823 return; | 823 return; |
824 } | 824 } |
825 | 825 |
826 if (removed && !is_committed_texture) { | 826 if (removed && !is_committed_texture && bound_graphics_3d_) { |
piman
2016/05/05 20:25:41
Actually, this makes me think a little more.
If th
erikchen
2016/05/05 21:13:07
Yes, we should.
| |
827 bound_graphics_3d_->ReturnFrontBuffer(texture_mailbox.mailbox(), sync_token, | 827 bound_graphics_3d_->ReturnFrontBuffer(texture_mailbox.mailbox(), sync_token, |
828 is_lost); | 828 is_lost); |
829 } | 829 } |
830 } | 830 } |
831 | 831 |
832 void PepperPluginInstanceImpl::InstanceCrashed() { | 832 void PepperPluginInstanceImpl::InstanceCrashed() { |
833 // Force free all resources and vars. | 833 // Force free all resources and vars. |
834 HostGlobals::Get()->InstanceCrashed(pp_instance()); | 834 HostGlobals::Get()->InstanceCrashed(pp_instance()); |
835 | 835 |
836 // Free any associated graphics. | 836 // Free any associated graphics. |
(...skipping 2579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3416 const cc::TextureMailbox& mailbox) const { | 3416 const cc::TextureMailbox& mailbox) const { |
3417 auto it = | 3417 auto it = |
3418 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), | 3418 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), |
3419 [&mailbox](const TextureMailboxRefCount& ref_count) { | 3419 [&mailbox](const TextureMailboxRefCount& ref_count) { |
3420 return ref_count.first.mailbox() == mailbox.mailbox(); | 3420 return ref_count.first.mailbox() == mailbox.mailbox(); |
3421 }); | 3421 }); |
3422 return it != texture_ref_counts_.end(); | 3422 return it != texture_ref_counts_.end(); |
3423 } | 3423 } |
3424 | 3424 |
3425 } // namespace content | 3425 } // namespace content |
OLD | NEW |