| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 , m_rowBytes(rowBytes) | 75 , m_rowBytes(rowBytes) |
| 76 { | 76 { |
| 77 } | 77 } |
| 78 | 78 |
| 79 DiscardablePixelRef::~DiscardablePixelRef() | 79 DiscardablePixelRef::~DiscardablePixelRef() |
| 80 { | 80 { |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool DiscardablePixelRef::allocAndLockDiscardableMemory(size_t bytes) | 83 bool DiscardablePixelRef::allocAndLockDiscardableMemory(size_t bytes) |
| 84 { | 84 { |
| 85 m_discardable = adoptPtr(blink::Platform::current()->allocateAndLockDiscarda
bleMemory(bytes)); | 85 m_discardable = adoptPtr(Platform::current()->allocateAndLockDiscardableMemo
ry(bytes)); |
| 86 if (m_discardable) { | 86 if (m_discardable) { |
| 87 m_lockedMemory = m_discardable->data(); | 87 m_lockedMemory = m_discardable->data(); |
| 88 return true; | 88 return true; |
| 89 } | 89 } |
| 90 return false; | 90 return false; |
| 91 } | 91 } |
| 92 | 92 |
| 93 bool DiscardablePixelRef::onNewLockPixels(LockRec* rec) | 93 bool DiscardablePixelRef::onNewLockPixels(LockRec* rec) |
| 94 { | 94 { |
| 95 if (!m_lockedMemory && m_discardable->lock()) | 95 if (!m_lockedMemory && m_discardable->lock()) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 110 m_discardable->unlock(); | 110 m_discardable->unlock(); |
| 111 m_lockedMemory = 0; | 111 m_lockedMemory = 0; |
| 112 } | 112 } |
| 113 | 113 |
| 114 bool DiscardablePixelRef::isDiscardable(SkPixelRef* pixelRef) | 114 bool DiscardablePixelRef::isDiscardable(SkPixelRef* pixelRef) |
| 115 { | 115 { |
| 116 return pixelRef && pixelRef->getURI() && !strcmp(pixelRef->getURI(), labelDi
scardable); | 116 return pixelRef && pixelRef->getURI() && !strcmp(pixelRef->getURI(), labelDi
scardable); |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace blink | 119 } // namespace blink |
| OLD | NEW |