Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 538 DCHECK(gl); | 538 DCHECK(gl); |
| 539 GLC(gl, gl->DeleteQueriesEXT(1, &resource->gl_upload_query_id)); | 539 GLC(gl, gl->DeleteQueriesEXT(1, &resource->gl_upload_query_id)); |
| 540 } | 540 } |
| 541 if (resource->gl_pixel_buffer_id) { | 541 if (resource->gl_pixel_buffer_id) { |
| 542 GLES2Interface* gl = ContextGL(); | 542 GLES2Interface* gl = ContextGL(); |
| 543 DCHECK(gl); | 543 DCHECK(gl); |
| 544 GLC(gl, gl->DeleteBuffers(1, &resource->gl_pixel_buffer_id)); | 544 GLC(gl, gl->DeleteBuffers(1, &resource->gl_pixel_buffer_id)); |
| 545 } | 545 } |
| 546 if (resource->mailbox.IsValid() && resource->external) { | 546 if (resource->mailbox.IsValid() && resource->external) { |
| 547 GLuint sync_point = resource->mailbox.sync_point(); | 547 GLuint sync_point = resource->mailbox.sync_point(); |
| 548 if (resource->mailbox.IsTexture()) { | 548 if (resource->mailbox.IsTexture() && ContextGL() != NULL) { |
|
boliu
2014/01/06 18:16:13
I know I did the same thing in my hack patch, but
| |
| 549 lost_resource |= lost_output_surface_; | 549 lost_resource |= lost_output_surface_; |
| 550 GLES2Interface* gl = ContextGL(); | 550 GLES2Interface* gl = ContextGL(); |
| 551 DCHECK(gl); | 551 DCHECK(gl); |
| 552 if (resource->gl_id) | 552 if (resource->gl_id) |
| 553 GLC(gl, gl->DeleteTextures(1, &resource->gl_id)); | 553 GLC(gl, gl->DeleteTextures(1, &resource->gl_id)); |
| 554 if (!lost_resource && resource->gl_id) | 554 if (!lost_resource && resource->gl_id) |
| 555 sync_point = gl->InsertSyncPointCHROMIUM(); | 555 sync_point = gl->InsertSyncPointCHROMIUM(); |
| 556 } else { | 556 } else { |
| 557 DCHECK(resource->mailbox.IsSharedMemory()); | 557 DCHECK(resource->mailbox.IsSharedMemory()); |
| 558 base::SharedMemory* shared_memory = resource->mailbox.shared_memory(); | 558 base::SharedMemory* shared_memory = resource->mailbox.shared_memory(); |
| (...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1804 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); | 1804 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); |
| 1805 return active_unit; | 1805 return active_unit; |
| 1806 } | 1806 } |
| 1807 | 1807 |
| 1808 GLES2Interface* ResourceProvider::ContextGL() const { | 1808 GLES2Interface* ResourceProvider::ContextGL() const { |
| 1809 ContextProvider* context_provider = output_surface_->context_provider(); | 1809 ContextProvider* context_provider = output_surface_->context_provider(); |
| 1810 return context_provider ? context_provider->ContextGL() : NULL; | 1810 return context_provider ? context_provider->ContextGL() : NULL; |
| 1811 } | 1811 } |
| 1812 | 1812 |
| 1813 } // namespace cc | 1813 } // namespace cc |
| OLD | NEW |