Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Side by Side Diff: cc/resources/resource_provider.cc

Issue 124063003: [NOT FOR COMMIT] Hacks to get hardware canvas (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mass corruption on detach Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « android_webview/lib/main/aw_main_delegate.cc ('k') | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 TRACE_EVENT0("cc", "ResourceProvider::DeleteResourceInternal"); 517 TRACE_EVENT0("cc", "ResourceProvider::DeleteResourceInternal");
518 Resource* resource = &it->second; 518 Resource* resource = &it->second;
519 bool lost_resource = resource->lost; 519 bool lost_resource = resource->lost;
520 520
521 DCHECK(resource->exported_count == 0 || style != Normal); 521 DCHECK(resource->exported_count == 0 || style != Normal);
522 if (style == ForShutdown && resource->exported_count > 0) 522 if (style == ForShutdown && resource->exported_count > 0)
523 lost_resource = true; 523 lost_resource = true;
524 524
525 if (resource->image_id) { 525 if (resource->image_id) {
526 GLES2Interface* gl = ContextGL(); 526 GLES2Interface* gl = ContextGL();
527 DCHECK(gl); 527 if (gl) {
528 GLC(gl, gl->DestroyImageCHROMIUM(resource->image_id)); 528 DCHECK(gl);
529 GLC(gl, gl->DestroyImageCHROMIUM(resource->image_id));
530 }
529 } 531 }
530 532
531 if (resource->gl_id && !resource->external) { 533 if (resource->gl_id && !resource->external) {
532 GLES2Interface* gl = ContextGL(); 534 GLES2Interface* gl = ContextGL();
535 if (gl) {
533 DCHECK(gl); 536 DCHECK(gl);
534 GLC(gl, gl->DeleteTextures(1, &resource->gl_id)); 537 GLC(gl, gl->DeleteTextures(1, &resource->gl_id));
538 }
535 } 539 }
536 if (resource->gl_upload_query_id) { 540 if (resource->gl_upload_query_id) {
537 GLES2Interface* gl = ContextGL(); 541 GLES2Interface* gl = ContextGL();
542 if (gl) {
538 DCHECK(gl); 543 DCHECK(gl);
539 GLC(gl, gl->DeleteQueriesEXT(1, &resource->gl_upload_query_id)); 544 GLC(gl, gl->DeleteQueriesEXT(1, &resource->gl_upload_query_id));
545 }
540 } 546 }
541 if (resource->gl_pixel_buffer_id) { 547 if (resource->gl_pixel_buffer_id) {
542 GLES2Interface* gl = ContextGL(); 548 GLES2Interface* gl = ContextGL();
549 if (gl) {
543 DCHECK(gl); 550 DCHECK(gl);
544 GLC(gl, gl->DeleteBuffers(1, &resource->gl_pixel_buffer_id)); 551 GLC(gl, gl->DeleteBuffers(1, &resource->gl_pixel_buffer_id));
552 }
545 } 553 }
546 if (resource->mailbox.IsValid() && resource->external) { 554 if (resource->mailbox.IsValid() && resource->external) {
547 GLuint sync_point = resource->mailbox.sync_point(); 555 GLuint sync_point = resource->mailbox.sync_point();
548 if (resource->mailbox.IsTexture()) { 556 if (resource->mailbox.IsTexture()) {
549 lost_resource |= lost_output_surface_; 557 lost_resource |= lost_output_surface_;
550 GLES2Interface* gl = ContextGL(); 558 GLES2Interface* gl = ContextGL();
551 DCHECK(gl); 559 if (gl) {
552 if (resource->gl_id) 560 DCHECK(gl);
553 GLC(gl, gl->DeleteTextures(1, &resource->gl_id)); 561 if (resource->gl_id)
554 if (!lost_resource && resource->gl_id) 562 GLC(gl, gl->DeleteTextures(1, &resource->gl_id));
555 sync_point = gl->InsertSyncPointCHROMIUM(); 563 if (!lost_resource && resource->gl_id)
564 sync_point = gl->InsertSyncPointCHROMIUM();
565 }
556 } else { 566 } else {
557 DCHECK(resource->mailbox.IsSharedMemory()); 567 DCHECK(resource->mailbox.IsSharedMemory());
558 base::SharedMemory* shared_memory = resource->mailbox.shared_memory(); 568 base::SharedMemory* shared_memory = resource->mailbox.shared_memory();
559 if (resource->pixels && shared_memory) { 569 if (resource->pixels && shared_memory) {
560 DCHECK(shared_memory->memory() == resource->pixels); 570 DCHECK(shared_memory->memory() == resource->pixels);
561 resource->pixels = NULL; 571 resource->pixels = NULL;
562 delete resource->shared_bitmap; 572 delete resource->shared_bitmap;
563 resource->shared_bitmap = NULL; 573 resource->shared_bitmap = NULL;
564 } 574 }
565 } 575 }
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit); 1814 gl->GetIntegerv(GL_ACTIVE_TEXTURE, &active_unit);
1805 return active_unit; 1815 return active_unit;
1806 } 1816 }
1807 1817
1808 GLES2Interface* ResourceProvider::ContextGL() const { 1818 GLES2Interface* ResourceProvider::ContextGL() const {
1809 ContextProvider* context_provider = output_surface_->context_provider(); 1819 ContextProvider* context_provider = output_surface_->context_provider();
1810 return context_provider ? context_provider->ContextGL() : NULL; 1820 return context_provider ? context_provider->ContextGL() : NULL;
1811 } 1821 }
1812 1822
1813 } // namespace cc 1823 } // namespace cc
OLDNEW
« no previous file with comments | « android_webview/lib/main/aw_main_delegate.cc ('k') | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698