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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 bool updated = Layer::Update(queue, occlusion); | 182 bool updated = Layer::Update(queue, occlusion); |
183 if (client_) { | 183 if (client_) { |
184 if (uses_mailbox_) { | 184 if (uses_mailbox_) { |
185 TextureMailbox mailbox; | 185 TextureMailbox mailbox; |
186 if (client_->PrepareTextureMailbox( | 186 if (client_->PrepareTextureMailbox( |
187 &mailbox, layer_tree_host()->UsingSharedMemoryResources())) { | 187 &mailbox, layer_tree_host()->UsingSharedMemoryResources())) { |
188 SetTextureMailbox(mailbox); | 188 SetTextureMailbox(mailbox); |
189 updated = true; | 189 updated = true; |
190 } | 190 } |
191 } else { | 191 } else { |
192 DCHECK(client_->Context3d()); | |
193 texture_id_ = client_->PrepareTexture(); | 192 texture_id_ = client_->PrepareTexture(); |
| 193 DCHECK_EQ(!!texture_id_, !!client_->Context3d()); |
194 if (client_->Context3d() && | 194 if (client_->Context3d() && |
195 client_->Context3d()->getGraphicsResetStatusARB() != GL_NO_ERROR) | 195 client_->Context3d()->getGraphicsResetStatusARB() != GL_NO_ERROR) |
196 texture_id_ = 0; | 196 texture_id_ = 0; |
197 updated = true; | 197 updated = true; |
198 } | 198 } |
199 } | 199 } |
200 | 200 |
201 // SetTextureMailbox could be called externally and the same mailbox used for | 201 // SetTextureMailbox could be called externally and the same mailbox used for |
202 // different textures. Such callers notify this layer that the texture has | 202 // different textures. Such callers notify this layer that the texture has |
203 // changed by calling SetNeedsDisplay, so check for that here. | 203 // changed by calling SetNeedsDisplay, so check for that here. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 } | 313 } |
314 | 314 |
315 void TextureLayer::MailboxHolder::ReturnAndReleaseOnImplThread( | 315 void TextureLayer::MailboxHolder::ReturnAndReleaseOnImplThread( |
316 unsigned sync_point, bool is_lost) { | 316 unsigned sync_point, bool is_lost) { |
317 message_loop_->PostTask(FROM_HERE, base::Bind( | 317 message_loop_->PostTask(FROM_HERE, base::Bind( |
318 &MailboxHolder::ReturnAndReleaseOnMainThread, | 318 &MailboxHolder::ReturnAndReleaseOnMainThread, |
319 this, sync_point, is_lost)); | 319 this, sync_point, is_lost)); |
320 } | 320 } |
321 | 321 |
322 } // namespace cc | 322 } // namespace cc |
OLD | NEW |