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

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

Issue 1438273002: cc: Don't crash if GMB allocation fails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years 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
« no previous file with comments | « no previous file | no next file » | 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/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 size.width(), size.height(), 0, GLDataFormat(format), 1530 size.width(), size.height(), 0, GLDataFormat(format),
1531 GLDataType(format), NULL); 1531 GLDataType(format), NULL);
1532 } 1532 }
1533 } 1533 }
1534 } 1534 }
1535 1535
1536 void ResourceProvider::LazyCreateImage(Resource* resource) { 1536 void ResourceProvider::LazyCreateImage(Resource* resource) {
1537 DCHECK(resource->gpu_memory_buffer); 1537 DCHECK(resource->gpu_memory_buffer);
1538 DCHECK(resource->gl_id); 1538 DCHECK(resource->gl_id);
1539 DCHECK(resource->allocated); 1539 DCHECK(resource->allocated);
1540 // Avoid crashing in release builds if GpuMemoryBuffer allocation fails.
1541 // http://crbug.com/554541
1542 if (!resource->gpu_memory_buffer)
1543 return;
1540 if (!resource->image_id) { 1544 if (!resource->image_id) {
1541 GLES2Interface* gl = ContextGL(); 1545 GLES2Interface* gl = ContextGL();
1542 DCHECK(gl); 1546 DCHECK(gl);
1543 1547
1544 #if defined(OS_CHROMEOS) 1548 #if defined(OS_CHROMEOS)
1545 // TODO(reveman): GL_COMMANDS_ISSUED_CHROMIUM is used for synchronization 1549 // TODO(reveman): GL_COMMANDS_ISSUED_CHROMIUM is used for synchronization
1546 // on ChromeOS to avoid some performance issues. This only works with 1550 // on ChromeOS to avoid some performance issues. This only works with
1547 // shared memory backed buffers. crbug.com/436314 1551 // shared memory backed buffers. crbug.com/436314
1548 DCHECK_EQ(resource->gpu_memory_buffer->GetHandle().type, 1552 DCHECK_EQ(resource->gpu_memory_buffer->GetHandle().type,
1549 gfx::SHARED_MEMORY_BUFFER); 1553 gfx::SHARED_MEMORY_BUFFER);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 const int kImportance = 2; 1665 const int kImportance = 2;
1662 pmd->CreateSharedGlobalAllocatorDump(guid); 1666 pmd->CreateSharedGlobalAllocatorDump(guid);
1663 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); 1667 pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
1664 } 1668 }
1665 } 1669 }
1666 1670
1667 return true; 1671 return true;
1668 } 1672 }
1669 1673
1670 } // namespace cc 1674 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698