| 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/location.h" | 8 #include "base/location.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "cc/layers/texture_layer_client.h" | 10 #include "cc/layers/texture_layer_client.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 bool TextureLayer::DrawsContent() const { | 164 bool TextureLayer::DrawsContent() const { |
| 165 return (client_ || texture_id_ || holder_ref_) && | 165 return (client_ || texture_id_ || holder_ref_) && |
| 166 !context_lost_ && Layer::DrawsContent(); | 166 !context_lost_ && Layer::DrawsContent(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 void TextureLayer::Update(ResourceUpdateQueue* queue, | 169 void TextureLayer::Update(ResourceUpdateQueue* queue, |
| 170 const OcclusionTracker* occlusion) { | 170 const OcclusionTracker* occlusion) { |
| 171 if (client_) { | 171 if (client_) { |
| 172 if (uses_mailbox_) { | 172 if (uses_mailbox_) { |
| 173 TextureMailbox mailbox; | 173 TextureMailbox mailbox; |
| 174 if (client_->PrepareTextureMailbox(&mailbox)) { | 174 if (client_->PrepareTextureMailbox( |
| 175 &mailbox, layer_tree_host()->UsingSharedMemoryResources())) { |
| 175 if (mailbox.IsTexture()) | 176 if (mailbox.IsTexture()) |
| 176 DCHECK(client_->Context3d()); | 177 DCHECK(client_->Context3d()); |
| 177 SetTextureMailbox(mailbox); | 178 SetTextureMailbox(mailbox); |
| 178 } | 179 } |
| 179 } else { | 180 } else { |
| 180 DCHECK(client_->Context3d()); | 181 DCHECK(client_->Context3d()); |
| 181 texture_id_ = client_->PrepareTexture(queue); | 182 texture_id_ = client_->PrepareTexture(queue); |
| 182 } | 183 } |
| 183 context_lost_ = client_->Context3d() && | 184 context_lost_ = client_->Context3d() && |
| 184 client_->Context3d()->getGraphicsResetStatusARB() != GL_NO_ERROR; | 185 client_->Context3d()->getGraphicsResetStatusARB() != GL_NO_ERROR; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 } | 286 } |
| 286 | 287 |
| 287 void TextureLayer::MailboxHolder::ReturnAndReleaseOnImplThread( | 288 void TextureLayer::MailboxHolder::ReturnAndReleaseOnImplThread( |
| 288 unsigned sync_point, bool is_lost) { | 289 unsigned sync_point, bool is_lost) { |
| 289 message_loop_->PostTask(FROM_HERE, base::Bind( | 290 message_loop_->PostTask(FROM_HERE, base::Bind( |
| 290 &MailboxHolder::ReturnAndReleaseOnMainThread, | 291 &MailboxHolder::ReturnAndReleaseOnMainThread, |
| 291 this, sync_point, is_lost)); | 292 this, sync_point, is_lost)); |
| 292 } | 293 } |
| 293 | 294 |
| 294 } // namespace cc | 295 } // namespace cc |
| OLD | NEW |