| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 IconRecord::IconRecord(const String& url) | 43 IconRecord::IconRecord(const String& url) |
| 44 : m_iconURL(url) | 44 : m_iconURL(url) |
| 45 , m_stamp(0) | 45 , m_stamp(0) |
| 46 , m_dataSet(false) | 46 , m_dataSet(false) |
| 47 { | 47 { |
| 48 | 48 |
| 49 } | 49 } |
| 50 | 50 |
| 51 IconRecord::~IconRecord() | 51 IconRecord::~IconRecord() |
| 52 { | 52 { |
| 53 LOG(IconDatabase, "Destroying IconRecord for icon url %s", m_iconURL.ascii()
.data()); | 53 LOG_INFO(IconDatabase, "Destroying IconRecord for icon url %s", m_iconURL.as
cii().data()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 Image* IconRecord::image(const IntSize&) | 56 Image* IconRecord::image(const IntSize&) |
| 57 { | 57 { |
| 58 // FIXME rdar://4680377 - For size right now, we are returning our one and o
nly image and the Bridge | 58 // FIXME rdar://4680377 - For size right now, we are returning our one and o
nly image and the Bridge |
| 59 // is resizing it in place. We need to actually store all the original repr
esentations here and return a native | 59 // is resizing it in place. We need to actually store all the original repr
esentations here and return a native |
| 60 // one, or resize the best one to the requested size and cache that result. | 60 // one, or resize the best one to the requested size and cache that result. |
| 61 | 61 |
| 62 return m_image.get(); | 62 return m_image.get(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void IconRecord::setImageData(PassRefPtr<SharedBuffer> data) | 65 void IconRecord::setImageData(PassRefPtr<SharedBuffer> data) |
| 66 { | 66 { |
| 67 // It's okay to delete the raw image here. Any existing clients using this i
con will be | 67 // It's okay to delete the raw image here. Any existing clients using this i
con will be |
| 68 // managing an image that was created with a copy of this raw image data. | 68 // managing an image that was created with a copy of this raw image data. |
| 69 m_image = BitmapImage::create(); | 69 m_image = BitmapImage::create(); |
| 70 | 70 |
| 71 // Copy the provided data into the buffer of the new Image object. | 71 // Copy the provided data into the buffer of the new Image object. |
| 72 if (!m_image->setData(data, true)) { | 72 if (!m_image->setData(data, true)) { |
| 73 LOG(IconDatabase, "Manual image data for iconURL '%s' FAILED - it was pr
obably invalid image data", m_iconURL.ascii().data()); | 73 LOG_INFO(IconDatabase, "Manual image data for iconURL '%s' FAILED - it w
as probably invalid image data", m_iconURL.ascii().data()); |
| 74 m_image.clear(); | 74 m_image.clear(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 m_dataSet = true; | 77 m_dataSet = true; |
| 78 } | 78 } |
| 79 | 79 |
| 80 void IconRecord::loadImageFromResource(const char* resource) | 80 void IconRecord::loadImageFromResource(const char* resource) |
| 81 { | 81 { |
| 82 if (!resource) | 82 if (!resource) |
| 83 return; | 83 return; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 97 | 97 |
| 98 IconSnapshot IconRecord::snapshot(bool forDeletion) const | 98 IconSnapshot IconRecord::snapshot(bool forDeletion) const |
| 99 { | 99 { |
| 100 if (forDeletion) | 100 if (forDeletion) |
| 101 return IconSnapshot(m_iconURL, 0, 0); | 101 return IconSnapshot(m_iconURL, 0, 0); |
| 102 | 102 |
| 103 return IconSnapshot(m_iconURL, m_stamp, m_image ? m_image->data() : 0); | 103 return IconSnapshot(m_iconURL, m_stamp, m_image ? m_image->data() : 0); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace WebCore | 106 } // namespace WebCore |
| OLD | NEW |