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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 178 |
179 bool TextureLayer::HasDrawableContent() const { | 179 bool TextureLayer::HasDrawableContent() const { |
180 return (client_ || holder_ref_) && Layer::HasDrawableContent(); | 180 return (client_ || holder_ref_) && Layer::HasDrawableContent(); |
181 } | 181 } |
182 | 182 |
183 bool TextureLayer::Update() { | 183 bool TextureLayer::Update() { |
184 bool updated = Layer::Update(); | 184 bool updated = Layer::Update(); |
185 if (client_) { | 185 if (client_) { |
186 TextureMailbox mailbox; | 186 TextureMailbox mailbox; |
187 std::unique_ptr<SingleReleaseCallback> release_callback; | 187 std::unique_ptr<SingleReleaseCallback> release_callback; |
188 if (client_->PrepareTextureMailbox( | 188 if (client_->PrepareTextureMailbox(&mailbox, &release_callback)) { |
189 &mailbox, | |
190 &release_callback, | |
191 layer_tree_host()->UsingSharedMemoryResources())) { | |
192 // Already within a commit, no need to do another one immediately. | 189 // Already within a commit, no need to do another one immediately. |
193 bool requires_commit = false; | 190 bool requires_commit = false; |
194 bool allow_mailbox_reuse = false; | 191 bool allow_mailbox_reuse = false; |
195 SetTextureMailboxInternal(mailbox, std::move(release_callback), | 192 SetTextureMailboxInternal(mailbox, std::move(release_callback), |
196 requires_commit, allow_mailbox_reuse); | 193 requires_commit, allow_mailbox_reuse); |
197 updated = true; | 194 updated = true; |
198 } | 195 } |
199 } | 196 } |
200 | 197 |
201 // SetTextureMailbox could be called externally and the same mailbox used for | 198 // SetTextureMailbox could be called externally and the same mailbox used for |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 void TextureLayer::TextureMailboxHolder::ReturnAndReleaseOnImplThread( | 293 void TextureLayer::TextureMailboxHolder::ReturnAndReleaseOnImplThread( |
297 const gpu::SyncToken& sync_token, | 294 const gpu::SyncToken& sync_token, |
298 bool is_lost, | 295 bool is_lost, |
299 BlockingTaskRunner* main_thread_task_runner) { | 296 BlockingTaskRunner* main_thread_task_runner) { |
300 Return(sync_token, is_lost); | 297 Return(sync_token, is_lost); |
301 main_thread_task_runner->PostTask( | 298 main_thread_task_runner->PostTask( |
302 FROM_HERE, base::Bind(&TextureMailboxHolder::InternalRelease, this)); | 299 FROM_HERE, base::Bind(&TextureMailboxHolder::InternalRelease, this)); |
303 } | 300 } |
304 | 301 |
305 } // namespace cc | 302 } // namespace cc |
OLD | NEW |