| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 "cc/layers/texture_layer.h" | 5 #include "cc/layers/texture_layer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 void TextureLayer::SetTextureMailbox( | 148 void TextureLayer::SetTextureMailbox( |
| 149 const TextureMailbox& mailbox, | 149 const TextureMailbox& mailbox, |
| 150 std::unique_ptr<SingleReleaseCallback> release_callback) { | 150 std::unique_ptr<SingleReleaseCallback> release_callback) { |
| 151 bool requires_commit = true; | 151 bool requires_commit = true; |
| 152 bool allow_mailbox_reuse = false; | 152 bool allow_mailbox_reuse = false; |
| 153 SetTextureMailboxInternal(mailbox, std::move(release_callback), | 153 SetTextureMailboxInternal(mailbox, std::move(release_callback), |
| 154 requires_commit, allow_mailbox_reuse); | 154 requires_commit, allow_mailbox_reuse); |
| 155 } | 155 } |
| 156 | 156 |
| 157 static void IgnoreReleaseCallback(const gpu::SyncToken& sync_token, bool lost) { | |
| 158 } | |
| 159 | |
| 160 void TextureLayer::SetTextureMailboxWithoutReleaseCallback( | |
| 161 const TextureMailbox& mailbox) { | |
| 162 // We allow reuse of the mailbox if there is a new sync point signalling new | |
| 163 // content, and the release callback goes nowhere since we'll be calling it | |
| 164 // multiple times for the same mailbox. | |
| 165 DCHECK(!mailbox.IsValid() || !holder_ref_ || | |
| 166 !mailbox.Equals(holder_ref_->holder()->mailbox()) || | |
| 167 mailbox.sync_token() != holder_ref_->holder()->mailbox().sync_token()); | |
| 168 std::unique_ptr<SingleReleaseCallback> release; | |
| 169 bool requires_commit = true; | |
| 170 bool allow_mailbox_reuse = true; | |
| 171 if (mailbox.IsValid()) | |
| 172 release = SingleReleaseCallback::Create(base::Bind(&IgnoreReleaseCallback)); | |
| 173 SetTextureMailboxInternal(mailbox, std::move(release), requires_commit, | |
| 174 allow_mailbox_reuse); | |
| 175 } | |
| 176 | |
| 177 void TextureLayer::SetNeedsDisplayRect(const gfx::Rect& dirty_rect) { | 157 void TextureLayer::SetNeedsDisplayRect(const gfx::Rect& dirty_rect) { |
| 178 Layer::SetNeedsDisplayRect(dirty_rect); | 158 Layer::SetNeedsDisplayRect(dirty_rect); |
| 179 } | 159 } |
| 180 | 160 |
| 181 void TextureLayer::SetLayerTreeHost(LayerTreeHost* host) { | 161 void TextureLayer::SetLayerTreeHost(LayerTreeHost* host) { |
| 182 if (layer_tree_host() == host) { | 162 if (layer_tree_host() == host) { |
| 183 Layer::SetLayerTreeHost(host); | 163 Layer::SetLayerTreeHost(host); |
| 184 return; | 164 return; |
| 185 } | 165 } |
| 186 | 166 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 void TextureLayer::TextureMailboxHolder::ReturnAndReleaseOnImplThread( | 296 void TextureLayer::TextureMailboxHolder::ReturnAndReleaseOnImplThread( |
| 317 const gpu::SyncToken& sync_token, | 297 const gpu::SyncToken& sync_token, |
| 318 bool is_lost, | 298 bool is_lost, |
| 319 BlockingTaskRunner* main_thread_task_runner) { | 299 BlockingTaskRunner* main_thread_task_runner) { |
| 320 Return(sync_token, is_lost); | 300 Return(sync_token, is_lost); |
| 321 main_thread_task_runner->PostTask( | 301 main_thread_task_runner->PostTask( |
| 322 FROM_HERE, base::Bind(&TextureMailboxHolder::InternalRelease, this)); | 302 FROM_HERE, base::Bind(&TextureMailboxHolder::InternalRelease, this)); |
| 323 } | 303 } |
| 324 | 304 |
| 325 } // namespace cc | 305 } // namespace cc |
| OLD | NEW |