Changeset 156063 in webkit


Ignore:
Timestamp:
Sep 18, 2013 2:45:58 PM (11 years ago)
Author:
weinig@apple.com
Message:

Replace use of OwnArrayPtr<Foo> with std::unique_ptr<Foo[]> in WebKit and WebKit2
https://bugs.webkit.org/show_bug.cgi?id=121568

Reviewed by Andreas Kling.

../WebKit/win:

  • WebHistory.cpp:

(WebHistory::removeAllItems):
(WebHistory::orderedLastVisitedDays):
(WebHistory::addItemToDateCaches):
(WebHistory::removeItemFromDateCaches):

  • WebHistory.h:
  • WebPreferences.cpp:

(WebPreferences::copyWebKitPreferencesToCFPreferences):

../WebKit2:

  • Platform/CoreIPC/unix/ConnectionUnix.cpp:

(CoreIPC::Connection::processMessage):
(CoreIPC::readBytesFromSocket):
(CoreIPC::Connection::sendOutgoingMessage):

  • UIProcess/API/efl/EwkView.cpp:

(EwkView::feedTouchEvent):
(EwkView::feedTouchEvents):

  • UIProcess/API/efl/SnapshotImageGL.h:
  • UIProcess/API/efl/ewk_file_chooser_request.cpp:

(ewk_file_chooser_request_files_choose):

  • UIProcess/Launcher/efl/ProcessLauncherEfl.cpp:

(WebKit::createArgsArray):
(WebKit::ProcessLauncher::launchProcess):

  • WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:

(WKBundlePageCopyContextMenuItems):

  • WebProcess/InjectedBundle/InjectedBundle.cpp:
Location:
trunk/Source
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/win/ChangeLog

    r156051 r156063  
     12013-09-18  Sam Weinig  <sam@webkit.org>
     2
     3        Replace use of OwnArrayPtr<Foo> with std::unique_ptr<Foo[]> in WebKit and WebKit2
     4        https://bugs.webkit.org/show_bug.cgi?id=121568
     5
     6        Reviewed by Andreas Kling.
     7
     8        * WebHistory.cpp:
     9        (WebHistory::removeAllItems):
     10        (WebHistory::orderedLastVisitedDays):
     11        (WebHistory::addItemToDateCaches):
     12        (WebHistory::removeItemFromDateCaches):
     13        * WebHistory.h:
     14        * WebPreferences.cpp:
     15        (WebPreferences::copyWebKitPreferencesToCFPreferences):
     16
    1172013-09-18  Patrick Gansterer  <paroga@webkit.org>
    218
  • trunk/Source/WebKit/win/WebHistory.cpp

    r156051 r156063  
    241241{
    242242    m_entriesByDate.clear();
    243     m_orderedLastVisitedDays.clear();
     243    m_orderedLastVisitedDays = nullptr;
    244244
    245245    Vector<IWebHistoryItem*> itemsVector(m_entriesByURL.size());
     
    273273    *count = dateCount;
    274274    if (!m_orderedLastVisitedDays) {
    275         m_orderedLastVisitedDays = adoptArrayPtr(new DATE[dateCount]);
     275        m_orderedLastVisitedDays = std::make_unique<DATE[]>(dateCount);
    276276        DateToEntriesMap::const_iterator::Keys end = m_entriesByDate.end().keys();
    277277        int i = 0;
     
    584584        m_entriesByDate.set(dateKey, entryArray);
    585585        // Clear m_orderedLastVisitedDays so it will be regenerated when next requested.
    586         m_orderedLastVisitedDays.clear();
     586        m_orderedLastVisitedDays = nullptr;
    587587    }
    588588
     
    615615        m_entriesByDate.remove(found);
    616616        // Clear m_orderedLastVisitedDays so it will be regenerated when next requested.
    617         m_orderedLastVisitedDays.clear();
     617        m_orderedLastVisitedDays = nullptr;
    618618    }
    619619
  • trunk/Source/WebKit/win/WebHistory.h

    r156051 r156063  
    3030#include <CoreFoundation/CoreFoundation.h>
    3131#include <WebCore/COMPtr.h>
     32#include <memory>
    3233#include <wtf/Forward.h>
    33 #include <wtf/OwnArrayPtr.h>
    3434#include <wtf/RetainPtr.h>
    3535
     
    148148    URLToEntriesMap m_entriesByURL;
    149149    DateToEntriesMap m_entriesByDate;
    150     OwnArrayPtr<DATE> m_orderedLastVisitedDays;
     150    std::unique<DATE[]> m_orderedLastVisitedDays;
    151151    COMPtr<WebPreferences> m_preferences;
    152152};
  • trunk/Source/WebKit/win/WebPreferences.cpp

    r153628 r156063  
    4242#include <wchar.h>
    4343#include <wtf/HashMap.h>
    44 #include <wtf/OwnArrayPtr.h>
     44#include <wtf/StdLibExtras.h>
    4545#include <wtf/text/CString.h>
    4646#include <wtf/text/StringHash.h>
     
    478478    bool omitDefaults = !booleanValueForPreferencesValue(CFDictionaryGetValue(dict, didRemoveDefaultsKey));
    479479
    480     OwnArrayPtr<CFTypeRef> keys = adoptArrayPtr(new CFTypeRef[count]);
    481     OwnArrayPtr<CFTypeRef> values = adoptArrayPtr(new CFTypeRef[count]);
     480    auto keys = std::make_unique<CFTypeRef[]>(count);
     481    auto values = std::make_unique<CFTypeRef[]>(count);
    482482    CFDictionaryGetKeysAndValues(dict, keys.get(), values.get());
    483483
  • trunk/Source/WebKit2/ChangeLog

    r156056 r156063  
     12013-09-18  Sam Weinig  <sam@webkit.org>
     2
     3        Replace use of OwnArrayPtr<Foo> with std::unique_ptr<Foo[]> in WebKit and WebKit2
     4        https://bugs.webkit.org/show_bug.cgi?id=121568
     5
     6        Reviewed by Andreas Kling.
     7
     8        * Platform/CoreIPC/unix/ConnectionUnix.cpp:
     9        (CoreIPC::Connection::processMessage):
     10        (CoreIPC::readBytesFromSocket):
     11        (CoreIPC::Connection::sendOutgoingMessage):
     12        * UIProcess/API/efl/EwkView.cpp:
     13        (EwkView::feedTouchEvent):
     14        (EwkView::feedTouchEvents):
     15        * UIProcess/API/efl/SnapshotImageGL.h:
     16        * UIProcess/API/efl/ewk_file_chooser_request.cpp:
     17        (ewk_file_chooser_request_files_choose):
     18        * UIProcess/Launcher/efl/ProcessLauncherEfl.cpp:
     19        (WebKit::createArgsArray):
     20        (WebKit::ProcessLauncher::launchProcess):
     21        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
     22        (WKBundlePageCopyContextMenuItems):
     23        * WebProcess/InjectedBundle/InjectedBundle.cpp:
     24
    1252013-09-18  Anders Carlsson  <andersca@apple.com>
    226
  • trunk/Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp

    r155913 r156063  
    3737#include <wtf/Assertions.h>
    3838#include <wtf/Functional.h>
    39 #include <wtf/OwnArrayPtr.h>
     39#include <wtf/StdLibExtras.h>
    4040#include <wtf/UniStdExtras.h>
    4141
     
    214214    size_t attachmentFileDescriptorCount = 0;
    215215    size_t attachmentCount = messageInfo.attachmentCount();
    216     OwnArrayPtr<AttachmentInfo> attachmentInfo;
     216    std::unique_ptr<AttachmentInfo[]> attachmentInfo;
    217217
    218218    if (attachmentCount) {
    219         attachmentInfo = adoptArrayPtr(new AttachmentInfo[attachmentCount]);
     219        attachmentInfo = std::make_unique<AttachmentInfo[]>(attachmentCount);
    220220        memcpy(attachmentInfo.get(), messageData, sizeof(AttachmentInfo) * attachmentCount);
    221221        messageData += sizeof(AttachmentInfo) * attachmentCount;
     
    324324
    325325    message.msg_controllen = CMSG_SPACE(sizeof(int) * attachmentMaxAmount);
    326     OwnArrayPtr<char> attachmentDescriptorBuffer = adoptArrayPtr(new char[message.msg_controllen]);
     326    auto attachmentDescriptorBuffer = std::make_unique<char[]>(message.msg_controllen);
    327327    memset(attachmentDescriptorBuffer.get(), 0, message.msg_controllen);
    328328    message.msg_control = attachmentDescriptorBuffer.get();
     
    492492    iov[0].iov_len = sizeof(messageInfo);
    493493
    494     OwnArrayPtr<AttachmentInfo> attachmentInfo = adoptArrayPtr(new AttachmentInfo[attachments.size()]);
     494    auto attachmentInfo = std::make_unique<AttachmentInfo[]>(attachments.size());
    495495
    496496    size_t attachmentFDBufferLength = 0;
     
    501501        }
    502502    }
    503     OwnArrayPtr<char> attachmentFDBuffer = adoptArrayPtr(new char[CMSG_SPACE(sizeof(int) * attachmentFDBufferLength)]);
     503    auto attachmentFDBuffer = std::make_unique<char[]>(CMSG_SPACE(sizeof(int) * attachmentFDBufferLength));
    504504
    505505    if (!attachments.isEmpty()) {
  • trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp

    r155852 r156063  
    7979#include <WebKit2/WKImageCairo.h>
    8080#include <wtf/MathExtras.h>
     81#include <wtf/StdLibExtras.h>
    8182
    8283#if ENABLE(VIBRATION)
     
    753754{
    754755    unsigned length = eina_list_count(points);
    755     OwnArrayPtr<WKTypeRef> touchPoints = adoptArrayPtr(new WKTypeRef[length]);
     756    auto touchPoints = std::make_unique<WKTypeRef[]>(length);
    756757    for (unsigned i = 0; i < length; ++i) {
    757758        Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(eina_list_nth(points, i));
     
    13221323        return;
    13231324
    1324     OwnArrayPtr<WKTypeRef> touchPoints = adoptArrayPtr(new WKTypeRef[length]);
     1325    auto touchPoints = std::make_unique<WKTypeRef[]>(length);
    13251326    for (unsigned i = 0; i < length; ++i) {
    13261327        int x, y;
  • trunk/Source/WebKit2/UIProcess/API/efl/SnapshotImageGL.h

    r147792 r156063  
    3030
    3131#include <RefPtrCairo.h>
    32 #include <wtf/OwnArrayPtr.h>
    3332
    3433PassRefPtr<cairo_surface_t> getImageSurfaceFromFrameBuffer(int x, int y, int width, int height);
  • trunk/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request.cpp

    r141709 r156063  
    3434#include "WKURL.h"
    3535#include "ewk_file_chooser_request_private.h"
    36 #include <wtf/OwnArrayPtr.h>
     36#include <wtf/StdLibExtras.h>
    3737#include <wtf/text/CString.h>
    3838
     
    121121    EINA_SAFETY_ON_FALSE_RETURN_VAL(urlCount == 1 || (urlCount > 1 && impl->allowMultipleFiles()), false);
    122122
    123     OwnArrayPtr<WKTypeRef> filesURLs = adoptArrayPtr(new WKTypeRef[urlCount]);
     123    auto filesURLs = std::make_unique<WKTypeRef[]>(urlCount);
    124124
    125125    for (unsigned i = 0; i < urlCount; ++i) {
  • trunk/Source/WebKit2/UIProcess/Launcher/efl/ProcessLauncherEfl.cpp

    r155934 r156063  
    2929#include <WebCore/ResourceHandle.h>
    3030#include <WebCore/RunLoop.h>
    31 #include <wtf/OwnArrayPtr.h>
     31#include <wtf/StdLibExtras.h>
    3232#include <wtf/text/CString.h>
    3333#include <wtf/text/WTFString.h>
     
    3737namespace WebKit {
    3838
    39 static Vector<OwnArrayPtr<char>> createArgsArray(const String& prefix, const String& executablePath, const String& socket, const String& pluginPath)
     39static Vector<std::unique_ptr<char[]>> createArgsArray(const String& prefix, const String& executablePath, const String& socket, const String& pluginPath)
    4040{
    4141    ASSERT(!executablePath.isEmpty());
     
    5050        splitArgs.append(pluginPath);
    5151
    52     Vector<OwnArrayPtr<char>> args;
     52    Vector<std::unique_ptr<char[]>> args;
    5353    args.resize(splitArgs.size() + 1); // Extra room for null.
    5454
     
    5656    for (size_t i = 0; i < numArgs; ++i) {
    5757        CString param = splitArgs[i].utf8();
    58         args[i] = adoptArrayPtr(new char[param.length() + 1]); // Room for the terminating null coming from the CString.
     58        args[i] = std::make_unique<char[]>(param.length() + 1); // Room for the terminating null coming from the CString.
    5959        strncpy(args[i].get(), param.data(), param.length() + 1); // +1 here so that strncpy copies the ending null.
    6060    }
     
    9898        processCmdPrefix = m_launchOptions.processCmdPrefix;
    9999#endif
    100     Vector<OwnArrayPtr<char>> args = createArgsArray(processCmdPrefix, executablePath, String::number(sockets[0]), pluginPath);
     100    auto args = createArgsArray(processCmdPrefix, executablePath, String::number(sockets[0]), pluginPath);
    101101
    102102    // Do not perform memory allocation in the middle of the fork()
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp

    r155847 r156063  
    5353#include <WebCore/KURL.h>
    5454#include <WebCore/Page.h>
    55 #include <wtf/OwnArrayPtr.h>
     55#include <wtf/StdLibExtras.h>
    5656
    5757using namespace WebKit;
     
    160160#if ENABLE(CONTEXT_MENUS)
    161161    WebContextMenu* contextMenu = toImpl(pageRef)->contextMenu();
    162     const Vector<WebContextMenuItemData> &items = contextMenu->items();
     162    const Vector<WebContextMenuItemData>& items = contextMenu->items();
    163163    size_t arrayLength = items.size();
    164164
    165     OwnArrayPtr<WKTypeRef> wkItems = adoptArrayPtr(new WKTypeRef[arrayLength]);
     165    auto wkItems = std::make_unique<WKTypeRef[]>(arrayLength);
    166166    for (size_t i = 0; i < arrayLength; ++i)
    167167        wkItems[i] = toAPI(WebContextMenuItem::create(items[i]).leakRef());
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp

    r155262 r156063  
    7070#include <WebCore/Settings.h>
    7171#include <WebCore/UserGestureIndicator.h>
    72 #include <wtf/OwnArrayPtr.h>
    7372
    7473#if ENABLE(SHADOW_DOM) || ENABLE(CSS_REGIONS) || ENABLE(IFRAME_SEAMLESS) || ENABLE(CSS_COMPOSITING)
Note: See TracChangeset for help on using the changeset viewer.