| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/resources/video_resource_updater.h" | 5 #include "cc/resources/video_resource_updater.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "cc/output/gl_renderer.h" | 8 #include "cc/output/gl_renderer.h" |
| 9 #include "cc/resources/resource_provider.h" | 9 #include "cc/resources/resource_provider.h" |
| 10 #include "gpu/GLES2/gl2extchromium.h" | 10 #include "gpu/GLES2/gl2extchromium.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 output_resource_format); | 206 output_resource_format); |
| 207 | 207 |
| 208 DCHECK(mailbox.IsZero()); | 208 DCHECK(mailbox.IsZero()); |
| 209 | 209 |
| 210 if (!software_compositor) { | 210 if (!software_compositor) { |
| 211 DCHECK(context_provider_); | 211 DCHECK(context_provider_); |
| 212 | 212 |
| 213 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); | 213 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); |
| 214 | 214 |
| 215 GLC(gl, gl->GenMailboxCHROMIUM(mailbox.name)); | 215 GLC(gl, gl->GenMailboxCHROMIUM(mailbox.name)); |
| 216 if (mailbox.IsZero()) { | 216 ResourceProvider::ScopedWriteLockGL lock(resource_provider_, |
| 217 resource_provider_->DeleteResource(resource_id); | 217 resource_id); |
| 218 resource_id = 0; | 218 GLC(gl, gl->BindTexture(GL_TEXTURE_2D, lock.texture_id())); |
| 219 } else { | 219 GLC(gl, gl->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name)); |
| 220 ResourceProvider::ScopedWriteLockGL lock( | 220 GLC(gl, gl->BindTexture(GL_TEXTURE_2D, 0)); |
| 221 resource_provider_, resource_id); | |
| 222 GLC(gl, gl->BindTexture(GL_TEXTURE_2D, lock.texture_id())); | |
| 223 GLC(gl, gl->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name)); | |
| 224 GLC(gl, gl->BindTexture(GL_TEXTURE_2D, 0)); | |
| 225 } | |
| 226 } | 221 } |
| 227 | 222 |
| 228 if (resource_id) | 223 if (resource_id) |
| 229 all_resources_.push_back(resource_id); | 224 all_resources_.push_back(resource_id); |
| 230 } | 225 } |
| 231 | 226 |
| 232 if (resource_id == 0) { | 227 if (resource_id == 0) { |
| 233 allocation_success = false; | 228 allocation_success = false; |
| 234 break; | 229 break; |
| 235 } | 230 } |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 } | 385 } |
| 391 | 386 |
| 392 PlaneResource recycled_resource(data.resource_id, | 387 PlaneResource recycled_resource(data.resource_id, |
| 393 data.resource_size, | 388 data.resource_size, |
| 394 data.resource_format, | 389 data.resource_format, |
| 395 data.mailbox); | 390 data.mailbox); |
| 396 updater->recycled_resources_.push_back(recycled_resource); | 391 updater->recycled_resources_.push_back(recycled_resource); |
| 397 } | 392 } |
| 398 | 393 |
| 399 } // namespace cc | 394 } // namespace cc |
| OLD | NEW |