2011-02-06 Ryosuke Niwa <rniwa@webkit.org>
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Feb 2011 05:01:30 +0000 (05:01 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Feb 2011 05:01:30 +0000 (05:01 +0000)
        Reviewed by Darin Adler.

        OwnArraryPtr.h uses deleteOwnedPtr but doesn’t include OwnPtrCommon.h
        https://bugs.webkit.org/show_bug.cgi?id=52867

        * DumpRenderTree/chromium/ImageDiff.cpp:
        (Image::craeteFromStdin): Call adoptArrayPtr.
2011-02-06  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Darin Adler.

        OwnArraryPtr.h uses deleteOwnedPtr but doesn’t include OwnPtrCommon.h
        https://bugs.webkit.org/show_bug.cgi?id=52867

        Removed LOOSE_OWN_ARRAY_PTR and OwnArrayPtr<T>::set. Replaced all calls to OwnArrayPtr::set
        and loose instantiation of OwnArrayPtr by calls to operator= and adoptArrayPtr. Also removed
        OwnArrayPtrCommon.h since PassOwnArrayPtr.h needs to include OwnArrayPtr.h and there is
        no point in putting deleteOwnedArrayPtr into a separate header.

        Note: if this patch breaks build, the code is either instiantiating OwnArrayPtr
        without calling adoptArrayPtr or calling set on ArrayOwnPtr instead of operator=.

        No tests are added since this is a refactoring.

        * API/JSStringRefCF.cpp:
        (JSStringCreateWithCFString): Calls adoptArrayPtr.
        * GNUmakefile.am: Removed OwnArrayPtrCommon.h
        * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto.
        * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
        * runtime/Arguments.cpp:
        (JSC::Arguments::deleteProperty): Calls adoptArrayPtr.
        * runtime/Arguments.h:
        (JSC::Arguments::copyRegisters): Ditto.
        * runtime/JSPropertyNameIterator.cpp:
        (JSC::JSPropertyNameIterator::JSPropertyNameIterator): Ditto.
        * runtime/JSVariableObject.h:
        (JSC::JSVariableObject::setRegisters): Calls operator= instead of set.
        * runtime/StructureChain.cpp:
        (JSC::StructureChain::StructureChain): Ditto.
        * wtf/CMakeLists.txt:
        * wtf/DateMath.h:
        (JSC::GregorianDateTime::GregorianDateTime): No longer instnatiates OwnArrayPtr
        with a null pointer.
        * wtf/OwnArrayPtr.h:
        * wtf/OwnArrayPtrCommon.h: Removed.
        * wtf/PassOwnArrayPtr.h: No longer includes OwnArrayCommon.h
        (WTF::deleteOwnedArrayPtr): Moved from OwnArrayPtrCommon.h
2011-02-06  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Darin Adler.

        OwnArraryPtr.h uses deleteOwnedPtr but doesn’t include OwnPtrCommon.h
        https://bugs.webkit.org/show_bug.cgi?id=52867

        * ForwardingHeaders/wtf/OwnArrayPtrCommon.h: Removed.
2011-02-06  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Darin Adler.

        OwnArraryPtr.h uses deleteOwnedPtr but doesn’t include OwnPtrCommon.h
        https://bugs.webkit.org/show_bug.cgi?id=52867

        * WebHistory.cpp:
        (WebHistory::orderedLastVisitedDays): Calls adoptArrayPtr.
        * WebPreferences.cpp:
        (WebPreferences::copyWebKitPreferencesToCFPreferences): Ditto.
2011-02-06  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Darin Adler.

        OwnArraryPtr.h uses deleteOwnedPtr but doesn’t include OwnPtrCommon.h
        https://bugs.webkit.org/show_bug.cgi?id=52867

        * ForwardingHeaders/wtf/OwnArrayPtrCommon.h: Removed.
        * bindings/v8/NPV8Object.cpp:
        (WebCore::createValueListFromVariantArgs): Returns PassOwnArrayPtr<v8::Handle<v8::Value>> instead of
        v8::Handle<v8::Value>*.
        (_NPN_Invoke): Calls createValueListFromVariantArgs.
        (_NPN_InvokeDefault): createValueListFromVariantArgs.
        (_NPN_Construct): createValueListFromVariantArgs.
        * bindings/v8/ScriptFunctionCall.cpp:
        (WebCore::ScriptFunctionCall::call): Calls adoptArrayPtr.
        (WebCore::ScriptFunctionCall::construct): Ditto.
        (WebCore::ScriptCallback::call):
        * bindings/v8/V8DOMWindowShell.cpp:
        (WebCore::V8DOMWindowShell::createNewContext): Ditto.
        * bindings/v8/V8NPObject.cpp:
        (WebCore::npObjectInvokeImpl): Ditto
        * bindings/v8/V8NodeFilterCondition.cpp:
        (WebCore::V8NodeFilterCondition::acceptNode): Ditto,
        * html/HTMLAreaElement.cpp:
        (WebCore::HTMLAreaElement::parseMappedAttribute): Calls newCoordsArray.
        * html/HTMLFrameSetElement.cpp:
        (WebCore::HTMLFrameSetElement::parseMappedAttribute): Calls newLengthArray.
        * html/canvas/WebGLRenderingContext.cpp:
        (WebCore::WebGLRenderingContext::getAttachedShaders): Calls adoptArraYptr.
        (WebCore::WebGLRenderingContext::simulateVertexAttrib0): Ditto.
        (WebCore::WebGLRenderingContext::LRUImageBufferCache::LRUImageBufferCache): Dito.
        * platform/Length.cpp:
        (WebCore::newCoordsArray): Returns PassOwnArrayPtr<Length> instead of Length*.
        (WebCore::newLengthArray): Returns PassOwnArrayPtr<Length> instead of Length*.
        * platform/Length.h: Prototype changes.
        * platform/graphics/ANGLEWebKitBridge.cpp:
        (WebCore::ANGLEWebKitBridge::validateShaderSource): Calls adoptArrayPtr.
        * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
        (WebCore::getDirtyRects): Ditto.
        * platform/graphics/chromium/ComplexTextControllerLinux.cpp:
        (WebCore::ComplexTextController::getNormalizedTextRun): Ditto.
        * platform/graphics/chromium/HarfbuzzSkia.cpp:
        (WebCore::glyphsToAdvances): Ditto.
        (WebCore::canRender): Ditto.
        * platform/graphics/gpu/Texture.cpp:
        (WebCore::Texture::updateSubRect): Ditto.
        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
        (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas): Ditto.
        * platform/graphics/skia/PlatformContextSkia.cpp:
        (WebCore::PlatformContextSkia::readbackHardwareToSoftware): Ditto.
        * platform/graphics/wince/SharedBitmap.cpp:
        (WebCore::SharedBitmap::to16bit): Ditto.
        * platform/win/ContextMenuWin.cpp:
        (WebCore::ContextMenu::getContextMenuItems): Ditto.
        * platform/win/LoggingWin.cpp:
        (WebCore::initializeWithUserDefault): Ditto.
        * plugins/win/PluginPackageWin.cpp:
        (WebCore::PluginPackage::fetchInfo): Ditto.
2011-02-06  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Darin Adler.

        OwnArraryPtr.h uses deleteOwnedPtr but doesn’t include OwnPtrCommon.h
        https://bugs.webkit.org/show_bug.cgi?id=52867

        * Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp:
        (WebKit::NetscapePluginModule::getPluginInfo): Calls adoptArrayPtr.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77785 268f45cc-cd09-0410-ab3c-d52691b4dbfc

47 files changed:
Source/JavaScriptCore/API/JSStringRefCF.cpp
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/GNUmakefile.am
Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/runtime/Arguments.cpp
Source/JavaScriptCore/runtime/Arguments.h
Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
Source/JavaScriptCore/runtime/JSVariableObject.h
Source/JavaScriptCore/runtime/StructureChain.cpp
Source/JavaScriptCore/wtf/CMakeLists.txt
Source/JavaScriptCore/wtf/DateMath.h
Source/JavaScriptCore/wtf/OwnArrayPtr.h
Source/JavaScriptCore/wtf/OwnArrayPtrCommon.h [deleted file]
Source/JavaScriptCore/wtf/PassOwnArrayPtr.h
Source/JavaScriptGlue/ChangeLog
Source/JavaScriptGlue/ForwardingHeaders/wtf/OwnArrayPtrCommon.h [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/ForwardingHeaders/wtf/OwnArrayPtrCommon.h [deleted file]
Source/WebCore/bindings/v8/NPV8Object.cpp
Source/WebCore/bindings/v8/ScriptFunctionCall.cpp
Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
Source/WebCore/bindings/v8/V8NPObject.cpp
Source/WebCore/bindings/v8/V8NodeFilterCondition.cpp
Source/WebCore/html/HTMLAreaElement.cpp
Source/WebCore/html/HTMLFrameSetElement.cpp
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/platform/Length.cpp
Source/WebCore/platform/Length.h
Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp
Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp
Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.cpp
Source/WebCore/platform/graphics/chromium/HarfbuzzSkia.cpp
Source/WebCore/platform/graphics/gpu/Texture.cpp
Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
Source/WebCore/platform/graphics/wince/SharedBitmap.cpp
Source/WebCore/platform/win/ContextMenuWin.cpp
Source/WebCore/platform/win/LoggingWin.cpp
Source/WebCore/plugins/win/PluginPackageWin.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebHistory.cpp
Source/WebKit/win/WebPreferences.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp
Tools/ChangeLog
Tools/DumpRenderTree/chromium/ImageDiff.cpp

index e0961d09b175193de3261449d059801c5dc0d7b4..0877a13e60b2786680b6d9cd8537c591e0b2ef58 100644 (file)
@@ -42,7 +42,7 @@ JSStringRef JSStringCreateWithCFString(CFStringRef string)
     // it can hold.  (<rdar://problem/6806478>)
     size_t length = CFStringGetLength(string);
     if (length) {
-        OwnArrayPtr<UniChar> buffer(new UniChar[length]);
+        OwnArrayPtr<UniChar> buffer = adoptArrayPtr(new UniChar[length]);
         CFStringGetCharacters(string, CFRangeMake(0, length), buffer.get());
         COMPILE_ASSERT(sizeof(UniChar) == sizeof(UChar), unichar_and_uchar_must_be_same_size);
         return OpaqueJSString::create(reinterpret_cast<UChar*>(buffer.get()), length).leakRef();
index 3fe0e8bb7beb56e861ff5cbe8661fbabf3bbc879..e23e39b7304fde2be8488d3b08b4fa45da1c07f7 100644 (file)
@@ -1,3 +1,44 @@
+2011-02-06  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Reviewed by Darin Adler.
+
+        OwnArraryPtr.h uses deleteOwnedPtr but doesn’t include OwnPtrCommon.h
+        https://bugs.webkit.org/show_bug.cgi?id=52867
+
+        Removed LOOSE_OWN_ARRAY_PTR and OwnArrayPtr<T>::set. Replaced all calls to OwnArrayPtr::set
+        and loose instantiation of OwnArrayPtr by calls to operator= and adoptArrayPtr. Also removed
+        OwnArrayPtrCommon.h since PassOwnArrayPtr.h needs to include OwnArrayPtr.h and there is
+        no point in putting deleteOwnedArrayPtr into a separate header.
+        
+        Note: if this patch breaks build, the code is either instiantiating OwnArrayPtr
+        without calling adoptArrayPtr or calling set on ArrayOwnPtr instead of operator=.
+
+        No tests are added since this is a refactoring.
+
+        * API/JSStringRefCF.cpp:
+        (JSStringCreateWithCFString): Calls adoptArrayPtr.
+        * GNUmakefile.am: Removed OwnArrayPtrCommon.h
+        * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto.
+        * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+        * runtime/Arguments.cpp:
+        (JSC::Arguments::deleteProperty): Calls adoptArrayPtr.
+        * runtime/Arguments.h:
+        (JSC::Arguments::copyRegisters): Ditto.
+        * runtime/JSPropertyNameIterator.cpp:
+        (JSC::JSPropertyNameIterator::JSPropertyNameIterator): Ditto.
+        * runtime/JSVariableObject.h:
+        (JSC::JSVariableObject::setRegisters): Calls operator= instead of set.
+        * runtime/StructureChain.cpp:
+        (JSC::StructureChain::StructureChain): Ditto.
+        * wtf/CMakeLists.txt:
+        * wtf/DateMath.h:
+        (JSC::GregorianDateTime::GregorianDateTime): No longer instnatiates OwnArrayPtr
+        with a null pointer.
+        * wtf/OwnArrayPtr.h:
+        * wtf/OwnArrayPtrCommon.h: Removed.
+        * wtf/PassOwnArrayPtr.h: No longer includes OwnArrayCommon.h
+        (WTF::deleteOwnedArrayPtr): Moved from OwnArrayPtrCommon.h
+
 2011-02-06  Antti Koivisto  <antti@apple.com>
 
         Reviewed by Maciej Stachowiak.
index e48fdce69bcb13660643022e0bc1d5c4f48b8b1c..52d6b69b5e981c81c939a653ca5191efa3d9a2a5 100644 (file)
@@ -493,7 +493,6 @@ javascriptcore_sources += \
        Source/JavaScriptCore/wtf/OSAllocator.h \
        Source/JavaScriptCore/wtf/OwnArrayPtr.h \
        Source/JavaScriptCore/wtf/OwnFastMallocPtr.h \
-       Source/JavaScriptCore/wtf/OwnArrayPtrCommon.h \
        Source/JavaScriptCore/wtf/OwnPtrCommon.h \
        Source/JavaScriptCore/wtf/OwnPtr.h \
        Source/JavaScriptCore/wtf/PageAllocation.h \
index d2b81a847e461aa6cb763472acd51e9b888dbe1b..7820d135425509df903947b93ca0f19977c9949c 100644 (file)
                        RelativePath="..\..\wtf\OwnArrayPtr.h"
                        >
                </File>
-               <File
-                       RelativePath="..\..\wtf\OwnArrayPtrCommon.h"
-                       >
-               </File>
                <File
                        RelativePath="..\..\wtf\OwnFastMallocPtr.h"
                        >
index de6106cab704d9fc25fd74b9cc5fe96b44befa6d..3bd390b851f4de0af375ea35d56d790d62ef94f7 100644 (file)
                BCDE3B430E6C832D001453A7 /* Structure.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCDE3AB00E6C82CF001453A7 /* Structure.cpp */; };
                BCF605140E203EF800B9A64D /* ArgList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF605120E203EF800B9A64D /* ArgList.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCFBE696122560E800309E9D /* PassOwnArrayPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFBE695122560E800309E9D /* PassOwnArrayPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               BCFBE698122561D200309E9D /* OwnArrayPtrCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFBE697122561D200309E9D /* OwnArrayPtrCommon.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCFD8C920EEB2EE700283848 /* JumpTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCFD8C900EEB2EE700283848 /* JumpTable.cpp */; };
                BCFD8C930EEB2EE700283848 /* JumpTable.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFD8C910EEB2EE700283848 /* JumpTable.h */; };
                C0A272630E50A06300E96E15 /* NotFound.h in Headers */ = {isa = PBXBuildFile; fileRef = C0A2723F0E509F1E00E96E15 /* NotFound.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCF605120E203EF800B9A64D /* ArgList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArgList.h; sourceTree = "<group>"; };
                BCF6553B0A2048DE0038A194 /* MathExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MathExtras.h; sourceTree = "<group>"; };
                BCFBE695122560E800309E9D /* PassOwnArrayPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassOwnArrayPtr.h; sourceTree = "<group>"; };
-               BCFBE697122561D200309E9D /* OwnArrayPtrCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnArrayPtrCommon.h; sourceTree = "<group>"; };
                BCFD8C900EEB2EE700283848 /* JumpTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JumpTable.cpp; sourceTree = "<group>"; };
                BCFD8C910EEB2EE700283848 /* JumpTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JumpTable.h; sourceTree = "<group>"; };
                C0A2723F0E509F1E00E96E15 /* NotFound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotFound.h; sourceTree = "<group>"; };
                                1400067612A6F7830064D123 /* OSAllocator.h */,
                                1400069212A6F9E10064D123 /* OSAllocatorPosix.cpp */,
                                9303F5A409911A5800AD71B8 /* OwnArrayPtr.h */,
-                               BCFBE697122561D200309E9D /* OwnArrayPtrCommon.h */,
                                0BDFFAD10FC616EC00D69EF4 /* OwnFastMallocPtr.h */,
                                9303F567099118FA00AD71B8 /* OwnPtr.h */,
                                440B7AED0FAF7FCB0073323E /* OwnPtrCommon.h */,
                                BC18C4480E16F5CD00B34460 /* Operations.h in Headers */,
                                1400067712A6F7830064D123 /* OSAllocator.h in Headers */,
                                BC18C4490E16F5CD00B34460 /* OwnArrayPtr.h in Headers */,
-                               BCFBE698122561D200309E9D /* OwnArrayPtrCommon.h in Headers */,
                                0BDFFAE10FC6193100D69EF4 /* OwnFastMallocPtr.h in Headers */,
                                BC18C44A0E16F5CD00B34460 /* OwnPtr.h in Headers */,
                                4409D8470FAF80A200523B87 /* OwnPtrCommon.h in Headers */,
index f6afec7dda2439648f4ff097149a565e7fee13ec..96a1d334884adeca087b0b2a7d5e5d7423c3ce9a 100644 (file)
@@ -303,7 +303,7 @@ bool Arguments::deleteProperty(ExecState* exec, unsigned i)
 {
     if (i < d->numArguments) {
         if (!d->deletedArguments) {
-            d->deletedArguments.set(new bool[d->numArguments]);
+            d->deletedArguments = adoptArrayPtr(new bool[d->numArguments]);
             memset(d->deletedArguments.get(), 0, sizeof(bool) * d->numArguments);
         }
         if (!d->deletedArguments[i]) {
@@ -321,7 +321,7 @@ bool Arguments::deleteProperty(ExecState* exec, const Identifier& propertyName)
     unsigned i = propertyName.toArrayIndex(isArrayIndex);
     if (isArrayIndex && i < d->numArguments) {
         if (!d->deletedArguments) {
-            d->deletedArguments.set(new bool[d->numArguments]);
+            d->deletedArguments = adoptArrayPtr(new bool[d->numArguments]);
             memset(d->deletedArguments.get(), 0, sizeof(bool) * d->numArguments);
         }
         if (!d->deletedArguments[i]) {
index a3d7fe45794c32c92b1784d1198a1043d83ff98d..624a856180bbd722b4a6dfe8265e3b6d6cf70a85 100644 (file)
@@ -226,10 +226,10 @@ namespace JSC {
         int registerOffset = d->numParameters + RegisterFile::CallFrameHeaderSize;
         size_t registerArraySize = d->numParameters;
 
-        Register* registerArray = new Register[registerArraySize];
-        memcpy(registerArray, d->registers - registerOffset, registerArraySize * sizeof(Register));
-        d->registerArray.set(registerArray);
-        d->registers = registerArray + registerOffset;
+        OwnArrayPtr<Register> registerArray = adoptArrayPtr(new Register[registerArraySize]);
+        memcpy(registerArray.get(), d->registers - registerOffset, registerArraySize * sizeof(Register));
+        d->registers = registerArray.get() + registerOffset;
+        d->registerArray = registerArray.release();
     }
 
     // This JSActivation function is defined here so it can get at Arguments::setRegisters.
index d08d8fe804cb3631fbd830de48a9c35526cb6a5b..6fd28e3fafb56195eba78ce03cb1122cdc380fd4 100644 (file)
@@ -40,7 +40,7 @@ inline JSPropertyNameIterator::JSPropertyNameIterator(ExecState* exec, PropertyN
     , m_cachedStructure(0)
     , m_numCacheableSlots(numCacheableSlots)
     , m_jsStringsSize(propertyNameArrayData->propertyNameVector().size())
-    , m_jsStrings(new WriteBarrier<Unknown>[m_jsStringsSize])
+    , m_jsStrings(adoptArrayPtr(new WriteBarrier<Unknown>[m_jsStringsSize]))
 {
     PropertyNameArrayData::PropertyNameVector& propertyNameVector = propertyNameArrayData->propertyNameVector();
     for (size_t i = 0; i < m_jsStringsSize; ++i)
index 3f2e2187fa0713f71164fe26905897ddec0d0db1..3729853ab2d1b39b46ac74b58fb6134a6adce006 100644 (file)
@@ -160,7 +160,7 @@ namespace JSC {
     inline void JSVariableObject::setRegisters(Register* registers, Register* registerArray)
     {
         ASSERT(registerArray != d->registerArray.get());
-        d->registerArray.set(registerArray);
+        d->registerArray = adoptArrayPtr(registerArray);
         d->registers = registers;
     }
 
index 085876c496b54ea5d5f0a072b1f07fd88677e65d..e4523c3a6893d5ddb6d9fe58573e94ace958d95b 100644 (file)
@@ -38,7 +38,7 @@ StructureChain::StructureChain(Structure* head)
     for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure())
         ++size;
     
-    m_vector.set(new RefPtr<Structure>[size + 1]);
+    m_vector = adoptArrayPtr(new RefPtr<Structure>[size + 1]);
 
     size_t i = 0;
     for (Structure* current = head; current; current = current->storedPrototype().isNull() ? 0 : asObject(current->storedPrototype())->structure())
index 764a898997edf56dfe1b11dab0cbc276b2d4eaeb..381eab7d31b6fe5684b866d6f92af006e51cca2d 100644 (file)
@@ -42,7 +42,6 @@ SET(WTF_HEADERS
     NullPtr.h
     OSAllocator.h
     OwnArrayPtr.h
-    OwnArrayPtrCommon.h
     OwnFastMallocPtr.h
     OwnPtr.h
     OwnPtrCommon.h
index 41bd4fa311bf8f418d0a0419cd152f207913b117..2ac284e7d8e15985d62e3342a95f87cdfae57376 100644 (file)
@@ -135,7 +135,6 @@ public:
         , year(0)
         , isDST(0)
         , utcOffset(0)
-        , timeZone(0)
     {
     }
 
index f838a7e672b1b0b8d22cccb9504747f5e49d06cf..6b7c8da13ddc6acf2fcdc8b3ba074031a6f5b897 100644 (file)
 #include "Assertions.h"
 #include "Noncopyable.h"
 #include "NullPtr.h"
-#include "OwnPtrCommon.h"
-#include "OwnArrayPtrCommon.h"
+#include "PassOwnArrayPtr.h"
 #include <algorithm>
 
-// Remove this once we make all WebKit code compatible with stricter rules about OwnArrayPtr.
-#define LOOSE_OWN_ARRAY_PTR
-
 namespace WTF {
 
 template<typename T> class PassOwnArrayPtr;
@@ -115,16 +111,6 @@ template<typename T> inline typename OwnArrayPtr<T>::PtrType OwnArrayPtr<T>::lea
     return ptr;
 }
 
-#ifdef LOOSE_OWN_ARRAY_PTR
-template<typename T> inline void OwnArrayPtr<T>::set(PtrType ptr)
-{
-    ASSERT(!ptr || m_ptr != ptr);
-    PtrType oldPtr = m_ptr;
-    m_ptr = ptr;
-    deleteOwnedPtr(oldPtr);
-}
-#endif
-
 template<typename T> inline OwnArrayPtr<T>& OwnArrayPtr<T>::operator=(const PassOwnArrayPtr<T>& o)
 {
     PtrType ptr = m_ptr;
diff --git a/Source/JavaScriptCore/wtf/OwnArrayPtrCommon.h b/Source/JavaScriptCore/wtf/OwnArrayPtrCommon.h
deleted file mode 100644 (file)
index 0113aff..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WTF_OwnArrayPtrCommon_h
-#define WTF_OwnArrayPtrCommon_h
-
-namespace WTF {
-
-template<typename T> inline void deleteOwnedArrayPtr(T* ptr)
-{
-    typedef char known[sizeof(T) ? 1 : -1];
-    if (sizeof(known))
-        delete [] ptr;
-}
-
-} // namespace WTF
-
-#endif // WTF_OwnArrayPtrCommon_h
index 499e850eb640e6e70264492611c63f28f550886e..e1aa61e4917999beac80a1cd2bce017ce4b1b3ce 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "Assertions.h"
 #include "NullPtr.h"
-#include "OwnArrayPtrCommon.h"
 #include "TypeTraits.h"
 
 // Remove this once we make all WebKit code compatible with stricter rules about PassOwnArrayPtr.
@@ -39,6 +38,7 @@ namespace WTF {
 template<typename T> class OwnArrayPtr;
 template<typename T> class PassOwnArrayPtr;
 template<typename T> PassOwnArrayPtr<T> adoptArrayPtr(T*);
+template<typename T> void deleteOwnedArrayPtr(T* ptr);
 
 template<typename T> class PassOwnArrayPtr {
 public:
@@ -194,6 +194,13 @@ template<typename T> inline PassOwnArrayPtr<T> adoptArrayPtr(T* ptr)
     return PassOwnArrayPtr<T>(ptr);
 }
 
+template<typename T> inline void deleteOwnedArrayPtr(T* ptr)
+{
+    typedef char known[sizeof(T) ? 1 : -1];
+    if (sizeof(known))
+        delete [] ptr;
+}
+
 template<typename T, typename U> inline PassOwnArrayPtr<T> static_pointer_cast(const PassOwnArrayPtr<U>& p) 
 {
     return adoptArrayPtr(static_cast<T*>(p.leakPtr()));
index a4ef6d7f1645e74f054a4f6c692df161d0168045..0fad3139c3a90c5b530d837fe32c91c744f0c893 100644 (file)
@@ -1,3 +1,12 @@
+2011-02-06  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Reviewed by Darin Adler.
+
+        OwnArraryPtr.h uses deleteOwnedPtr but doesn’t include OwnPtrCommon.h
+        https://bugs.webkit.org/show_bug.cgi?id=52867
+
+        * ForwardingHeaders/wtf/OwnArrayPtrCommon.h: Removed.
+
 2011-01-31  Oliver Hunt  <oliver@apple.com>
 
         Convert markstack to a slot visitor API
diff --git a/Source/JavaScriptGlue/ForwardingHeaders/wtf/OwnArrayPtrCommon.h b/Source/JavaScriptGlue/ForwardingHeaders/wtf/OwnArrayPtrCommon.h
deleted file mode 100644 (file)
index 0a226f0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <JavaScriptCore/OwnArrayPtrCommon.h>
index 0e3dea0564c625e5872f7dc01214c99c805e793f..c0180507bf3639b5d979f6a27573f054f23284e3 100644 (file)
@@ -1,3 +1,63 @@
+2011-02-06  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Reviewed by Darin Adler.
+
+        OwnArraryPtr.h uses deleteOwnedPtr but doesn’t include OwnPtrCommon.h
+        https://bugs.webkit.org/show_bug.cgi?id=52867
+
+        * ForwardingHeaders/wtf/OwnArrayPtrCommon.h: Removed.
+        * bindings/v8/NPV8Object.cpp:
+        (WebCore::createValueListFromVariantArgs): Returns PassOwnArrayPtr<v8::Handle<v8::Value>> instead of
+        v8::Handle<v8::Value>*.
+        (_NPN_Invoke): Calls createValueListFromVariantArgs.
+        (_NPN_InvokeDefault): createValueListFromVariantArgs.
+        (_NPN_Construct): createValueListFromVariantArgs.
+        * bindings/v8/ScriptFunctionCall.cpp:
+        (WebCore::ScriptFunctionCall::call): Calls adoptArrayPtr.
+        (WebCore::ScriptFunctionCall::construct): Ditto.
+        (WebCore::ScriptCallback::call):
+        * bindings/v8/V8DOMWindowShell.cpp:
+        (WebCore::V8DOMWindowShell::createNewContext): Ditto.
+        * bindings/v8/V8NPObject.cpp:
+        (WebCore::npObjectInvokeImpl): Ditto
+        * bindings/v8/V8NodeFilterCondition.cpp:
+        (WebCore::V8NodeFilterCondition::acceptNode): Ditto,
+        * html/HTMLAreaElement.cpp:
+        (WebCore::HTMLAreaElement::parseMappedAttribute): Calls newCoordsArray.
+        * html/HTMLFrameSetElement.cpp:
+        (WebCore::HTMLFrameSetElement::parseMappedAttribute): Calls newLengthArray.
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::getAttachedShaders): Calls adoptArraYptr.
+        (WebCore::WebGLRenderingContext::simulateVertexAttrib0): Ditto.
+        (WebCore::WebGLRenderingContext::LRUImageBufferCache::LRUImageBufferCache): Dito.
+        * platform/Length.cpp:
+        (WebCore::newCoordsArray): Returns PassOwnArrayPtr<Length> instead of Length*.
+        (WebCore::newLengthArray): Returns PassOwnArrayPtr<Length> instead of Length*.
+        * platform/Length.h: Prototype changes.
+        * platform/graphics/ANGLEWebKitBridge.cpp:
+        (WebCore::ANGLEWebKitBridge::validateShaderSource): Calls adoptArrayPtr.
+        * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
+        (WebCore::getDirtyRects): Ditto.
+        * platform/graphics/chromium/ComplexTextControllerLinux.cpp:
+        (WebCore::ComplexTextController::getNormalizedTextRun): Ditto.
+        * platform/graphics/chromium/HarfbuzzSkia.cpp:
+        (WebCore::glyphsToAdvances): Ditto.
+        (WebCore::canRender): Ditto.
+        * platform/graphics/gpu/Texture.cpp:
+        (WebCore::Texture::updateSubRect): Ditto.
+        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
+        (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas): Ditto.
+        * platform/graphics/skia/PlatformContextSkia.cpp:
+        (WebCore::PlatformContextSkia::readbackHardwareToSoftware): Ditto.
+        * platform/graphics/wince/SharedBitmap.cpp:
+        (WebCore::SharedBitmap::to16bit): Ditto.
+        * platform/win/ContextMenuWin.cpp:
+        (WebCore::ContextMenu::getContextMenuItems): Ditto.
+        * platform/win/LoggingWin.cpp:
+        (WebCore::initializeWithUserDefault): Ditto.
+        * plugins/win/PluginPackageWin.cpp:
+        (WebCore::PluginPackage::fetchInfo): Ditto.
+
 2011-02-06  Kent Tamura  <tkent@chromium.org>
 
         Unreviewed.
diff --git a/Source/WebCore/ForwardingHeaders/wtf/OwnArrayPtrCommon.h b/Source/WebCore/ForwardingHeaders/wtf/OwnArrayPtrCommon.h
deleted file mode 100644 (file)
index e886c8a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef WebCore_FWD_OwnArrayPtrCommon_h
-#define WebCore_FWD_OwnArrayPtrCommon_h
-#include <JavaScriptCore/OwnArrayPtrCommon.h>
-#endif
index 98d3e02f8bf789818ccf6d8c28ae7bd799a80b1a..c13362c3191ff900b73f9768920f66de1fac9d39 100644 (file)
@@ -78,14 +78,14 @@ static void freeV8NPObject(NPObject* npObject)
     free(v8NpObject);
 }
 
-static v8::Handle<v8::Value>* createValueListFromVariantArgs(const NPVariant* arguments, uint32_t argumentCount, NPObject* owner)
+static PassOwnArrayPtr<v8::Handle<v8::Value> > createValueListFromVariantArgs(const NPVariant* arguments, uint32_t argumentCount, NPObject* owner)
 {
-    v8::Handle<v8::Value>* argv = new v8::Handle<v8::Value>[argumentCount];
+    OwnArrayPtr<v8::Handle<v8::Value> > argv = adoptArrayPtr(new v8::Handle<v8::Value>[argumentCount]);
     for (uint32_t index = 0; index < argumentCount; index++) {
         const NPVariant* arg = &arguments[index];
         argv[index] = convertNPVariantToV8Object(arg, owner);
     }
-    return argv;
+    return argv.release();
 }
 
 // Create an identifier (null terminated utf8 char*) from the NPIdentifier.
@@ -188,7 +188,7 @@ bool _NPN_Invoke(NPP npp, NPObject* npObject, NPIdentifier methodName, const NPV
 
     // Call the function object.
     v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(functionObject);
-    OwnArrayPtr<v8::Handle<v8::Value> > argv(createValueListFromVariantArgs(arguments, argumentCount, npObject));
+    OwnArrayPtr<v8::Handle<v8::Value> > argv = createValueListFromVariantArgs(arguments, argumentCount, npObject);
     v8::Local<v8::Value> resultObject = proxy->callFunction(function, v8NpObject->v8Object, argumentCount, argv.get());
 
     // If we had an error, return false.  The spec is a little unclear here, but says "Returns true if the method was
@@ -237,7 +237,7 @@ bool _NPN_InvokeDefault(NPP npp, NPObject* npObject, const NPVariant* arguments,
         V8Proxy* proxy = toV8Proxy(npObject);
         ASSERT(proxy);
 
-        OwnArrayPtr<v8::Handle<v8::Value> > argv(createValueListFromVariantArgs(arguments, argumentCount, npObject));
+        OwnArrayPtr<v8::Handle<v8::Value> > argv = createValueListFromVariantArgs(arguments, argumentCount, npObject);
         resultObject = proxy->callFunction(function, functionObject, argumentCount, argv.get());
     }
     // If we had an error, return false.  The spec is a little unclear here, but says "Returns true if the method was
@@ -533,7 +533,7 @@ bool _NPN_Construct(NPP npp, NPObject* npObject, const NPVariant* arguments, uin
             V8Proxy* proxy = toV8Proxy(npObject);
             ASSERT(proxy);
 
-            OwnArrayPtr<v8::Handle<v8::Value> > argv(createValueListFromVariantArgs(arguments, argumentCount, npObject));
+            OwnArrayPtr<v8::Handle<v8::Value> > argv = createValueListFromVariantArgs(arguments, argumentCount, npObject);
             resultObject = proxy->newInstance(ctor, argumentCount, argv.get());
         }
 
index 3ea536e84b04f3b1c0de6a5d8bcdd7a07a44e2d4..aec742ca031e864e3463011afe34a99327879ea0 100644 (file)
@@ -126,7 +126,7 @@ ScriptValue ScriptFunctionCall::call(bool& hadException, bool reportExceptions)
     ASSERT(value->IsFunction());
 
     v8::Local<v8::Function> function(v8::Function::Cast(*value));
-    OwnArrayPtr<v8::Handle<v8::Value> > args(new v8::Handle<v8::Value>[m_arguments.size()]);
+    OwnArrayPtr<v8::Handle<v8::Value> > args = adoptArrayPtr(new v8::Handle<v8::Value>[m_arguments.size()]);
     for (size_t i = 0; i < m_arguments.size(); ++i)
         args[i] = m_arguments[i].v8Value();
 
@@ -159,7 +159,7 @@ ScriptObject ScriptFunctionCall::construct(bool& hadException, bool reportExcept
     ASSERT(value->IsFunction());
 
     v8::Local<v8::Function> constructor(v8::Function::Cast(*value));
-    OwnArrayPtr<v8::Handle<v8::Value> > args(new v8::Handle<v8::Value>[m_arguments.size()]);
+    OwnArrayPtr<v8::Handle<v8::Value> > args = adoptArrayPtr(new v8::Handle<v8::Value>[m_arguments.size()]);
     for (size_t i = 0; i < m_arguments.size(); ++i)
         args[i] = m_arguments[i].v8Value();
 
@@ -193,7 +193,7 @@ ScriptValue ScriptCallback::call(bool& hadException)
     v8::Handle<v8::Object> object = v8::Context::GetCurrent()->Global();
     v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(m_function.v8Value());
 
-    OwnArrayPtr<v8::Handle<v8::Value> > args(new v8::Handle<v8::Value>[m_arguments.size()]);
+    OwnArrayPtr<v8::Handle<v8::Value> > args = adoptArrayPtr(new v8::Handle<v8::Value>[m_arguments.size()]);
     for (size_t i = 0; i < m_arguments.size(); ++i)
         args[i] = m_arguments[i].v8Value();
 
index ea2c3c416204f2426591e057535721f17fd7ae8e..1ef368080edc4d63fa14a99f1e00ff2476a7c84c 100644 (file)
@@ -358,7 +358,7 @@ v8::Persistent<v8::Context> V8DOMWindowShell::createNewContext(v8::Handle<v8::Ob
 
     // Dynamically tell v8 about our extensions now.
     const V8Extensions& extensions = V8Proxy::extensions();
-    OwnArrayPtr<const char*> extensionNames(new const char*[extensions.size()]);
+    OwnArrayPtr<const char*> extensionNames = adoptArrayPtr(new const char*[extensions.size()]);
     int index = 0;
     for (size_t i = 0; i < extensions.size(); ++i) {
         // Ensure our date extension is always allowed.
index 0b1d25eef39bdd3c33d29917ccd464c2e88cd4b0..36640b70a1882d634d4cd9098b21d9bb1394dbe0 100644 (file)
@@ -101,7 +101,7 @@ static v8::Handle<v8::Value> npObjectInvokeImpl(const v8::Arguments& args, Invok
 
     // Wrap up parameters.
     int numArgs = args.Length();
-    OwnArrayPtr<NPVariant> npArgs(new NPVariant[numArgs]);
+    OwnArrayPtr<NPVariant> npArgs = adoptArrayPtr(new NPVariant[numArgs]);
 
     for (int i = 0; i < numArgs; i++)
         convertV8ObjectToNPVariant(args[i], npObject, &npArgs[i]);
index 4e0240dfceb946d0f9e29ae36d9ec2a0c13c76cb..a8ca878bca06d5d66dec9b8dd9ad9e05ec3b7c5e 100644 (file)
@@ -80,7 +80,7 @@ short V8NodeFilterCondition::acceptNode(ScriptState* state, Node* node) const
     }
 
     v8::Handle<v8::Object> object = v8::Context::GetCurrent()->Global();
-    OwnArrayPtr<v8::Handle<v8::Value> > args(new v8::Handle<v8::Value>[1]);
+    OwnArrayPtr<v8::Handle<v8::Value> > args = adoptArrayPtr(new v8::Handle<v8::Value>[1]);
     args[0] = toV8(node);
 
     v8::Handle<v8::Value> result = V8Proxy::callFunctionWithoutFrame(callback, object, 1, args.get());
index 5b0a028e6101454a464d10c0cc08e2c7574e94b6..d3ce17d71335a55cea118daf3911e690f3d1deb0 100644 (file)
@@ -64,7 +64,7 @@ void HTMLAreaElement::parseMappedAttribute(Attribute* attr)
         else if (equalIgnoringCase(attr->value(), "rect"))
             m_shape = Rect;
     } else if (attr->name() == coordsAttr) {
-        m_coords.set(newCoordsArray(attr->value().string(), m_coordsLen));
+        m_coords = newCoordsArray(attr->value().string(), m_coordsLen);
     } else if (attr->name() == altAttr || attr->name() == accesskeyAttr) {
         // Do nothing.
     } else
index e6abb25e696bac83d614a683dd3343a2d03cab8c..bb8c82657a377ead5eba069873f1670001172d2c 100644 (file)
@@ -75,12 +75,12 @@ void HTMLFrameSetElement::parseMappedAttribute(Attribute* attr)
 {
     if (attr->name() == rowsAttr) {
         if (!attr->isNull()) {
-            m_rowLengths.set(newLengthArray(attr->value().string(), m_totalRows));
+            m_rowLengths = newLengthArray(attr->value().string(), m_totalRows);
             setNeedsStyleRecalc();
         }
     } else if (attr->name() == colsAttr) {
         if (!attr->isNull()) {
-            m_colLengths.set(newLengthArray(attr->value().string(), m_totalCols));
+            m_colLengths = newLengthArray(attr->value().string(), m_totalCols);
             setNeedsStyleRecalc();
         }
     } else if (attr->name() == frameborderAttr) {
index ec4254b70dd8c94061381c00511a085b8085effc..7c6a946bbabcb0cb9e0dba333c3f1e2f88810a57 100644 (file)
@@ -1735,7 +1735,7 @@ bool WebGLRenderingContext::getAttachedShaders(WebGLProgram* program, Vector<Web
     GC3Dint numShaders = 0;
     m_context->getProgramiv(objectOrZero(program), GraphicsContext3D::ATTACHED_SHADERS, &numShaders);
     if (numShaders) {
-        OwnArrayPtr<Platform3DObject> shaders(new Platform3DObject[numShaders]);
+        OwnArrayPtr<Platform3DObject> shaders = adoptArrayPtr(new Platform3DObject[numShaders]);
         GC3Dsizei count = 0;
         m_context->getAttachedShaders(objectOrZero(program), numShaders, &count, shaders.get());
         if (count != numShaders)
@@ -4577,7 +4577,7 @@ bool WebGLRenderingContext::simulateVertexAttrib0(GC3Dsizei numVertex)
         || state.value[1] != m_vertexAttrib0BufferValue[1]
         || state.value[2] != m_vertexAttrib0BufferValue[2]
         || state.value[3] != m_vertexAttrib0BufferValue[3]) {
-        OwnArrayPtr<GC3Dfloat> bufferData(new GC3Dfloat[(numVertex + 1) * 4]);
+        OwnArrayPtr<GC3Dfloat> bufferData = adoptArrayPtr(new GC3Dfloat[(numVertex + 1) * 4]);
         for (GC3Dsizei ii = 0; ii < numVertex + 1; ++ii) {
             bufferData[ii * 4] = state.value[0];
             bufferData[ii * 4 + 1] = state.value[1];
@@ -4632,7 +4632,7 @@ WebGLExtension* WebGLRenderingContext::getExtensionNumber(int i)
 }
 
 WebGLRenderingContext::LRUImageBufferCache::LRUImageBufferCache(int capacity)
-    : m_buffers(new OwnPtr<ImageBuffer>[capacity])
+    : m_buffers(adoptArrayPtr(new OwnPtr<ImageBuffer>[capacity]))
     , m_capacity(capacity)
 {
 }
index e2fd9b87c60e01897f2b55cacbb192a879ffaa79..323705a251685f91435458c7f90f68f9f3c9998e 100644 (file)
@@ -28,6 +28,7 @@
 #include "PlatformString.h"
 #include <wtf/ASCIICType.h>
 #include <wtf/Assertions.h>
+#include <wtf/OwnArrayPtr.h>
 #include <wtf/text/StringBuffer.h>
 
 using namespace WTF;
@@ -83,7 +84,7 @@ static int countCharacter(const UChar* data, unsigned length, UChar character)
     return count;
 }
 
-Length* newCoordsArray(const String& string, int& len)
+PassOwnArrayPtr<Length> newCoordsArray(const String& string, int& len)
 {
     unsigned length = string.length();
     const UChar* data = string.characters();
@@ -100,7 +101,7 @@ Length* newCoordsArray(const String& string, int& len)
     str = str->simplifyWhiteSpace();
 
     len = countCharacter(str->characters(), str->length(), ' ') + 1;
-    Length* r = new Length[len];
+    OwnArrayPtr<Length> r = adoptArrayPtr(new Length[len]);
 
     int i = 0;
     unsigned pos = 0;
@@ -114,10 +115,10 @@ Length* newCoordsArray(const String& string, int& len)
 
     ASSERT(i == len - 1);
 
-    return r;
+    return r.release();
 }
 
-Length* newLengthArray(const String& string, int& len)
+PassOwnArrayPtr<Length> newLengthArray(const String& string, int& len)
 {
     RefPtr<StringImpl> str = string.impl()->simplifyWhiteSpace();
     if (!str->length()) {
@@ -126,7 +127,7 @@ Length* newLengthArray(const String& string, int& len)
     }
 
     len = countCharacter(str->characters(), str->length(), ',') + 1;
-    Length* r = new Length[len];
+    OwnArrayPtr<Length> r = adoptArrayPtr(new Length[len]);
 
     int i = 0;
     unsigned pos = 0;
@@ -145,7 +146,7 @@ Length* newLengthArray(const String& string, int& len)
     else
         len--;
 
-    return r;
+    return r.release();
 }
 
 } // namespace WebCore
index 9da71c7aa4ebee298210a75da8beb5b4a9bee48b..15719443a35cb41f9abebaeb1f28cfab1f4e40ce 100644 (file)
@@ -25,6 +25,7 @@
 #include <wtf/FastAllocBase.h>
 #include <wtf/Forward.h>
 #include <wtf/MathExtras.h>
+#include <wtf/PassOwnArrayPtr.h>
 
 namespace WebCore {
 
@@ -193,8 +194,8 @@ private:
     int m_value;
 };
 
-Length* newCoordsArray(const String&, int& len);
-Length* newLengthArray(const String&, int& len);
+PassOwnArrayPtr<Length> newCoordsArray(const String&, int& len);
+PassOwnArrayPtr<Length> newLengthArray(const String&, int& len);
 
 } // namespace WebCore
 
index b6b96539fd30e0537b496d41daad3a553b4d8d54..9e64904c04fe85bc9a6e00f3874af08e43dd1cf8 100644 (file)
@@ -93,7 +93,7 @@ bool ANGLEWebKitBridge::validateShaderSource(const char* shaderSource, ANGLEShad
         int logSize = 0;
         ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &logSize);
         if (logSize > 1) {
-            OwnArrayPtr<char> logBuffer(new char[logSize]);
+            OwnArrayPtr<char> logBuffer = adoptArrayPtr(new char[logSize]);
             if (logBuffer) {
                 ShGetInfoLog(compiler, logBuffer.get());
                 shaderValidationLog = logBuffer.get();
@@ -105,7 +105,7 @@ bool ANGLEWebKitBridge::validateShaderSource(const char* shaderSource, ANGLEShad
     int translationLength = 0;
     ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &translationLength);
     if (translationLength > 1) {
-        OwnArrayPtr<char> translationBuffer(new char[translationLength]);
+        OwnArrayPtr<char> translationBuffer = adoptArrayPtr(new char[translationLength]);
         if (!translationBuffer)
             return false;
         ShGetObjectCode(compiler, translationBuffer.get());
index 18be0eaed002a0eef82ccc57fbcb9a82e66db317..9dc30ea63256fc14b3ea92504c4094094837326e 100644 (file)
@@ -253,7 +253,7 @@ static void getDirtyRects(HWND window, Vector<CGRect>& outRects)
     }
 
     DWORD dataSize = GetRegionData(region.get(), 0, 0);
-    OwnArrayPtr<unsigned char> regionDataBuffer(new unsigned char[dataSize]);
+    OwnArrayPtr<unsigned char> regionDataBuffer = adoptArrayPtr(new unsigned char[dataSize]);
     RGNDATA* regionData = reinterpret_cast<RGNDATA*>(regionDataBuffer.get());
     if (!GetRegionData(region.get(), dataSize, regionData))
         return;
index 7f6a6d04516c27570902477db8b7de9e9cbbdc11..45986027ad3326544d3beff1b9965f2b679478f9 100644 (file)
@@ -387,7 +387,7 @@ const TextRun& ComplexTextController::getNormalizedTextRun(const TextRun& origin
         sourceText = normalizedString.getBuffer();
     }
 
-    normalizedBuffer.set(new UChar[normalizedBufferLength + 1]);
+    normalizedBuffer = adoptArrayPtr(new UChar[normalizedBufferLength + 1]);
 
     normalizeSpacesAndMirrorChars(sourceText, originalRun.rtl(), normalizedBuffer.get(), normalizedBufferLength);
 
index 056d8eb8cb3b910f00b4152c3a5e14563be45250..26ca64e3701d689021a971a6b548114ad0d1c7d8 100644 (file)
@@ -94,7 +94,7 @@ static void glyphsToAdvances(HB_Font hbFont, const HB_Glyph* glyphs, hb_uint32 n
     font->setupPaint(&paint);
     paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
 
-    OwnArrayPtr<uint16_t> glyphs16(new uint16_t[numGlyphs]);
+    OwnArrayPtr<uint16_t> glyphs16 = adoptArrayPtr(new uint16_t[numGlyphs]);
     if (!glyphs16.get())
         return;
     for (unsigned i = 0; i < numGlyphs; ++i)
@@ -120,7 +120,7 @@ static HB_Bool canRender(HB_Font hbFont, const HB_UChar16* characters, hb_uint32
     font->setupPaint(&paint);
     paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
 
-    OwnArrayPtr<uint16_t> glyphs16(new uint16_t[length]);
+    OwnArrayPtr<uint16_t> glyphs16 = adoptArrayPtr(new uint16_t[length]);
     if (!glyphs16.get())
         return 0;
     int numGlyphs = paint.textToGlyphs(characters, length * sizeof(uint16_t), glyphs16.get());
index e1f8114fda1f0fce2d93adaf6719501fd004a6b2..b1ba827f55c00ca5950bbfc1268ba32773d7b259 100644 (file)
@@ -166,7 +166,7 @@ void Texture::updateSubRect(void* pixels, const IntRect& updateRect)
     int tempBuffSize = // Temporary buffer size is the smaller of the max texture size or the updateRectSanitized
         min(m_tiles.maxTextureSize(), m_tiles.borderTexels() + updateRectSanitized.width()) *
         min(m_tiles.maxTextureSize(), m_tiles.borderTexels() + updateRectSanitized.height());
-    OwnArrayPtr<uint32_t> tempBuff(new uint32_t[tempBuffSize]);
+    OwnArrayPtr<uint32_t> tempBuff = adoptArrayPtr(new uint32_t[tempBuffSize]);
 
     for (int tile = 0; tile < m_tiles.numTiles(); tile++) {
         // Intersect with tile
index 1893ac8d66493c79f6a1acbf7ad4b98d950a873b..c224e207c316b80c476aa3c41fc81d6036c5aceb 100644 (file)
@@ -83,7 +83,7 @@ void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* co
     int rowBytes = m_currentWidth * 4;
     int totalBytes = rowBytes * m_currentHeight;
 
-    OwnArrayPtr<unsigned char> pixels(new unsigned char[totalBytes]);
+    OwnArrayPtr<unsigned char> pixels = adoptArrayPtr(new unsigned char[totalBytes]);
     if (!pixels)
         return;
 
index 37a0c5981122540efa0e9935cc784e4b36b3af3c..81f78a1b256aca8d2631dd2d7cc0c4e4d9f25de4 100644 (file)
@@ -839,7 +839,7 @@ void PlatformContextSkia::readbackHardwareToSoftware() const
     const SkBitmap& bitmap = m_canvas->getDevice()->accessBitmap(true);
     SkAutoLockPixels lock(bitmap);
     int width = bitmap.width(), height = bitmap.height();
-    OwnArrayPtr<uint32_t> buf(new uint32_t[width]);
+    OwnArrayPtr<uint32_t> buf = adoptArrayPtr(new uint32_t[width]);
     SharedGraphicsContext3D* context = m_gpuCanvas->context();
     m_gpuCanvas->bindFramebuffer();
     // Flips the image vertically.
index 62fadb0943431514c96625f5cb113fb317eeddb4..2bf002820951e78935c2c6743a238d0222efb6a6 100644 (file)
@@ -135,7 +135,7 @@ bool SharedBitmap::to16bit()
     int width = newBmpInfo.width();
     int paddedWidth = newBmpInfo.paddedWidth();
     int bufferSize = paddedWidth * newBmpInfo.height();
-    OwnArrayPtr<unsigned> newPixelData(new unsigned[bufferSize / 2]);
+    OwnArrayPtr<unsigned> newPixelData = adoptArrayPtr(new unsigned[bufferSize / 2]);
     void* newPixels = newPixelData.get();
 
     if (!newPixels)
index 530d64d4d6f5533830505073675fd4f86d2d30e5..dad0f2e21cade6a508fdfee4072e69effe5417ac 100644 (file)
@@ -72,7 +72,7 @@ void ContextMenu::getContextMenuItems(HMENU menu, Vector<ContextMenuItem>& items
         }
 
         int menuStringLength = info.cch + 1;
-        OwnArrayPtr<WCHAR> menuString(new WCHAR[menuStringLength]);
+        OwnArrayPtr<WCHAR> menuString = adoptArrayPtr(new WCHAR[menuStringLength]);
         info.dwTypeData = menuString.get();
         info.cch = menuStringLength;
 
index fe237e5685f46ad344919b84a0a1f3f72fa745f7..1d051ae8327443c925686eb2919be5970127bece 100644 (file)
@@ -37,7 +37,7 @@ static inline void initializeWithUserDefault(WTFLogChannel& channel)
     if (!length)
         return;
 
-    OwnArrayPtr<char> buffer(new char[length]);
+    OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length]);
 
     if (!GetEnvironmentVariableA(channel.defaultName, buffer.get(), length))
         return;
index 74bd2a9a658078b92de1e87d18c99760bdc8be78..e06d1f427c99cce14ebef1d8a6aa536899694ee8 100644 (file)
@@ -168,7 +168,7 @@ bool PluginPackage::fetchInfo()
     if (versionInfoSize == 0)
         return false;
 
-    OwnArrayPtr<char> versionInfoData(new char[versionInfoSize]);
+    OwnArrayPtr<char> versionInfoData = adoptArrayPtr(new char[versionInfoSize]);
 
     if (!GetFileVersionInfoW(const_cast<UChar*>(m_path.charactersWithNullTermination()),
             0, versionInfoSize, versionInfoData.get()))
index 381f2fa9923598fcd5c6985d859fae4cb10b3cc4..2d8700df308af674137ac0425653688e219847ca 100644 (file)
@@ -1,3 +1,15 @@
+2011-02-06  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Reviewed by Darin Adler.
+
+        OwnArraryPtr.h uses deleteOwnedPtr but doesn’t include OwnPtrCommon.h
+        https://bugs.webkit.org/show_bug.cgi?id=52867
+
+        * WebHistory.cpp:
+        (WebHistory::orderedLastVisitedDays): Calls adoptArrayPtr.
+        * WebPreferences.cpp:
+        (WebPreferences::copyWebKitPreferencesToCFPreferences): Ditto.
+
 2011-02-03  Yury Semikhatsky  <yurys@chromium.org>
 
         Reviewed by Pavel Feldman.
index 5383a0cd15037313f5ddb779c8387862831a065c..4caa554bc1b8c2eb7db4d8793e1a65398e6da6d6 100644 (file)
@@ -476,7 +476,7 @@ HRESULT STDMETHODCALLTYPE WebHistory::orderedLastVisitedDays(
 
     *count = dateCount;
     if (!m_orderedLastVisitedDays) {
-        m_orderedLastVisitedDays.set(new DATE[dateCount]);
+        m_orderedLastVisitedDays = adoptArrayPtr(new DATE[dateCount]);
         DateToEntriesMap::const_iterator::Keys end = m_entriesByDate.end().keys();
         int i = 0;
         for (DateToEntriesMap::const_iterator::Keys it = m_entriesByDate.begin().keys(); it != end; ++it, ++i)
index a962471398d91dd47e01b26e986fc16a71f6b1d8..01cab2bedfe8beb861021e0bc40c5f908d631f63 100644 (file)
@@ -463,8 +463,8 @@ void WebPreferences::copyWebKitPreferencesToCFPreferences(CFDictionaryRef dict)
     CFStringRef didRemoveDefaultsKey = CFSTR(WebKitDidMigrateDefaultSettingsFromSafari3BetaPreferenceKey);
     bool omitDefaults = !booleanValueForPreferencesValue(CFDictionaryGetValue(dict, didRemoveDefaultsKey));
 
-    OwnArrayPtr<CFTypeRef> keys(new CFTypeRef[count]);
-    OwnArrayPtr<CFTypeRef> values(new CFTypeRef[count]);
+    OwnArrayPtr<CFTypeRef> keys = adoptArrayPtr(new CFTypeRef[count]);
+    OwnArrayPtr<CFTypeRef> values = adoptArrayPtr(new CFTypeRef[count]);
     CFDictionaryGetKeysAndValues(dict, keys.get(), values.get());
 
     for (int i = 0; i < count; ++i) {
index 996211923394ba3268af1972960e5a91ed06de46..dae327f56b4b5c08ceca5a33e5465aaa037d204e 100644 (file)
@@ -1,3 +1,13 @@
+2011-02-06  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Reviewed by Darin Adler.
+
+        OwnArraryPtr.h uses deleteOwnedPtr but doesn’t include OwnPtrCommon.h
+        https://bugs.webkit.org/show_bug.cgi?id=52867
+
+        * Shared/Plugins/Netscape/win/NetscapePluginModuleWin.cpp:
+        (WebKit::NetscapePluginModule::getPluginInfo): Calls adoptArrayPtr.
+
 2011-02-06  Benjamin Poulain  <ikipou@gmail.com>
 
         Reviewed by Andreas Kling.
index d4cc3740dc6e5708d0bf9877f2d74e7b7a234fd6..d6287e3f7c9d5995f2c9c6eae775ef5e547da2db 100644 (file)
@@ -60,7 +60,7 @@ bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginInfoSto
     if (!versionInfoSize)
         return false;
 
-    OwnArrayPtr<char> versionInfoData(new char[versionInfoSize]);
+    OwnArrayPtr<char> versionInfoData = adoptArrayPtr(new char[versionInfoSize]);
     if (!::GetFileVersionInfoW(pathCopy.charactersWithNullTermination(), 0, versionInfoSize, versionInfoData.get()))
         return false;
 
index a8fafb74aeb77afad52b192f314b90704317f1a6..a2f857d2624dfe835a2ee587989e6534b0aba613 100644 (file)
@@ -1,3 +1,13 @@
+2011-02-06  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Reviewed by Darin Adler.
+
+        OwnArraryPtr.h uses deleteOwnedPtr but doesn’t include OwnPtrCommon.h
+        https://bugs.webkit.org/show_bug.cgi?id=52867
+
+        * DumpRenderTree/chromium/ImageDiff.cpp:
+        (Image::craeteFromStdin): Call adoptArrayPtr.
+
 2011-02-06  James Kozianski  <koz@chromium.org>
 
         Reviewed by Ojan Vafai.
index f2875dd99bff01811cc985233c49033fc5edb992..d67643005ef502993f3d5a725aadd0330c6d54ec 100644 (file)
@@ -88,7 +88,7 @@ public:
         if (!byteLength)
             return false;
 
-        OwnArrayPtr<unsigned char> source(new unsigned char[byteLength]);
+        OwnArrayPtr<unsigned char> source = adoptArrayPtr(new unsigned char[byteLength]);
         if (fread(source.get(), 1, byteLength, stdin) != byteLength)
             return false;