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/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |