| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple 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 27 matching lines...) Expand all Loading... |
| 38 { | 38 { |
| 39 } | 39 } |
| 40 | 40 |
| 41 CSSImageGeneratorValue::~CSSImageGeneratorValue() | 41 CSSImageGeneratorValue::~CSSImageGeneratorValue() |
| 42 { | 42 { |
| 43 } | 43 } |
| 44 | 44 |
| 45 void CSSImageGeneratorValue::addClient(LayoutObject* layoutObject, const IntSize
& size) | 45 void CSSImageGeneratorValue::addClient(LayoutObject* layoutObject, const IntSize
& size) |
| 46 { | 46 { |
| 47 ASSERT(layoutObject); | 47 ASSERT(layoutObject); |
| 48 #if !ENABLE(OILPAN) | |
| 49 ref(); | 48 ref(); |
| 50 #else | |
| 51 if (m_clients.isEmpty()) { | |
| 52 ASSERT(!m_keepAlive); | |
| 53 m_keepAlive = this; | |
| 54 } | |
| 55 #endif | |
| 56 | 49 |
| 57 if (!size.isEmpty()) | 50 if (!size.isEmpty()) |
| 58 m_sizes.add(size); | 51 m_sizes.add(size); |
| 59 | 52 |
| 60 LayoutObjectSizeCountMap::iterator it = m_clients.find(layoutObject); | 53 LayoutObjectSizeCountMap::iterator it = m_clients.find(layoutObject); |
| 61 if (it == m_clients.end()) { | 54 if (it == m_clients.end()) { |
| 62 m_clients.add(layoutObject, SizeAndCount(size, 1)); | 55 m_clients.add(layoutObject, SizeAndCount(size, 1)); |
| 63 } else { | 56 } else { |
| 64 SizeAndCount& sizeCount = it->value; | 57 SizeAndCount& sizeCount = it->value; |
| 65 ++sizeCount.count; | 58 ++sizeCount.count; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 77 IntSize size = sizeCount.size; | 70 IntSize size = sizeCount.size; |
| 78 if (!size.isEmpty()) { | 71 if (!size.isEmpty()) { |
| 79 m_sizes.remove(size); | 72 m_sizes.remove(size); |
| 80 if (!m_sizes.contains(size)) | 73 if (!m_sizes.contains(size)) |
| 81 m_images.remove(size); | 74 m_images.remove(size); |
| 82 } | 75 } |
| 83 | 76 |
| 84 if (!--sizeCount.count) | 77 if (!--sizeCount.count) |
| 85 m_clients.remove(layoutObject); | 78 m_clients.remove(layoutObject); |
| 86 | 79 |
| 87 #if !ENABLE(OILPAN) | |
| 88 deref(); | 80 deref(); |
| 89 #else | |
| 90 if (m_clients.isEmpty()) { | |
| 91 ASSERT(m_keepAlive); | |
| 92 m_keepAlive.clear(); | |
| 93 } | |
| 94 #endif | |
| 95 } | 81 } |
| 96 | 82 |
| 97 Image* CSSImageGeneratorValue::getImage(LayoutObject* layoutObject, const IntSiz
e& size) | 83 Image* CSSImageGeneratorValue::getImage(LayoutObject* layoutObject, const IntSiz
e& size) |
| 98 { | 84 { |
| 99 LayoutObjectSizeCountMap::iterator it = m_clients.find(layoutObject); | 85 LayoutObjectSizeCountMap::iterator it = m_clients.find(layoutObject); |
| 100 if (it != m_clients.end()) { | 86 if (it != m_clients.end()) { |
| 101 SizeAndCount& sizeCount = it->value; | 87 SizeAndCount& sizeCount = it->value; |
| 102 IntSize oldSize = sizeCount.size; | 88 IntSize oldSize = sizeCount.size; |
| 103 if (oldSize != size) { | 89 if (oldSize != size) { |
| 104 RefPtrWillBeRawPtr<CSSImageGeneratorValue> protect(this); | 90 RefPtr<CSSImageGeneratorValue> protect(this); |
| 105 removeClient(layoutObject); | 91 removeClient(layoutObject); |
| 106 addClient(layoutObject, size); | 92 addClient(layoutObject, size); |
| 107 } | 93 } |
| 108 } | 94 } |
| 109 | 95 |
| 110 // Don't generate an image for empty sizes. | 96 // Don't generate an image for empty sizes. |
| 111 if (size.isEmpty()) | 97 if (size.isEmpty()) |
| 112 return 0; | 98 return 0; |
| 113 | 99 |
| 114 // Look up the image in our cache. | 100 // Look up the image in our cache. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 break; | 205 break; |
| 220 case RadialGradientClass: | 206 case RadialGradientClass: |
| 221 toCSSRadialGradientValue(this)->loadSubimages(document); | 207 toCSSRadialGradientValue(this)->loadSubimages(document); |
| 222 break; | 208 break; |
| 223 default: | 209 default: |
| 224 ASSERT_NOT_REACHED(); | 210 ASSERT_NOT_REACHED(); |
| 225 } | 211 } |
| 226 } | 212 } |
| 227 | 213 |
| 228 } // namespace blink | 214 } // namespace blink |
| OLD | NEW |