| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/blink/web_external_bitmap_impl.h" | 5 #include "cc/blink/web_external_bitmap_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include "cc/resources/shared_bitmap.h" | 9 #include "cc/resources/shared_bitmap.h" |
| 8 | 10 |
| 9 namespace cc_blink { | 11 namespace cc_blink { |
| 10 | 12 |
| 11 namespace { | 13 namespace { |
| 12 | 14 |
| 13 SharedBitmapAllocationFunction g_memory_allocator; | 15 SharedBitmapAllocationFunction g_memory_allocator; |
| 14 | 16 |
| 15 } // namespace | 17 } // namespace |
| 16 | 18 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 29 if (size != size_) { | 31 if (size != size_) { |
| 30 shared_bitmap_ = g_memory_allocator(gfx::Size(size)); | 32 shared_bitmap_ = g_memory_allocator(gfx::Size(size)); |
| 31 size_ = size; | 33 size_ = size; |
| 32 } | 34 } |
| 33 } | 35 } |
| 34 | 36 |
| 35 blink::WebSize WebExternalBitmapImpl::size() { | 37 blink::WebSize WebExternalBitmapImpl::size() { |
| 36 return size_; | 38 return size_; |
| 37 } | 39 } |
| 38 | 40 |
| 39 uint8* WebExternalBitmapImpl::pixels() { | 41 uint8_t* WebExternalBitmapImpl::pixels() { |
| 40 if (!shared_bitmap_) { | 42 if (!shared_bitmap_) { |
| 41 // crbug.com/520417: not sure why a non-null WebExternalBitmap is | 43 // crbug.com/520417: not sure why a non-null WebExternalBitmap is |
| 42 // being passed to prepareMailbox when the shared_bitmap_ is null. | 44 // being passed to prepareMailbox when the shared_bitmap_ is null. |
| 43 // Best hypothesis is that the bitmap is zero-sized. | 45 // Best hypothesis is that the bitmap is zero-sized. |
| 44 DCHECK(size_.isEmpty()); | 46 DCHECK(size_.isEmpty()); |
| 45 return nullptr; | 47 return nullptr; |
| 46 } | 48 } |
| 47 return shared_bitmap_->pixels(); | 49 return shared_bitmap_->pixels(); |
| 48 } | 50 } |
| 49 | 51 |
| 50 } // namespace cc_blink | 52 } // namespace cc_blink |
| OLD | NEW |