Changeset 148034 in webkit
- Timestamp:
- Apr 9, 2013 12:04:33 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r148033 r148034 1 2013-04-09 Tim Horton <timothy_horton@apple.com> 2 3 [wk2] IconDatabase images should be decoded in the WebProcess 4 https://bugs.webkit.org/show_bug.cgi?id=112524 5 <rdar://problem/10133914> 6 7 Reviewed by Oliver Hunt. 8 9 No testable behavior change. 10 11 * loader/icon/IconDatabase.cpp: 12 (WebCore::IconDatabase::updateIconRecord): 13 Added updateIconRecord, which factors most of setIconDataForIconURL out so it can 14 be shared with setIconBitmapForIconURL. This function will set either a bitmap or 15 raw image data for the given icon URL. 16 17 (WebCore::IconDatabase::setIconBitmapForIconURL): 18 Added; make a copy of the bitmap for thread-safety purposes, and call updateIconRecord. 19 20 (WebCore::IconDatabase::setIconDataForIconURL): 21 Factored out of what is now updateIconRecord. 22 23 * loader/icon/IconDatabase.h: 24 (IconDatabase): Add setIconBitmapForIconURL and updateIconRecord. 25 26 * loader/icon/IconDatabaseBase.h: 27 (WebCore::IconDatabaseBase::setIconBitmapForIconURL): Added. 28 * loader/icon/IconRecord.cpp: 29 (WebCore::IconRecord::setImage): Set the image for an icon record directly (as opposed 30 to setting the image data, which causes the image to be decoded in the WebProcess). 31 * loader/icon/IconRecord.h: 32 (IconRecord): Add setImage. 33 1 34 2013-04-09 Chris Fleizach <cfleizach@apple.com> 2 35 -
trunk/Source/WebCore/loader/icon/IconDatabase.cpp
r147975 r148034 30 30 #if ENABLE(ICONDATABASE) 31 31 32 #include "BitmapImage.h" 32 33 #include "DocumentLoader.h" 33 34 #include "FileSystem.h" … … 35 36 #include "IconRecord.h" 36 37 #include "Image.h" 38 #include "ImageBuffer.h" 37 39 #include "IntSize.h" 38 40 #include "Logging.h" … … 534 536 } 535 537 536 void IconDatabase::setIconDataForIconURL(PassRefPtr<SharedBuffer> dataOriginal, const String& iconURLOriginal) 537 { 538 ASSERT_NOT_SYNC_THREAD(); 539 540 // Cannot do anything with dataOriginal or iconURLOriginal that would end up storing them without deep copying first 541 542 if (!isOpen() || iconURLOriginal.isEmpty()) 543 return; 544 545 RefPtr<SharedBuffer> data = dataOriginal ? dataOriginal->copy() : PassRefPtr<SharedBuffer>(0); 546 if (data) 547 data->setMutexForVerifier(m_urlAndIconLock); 548 String iconURL = iconURLOriginal.isolatedCopy(); 549 538 void IconDatabase::updateIconRecord(PassRefPtr<SharedBuffer> iconData, PassRefPtr<Image> iconBitmap, const String& iconURL) 539 { 540 // Only one of iconData or iconBitmap should be provided, never both. 541 ASSERT(!iconData != !iconBitmap); 542 550 543 Vector<String> pageURLs; 551 544 { 552 545 MutexLocker locker(m_urlAndIconLock); 553 546 554 547 // If this icon was pending a read, remove it from that set because this new data should override what is on disk 555 548 RefPtr<IconRecord> icon = m_iconURLToRecordMap.get(iconURL); … … 559 552 } else 560 553 icon = getOrCreateIconRecord(iconURL); 561 562 // Update the data and set the time stamp 563 icon->setImageData(data.release()); 554 555 // Update the image and set the time stamp 556 if (iconData) 557 icon->setImageData(iconData); 558 else if (iconBitmap) 559 icon->setImage(iconBitmap); 564 560 icon->setTimestamp((int)currentTime()); 565 561 566 562 // Copy the current retaining pageURLs - if any - to notify them of the change 567 563 pageURLs.appendRange(icon->retainingPageURLs().begin(), icon->retainingPageURLs().end()); 568 564 569 565 // Mark the IconRecord as requiring an update to the database only if private browsing is disabled 570 566 if (!m_privateBrowsingEnabled) { … … 588 584 589 585 // Informal testing shows that draining the autorelease pool every 25 iterations is about as low as we can go 590 // before performance starts to drop off, but we don't want to increase this number because then accumulated memory usage will go up 586 // before performance starts to drop off, but we don't want to increase this number because then accumulated memory usage will go up 591 587 AutodrainedPool pool(25); 592 588 … … 598 594 } 599 595 } 596 } 597 598 void IconDatabase::setIconBitmapForIconURL(PassRefPtr<Image> imageOriginal, const String& iconURLOriginal) 599 { 600 ASSERT_NOT_SYNC_THREAD(); 601 ASSERT(imageOriginal->isBitmapImage()); 602 603 // Cannot do anything with imageOriginal or iconURLOriginal that would end up storing them without deep copying first 604 605 if (!isOpen() || iconURLOriginal.isEmpty()) 606 return; 607 608 RefPtr<Image> image; 609 if (imageOriginal) { 610 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(imageOriginal->size()); 611 GraphicsContext* context = imageBuffer->context(); 612 613 context->drawImage(imageOriginal.get(), ColorSpaceDeviceRGB, IntPoint()); 614 image = imageBuffer->copyImage(); 615 } 616 617 if (image) 618 image->setMutexForVerifier(m_urlAndIconLock); 619 620 String iconURL = iconURLOriginal.isolatedCopy(); 621 622 updateIconRecord(0, image.release(), iconURL); 623 } 624 625 void IconDatabase::setIconDataForIconURL(PassRefPtr<SharedBuffer> dataOriginal, const String& iconURLOriginal) 626 { 627 ASSERT_NOT_SYNC_THREAD(); 628 629 // Cannot do anything with dataOriginal or iconURLOriginal that would end up storing them without deep copying first 630 631 if (!isOpen() || iconURLOriginal.isEmpty()) 632 return; 633 634 RefPtr<SharedBuffer> data = dataOriginal ? dataOriginal->copy() : PassRefPtr<SharedBuffer>(0); 635 if (data) 636 data->setMutexForVerifier(m_urlAndIconLock); 637 638 String iconURL = iconURLOriginal.isolatedCopy(); 639 640 updateIconRecord(data.release(), 0, iconURL); 600 641 } 601 642 -
trunk/Source/WebCore/loader/icon/IconDatabase.h
r147622 r148034 94 94 virtual void retainIconForPageURL(const String&); 95 95 virtual void releaseIconForPageURL(const String&); 96 virtual void setIconDataForIconURL(PassRefPtr<SharedBuffer> data, const String&); 96 virtual void setIconDataForIconURL(PassRefPtr<SharedBuffer> data, const String&) OVERRIDE; 97 virtual void setIconBitmapForIconURL(PassRefPtr<Image>, const String&) OVERRIDE; 97 98 virtual void setIconURLForPageURL(const String& iconURL, const String& pageURL); 98 99 … … 129 130 void scheduleOrDeferSyncTimer(); 130 131 void syncTimerFired(Timer<IconDatabase>*); 132 133 void updateIconRecord(PassRefPtr<SharedBuffer>, PassRefPtr<Image>, const String&); 131 134 132 135 Timer<IconDatabase> m_syncTimer; -
trunk/Source/WebCore/loader/icon/IconDatabaseBase.h
r147622 r148034 27 27 #define IconDatabaseBase_h 28 28 29 #include "Image.h" 29 30 #include "ImageSource.h" 30 31 #include "SharedBuffer.h" … … 173 174 virtual void setIconURLForPageURL(const String&, const String&) { } 174 175 virtual void setIconDataForIconURL(PassRefPtr<SharedBuffer>, const String&) { } 176 virtual void setIconBitmapForIconURL(PassRefPtr<Image>, const String&) { } 175 177 176 178 // Synchronous calls used internally by WebCore. -
trunk/Source/WebCore/loader/icon/IconRecord.cpp
r65344 r148034 78 78 } 79 79 80 void IconRecord::setImage(PassRefPtr<Image> image) 81 { 82 m_image = image; 83 m_dataSet = true; 84 } 85 80 86 void IconRecord::loadImageFromResource(const char* resource) 81 87 { -
trunk/Source/WebCore/loader/icon/IconRecord.h
r127757 r148034 86 86 87 87 void setImageData(PassRefPtr<SharedBuffer> data); 88 void setImage(PassRefPtr<Image> data); 88 89 Image* image(const IntSize&); 89 90 -
trunk/Source/WebKit2/ChangeLog
r148025 r148034 1 2013-04-09 Tim Horton <timothy_horton@apple.com> 2 3 [wk2] IconDatabase images should be decoded in the WebProcess 4 https://bugs.webkit.org/show_bug.cgi?id=112524 5 <rdar://problem/10133914> 6 7 Reviewed by Oliver Hunt. 8 9 In the interests of keeping decoding of data coming in from the greater Internet 10 in the WebProcess, move decoding of favicons from the UIProcess to the WebProcess. 11 12 * UIProcess/WebIconDatabase.cpp: 13 (WebKit::WebIconDatabase::setIconBitmapForIconURL): 14 Receive a ShareableBitmap handle from the WebProcess instead of a DataReference. 15 Use the new setIconBitmapForIconURL IconDatabase method. 16 17 * UIProcess/WebIconDatabase.h: 18 (WebIconDatabase): 19 Rename setIconDataForIconURL to setIconBitmapForIconURL. 20 21 * UIProcess/WebIconDatabase.messages.in: Ditto. 22 23 * WebProcess/IconDatabase/WebIconDatabaseProxy.cpp: 24 (WebKit::WebIconDatabaseProxy::setIconDataForIconURL): 25 In the WebProcess, decode the incoming icon and draw it into a ShareableBitmap. 26 1 27 2013-04-09 Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> 2 28 -
trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp
r140607 r148034 122 122 } 123 123 124 void WebIconDatabase::setIcon DataForIconURL(const CoreIPC::DataReference& iconData, const String& iconURL)125 { 126 LOG(IconDatabase, "WK2 UIProcess setting icon data (%i bytes) for page URL %s", (int)iconData.size(), iconURL.ascii().data());124 void WebIconDatabase::setIconBitmapForIconURL(const ShareableBitmap::Handle& bitmapHandle, const String& iconURL) 125 { 126 LOG(IconDatabase, "WK2 UIProcess setting icon bitmap for page URL %s", iconURL.ascii().data()); 127 127 if (!m_iconDatabaseImpl) 128 128 return; 129 129 130 RefPtr<SharedBuffer> buffer = SharedBuffer::create(iconData.data(), iconData.size()); 131 m_iconDatabaseImpl->setIconDataForIconURL(buffer.release(), iconURL); 130 if (bitmapHandle.isNull()) { 131 m_iconDatabaseImpl->setIconBitmapForIconURL(0, iconURL); 132 return; 133 } 134 135 RefPtr<ShareableBitmap> iconBitmap = ShareableBitmap::create(bitmapHandle, SharedMemory::ReadOnly); 136 m_iconDatabaseImpl->setIconBitmapForIconURL(iconBitmap->createImage(), iconURL); 132 137 } 133 138 -
trunk/Source/WebKit2/UIProcess/WebIconDatabase.h
r147403 r148034 30 30 31 31 #include "Connection.h" 32 #include "ShareableBitmap.h" 32 33 #include "WebIconDatabaseClient.h" 33 34 #include <WebCore/IconDatabaseClient.h> … … 67 68 void releaseIconForPageURL(const String&); 68 69 void setIconURLForPageURL(const String&, const String&); 69 void setIcon DataForIconURL(const CoreIPC::DataReference&, const String&);70 void setIconBitmapForIconURL(const ShareableBitmap::Handle&, const String&); 70 71 71 72 void synchronousIconDataForPageURL(const String&, CoreIPC::DataReference&); -
trunk/Source/WebKit2/UIProcess/WebIconDatabase.messages.in
r140607 r148034 25 25 ReleaseIconForPageURL(WTF::String pageURL) 26 26 SetIconURLForPageURL(WTF::String iconURL, WTF::String pageURL) 27 SetIcon DataForIconURL(CoreIPC::DataReference iconData, WTF::String iconURL)27 SetIconBitmapForIconURL(WebKit::ShareableBitmap::Handle bitmapHandle, WTF::String iconURL) 28 28 29 29 SynchronousIconDataForPageURL(WTF::String pageURL) -> (CoreIPC::DataReference iconData) -
trunk/Source/WebKit2/WebProcess/IconDatabase/WebIconDatabaseProxy.cpp
r140607 r148034 31 31 #include "WebIconDatabaseProxyMessages.h" 32 32 #include "WebProcess.h" 33 #include <WebCore/BitmapImage.h> 34 #include <WebCore/GraphicsContext.h> 35 #include <WebCore/IntPoint.h> 33 36 #include <WebCore/SharedBuffer.h> 34 37 #include <wtf/text/WTFString.h> … … 136 139 void WebIconDatabaseProxy::setIconDataForIconURL(PassRefPtr<SharedBuffer> iconData, const String& iconURL) 137 140 { 138 CoreIPC::DataReference data(reinterpret_cast<const uint8_t*>(iconData ? iconData->data() : 0), iconData ? iconData->size() : 0); 139 m_process->connection()->send(Messages::WebIconDatabase::SetIconDataForIconURL(data, iconURL), 0); 141 RefPtr<Image> image = BitmapImage::create(); 142 ShareableBitmap::Handle handle; 143 144 if (image->setData(iconData, true) && !image->size().isEmpty()) { 145 RefPtr<ShareableBitmap> shareableBitmap = ShareableBitmap::createShareable(image->size(), ShareableBitmap::SupportsAlpha); 146 OwnPtr<GraphicsContext> bitmapContext = shareableBitmap->createGraphicsContext(); 147 bitmapContext->drawImage(image.get(), ColorSpaceDeviceRGB, IntPoint()); 148 149 shareableBitmap->createHandle(handle, SharedMemory::ReadOnly); 150 } 151 152 m_process->connection()->send(Messages::WebIconDatabase::SetIconBitmapForIconURL(handle, iconURL), 0); 140 153 } 141 154 -
trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm
r145477 r148034 346 346 m_pdfLayerController.get().delegate = 0; 347 347 348 if (webFrame() ) {348 if (webFrame() && webFrame()->coreFrame()) { 349 349 if (FrameView* frameView = webFrame()->coreFrame()->view()) 350 350 frameView->removeScrollableArea(this);
Note: See TracChangeset
for help on using the changeset viewer.