Title: [210323] trunk/Source/WebCore
Revision
210323
Author
[email protected]
Date
2017-01-05 00:46:10 -0800 (Thu, 05 Jan 2017)

Log Message

Remove PassRefPtr use from "bindings/scripts", "svg", "testing", and "workers"
https://bugs.webkit.org/show_bug.cgi?id=166718

Reviewed by Alex Christensen.

* bindings/scripts/test/JS/JSFloat64Array.cpp: Removed. Stale unused test
result expectation file.
* bindings/scripts/test/JS/JSFloat64Array.h: Ditto.

* svg/SVGElement.cpp:
(WebCore::SVGElement::removeEventListener): Fix comment that incorrectly
mentions PassRefPtr.

* testing/Internals.cpp:
(WebCore::Internals::computedStyleIncludingVisitedInfo): Return Ref instead
of RefPtr.
(WebCore::Internals::serializeObject): Ditto.
(WebCore::Internals::deserializeBuffer): Ditto.
(WebCore::Internals::observeGC): Streamlined code a bit.
* testing/Internals.h: Updated for above changes.
* testing/Internals.idl: Marked various function results as nullable.

* workers/DedicatedWorkerThread.cpp:
(WebCore::DedicatedWorkerThread::createWorkerGlobalScope): Take a RefPtr&&
instead of a PassRefPtr.
* workers/DedicatedWorkerThread.h: Updated for above change.

* workers/Worker.cpp:
(WebCore::Worker::Worker): Passs a reference to WorkerGlobalScopeProxy::create.
(WebCore::Worker::~Worker): Updated since m_contentProxy is a reference.
(WebCore::Worker::postMessage): Ditto.
(WebCore::Worker::terminate): Ditto.
(WebCore::Worker::hasPendingActivity): Ditto.
(WebCore::Worker::notifyNetworkStateChange): Ditto.
(WebCore::Worker::notifyFinished): Ditto.
* workers/Worker.h: Made m_contextProxy a reference rather than a pointer.

* workers/WorkerGlobalScopeProxy.h: Reduced includes. Made destructor
protected instead of public since this class destroys itself.

* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerGlobalScopeProxy::create): Take and return a reference.
(WebCore::WorkerMessagingProxy::WorkerMessagingProxy): Moved most initialization
to the calass definition. Take a reference instead of a pointer.
(WebCore::WorkerMessagingProxy::startWorkerGlobalScope): Use auto.
(WebCore::WorkerMessagingProxy::workerThreadCreated): Take a reference
rather than a PassRefPtr.
* workers/WorkerMessagingProxy.h: Updated for above changes.
(WebCore::WorkerMessagingProxy::askedToTerminate): Deleted.
(WebCore::WorkerMessagingProxy::workerObject): Deleted.

* workers/WorkerThread.h: Take a RefPtr&& instead of a PassRefPtr.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (210322 => 210323)


--- trunk/Source/WebCore/ChangeLog	2017-01-05 08:08:11 UTC (rev 210322)
+++ trunk/Source/WebCore/ChangeLog	2017-01-05 08:46:10 UTC (rev 210323)
@@ -1,3 +1,58 @@
+2017-01-05  Darin Adler  <[email protected]>
+
+        Remove PassRefPtr use from "bindings/scripts", "svg", "testing", and "workers"
+        https://bugs.webkit.org/show_bug.cgi?id=166718
+
+        Reviewed by Alex Christensen.
+
+        * bindings/scripts/test/JS/JSFloat64Array.cpp: Removed. Stale unused test
+        result expectation file.
+        * bindings/scripts/test/JS/JSFloat64Array.h: Ditto.
+
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::removeEventListener): Fix comment that incorrectly
+        mentions PassRefPtr.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::computedStyleIncludingVisitedInfo): Return Ref instead
+        of RefPtr.
+        (WebCore::Internals::serializeObject): Ditto.
+        (WebCore::Internals::deserializeBuffer): Ditto.
+        (WebCore::Internals::observeGC): Streamlined code a bit.
+        * testing/Internals.h: Updated for above changes.
+        * testing/Internals.idl: Marked various function results as nullable.
+
+        * workers/DedicatedWorkerThread.cpp:
+        (WebCore::DedicatedWorkerThread::createWorkerGlobalScope): Take a RefPtr&&
+        instead of a PassRefPtr.
+        * workers/DedicatedWorkerThread.h: Updated for above change.
+
+        * workers/Worker.cpp:
+        (WebCore::Worker::Worker): Passs a reference to WorkerGlobalScopeProxy::create.
+        (WebCore::Worker::~Worker): Updated since m_contentProxy is a reference.
+        (WebCore::Worker::postMessage): Ditto.
+        (WebCore::Worker::terminate): Ditto.
+        (WebCore::Worker::hasPendingActivity): Ditto.
+        (WebCore::Worker::notifyNetworkStateChange): Ditto.
+        (WebCore::Worker::notifyFinished): Ditto.
+        * workers/Worker.h: Made m_contextProxy a reference rather than a pointer.
+
+        * workers/WorkerGlobalScopeProxy.h: Reduced includes. Made destructor
+        protected instead of public since this class destroys itself.
+
+        * workers/WorkerMessagingProxy.cpp:
+        (WebCore::WorkerGlobalScopeProxy::create): Take and return a reference.
+        (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): Moved most initialization
+        to the calass definition. Take a reference instead of a pointer.
+        (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): Use auto.
+        (WebCore::WorkerMessagingProxy::workerThreadCreated): Take a reference
+        rather than a PassRefPtr.
+        * workers/WorkerMessagingProxy.h: Updated for above changes.
+        (WebCore::WorkerMessagingProxy::askedToTerminate): Deleted.
+        (WebCore::WorkerMessagingProxy::workerObject): Deleted.
+
+        * workers/WorkerThread.h: Take a RefPtr&& instead of a PassRefPtr.
+
 2017-01-04  Carlos Garcia Campos  <[email protected]>
 
         Unreviewed. Addressing post-review comments after r21005.

Deleted: trunk/Source/WebCore/bindings/scripts/test/JS/JSFloat64Array.cpp (210322 => 210323)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSFloat64Array.cpp	2017-01-05 08:08:11 UTC (rev 210322)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSFloat64Array.cpp	2017-01-05 08:46:10 UTC (rev 210323)
@@ -1,294 +0,0 @@
-/*
-    This file is part of the WebKit open source project.
-    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-#include "JSFloat64Array.h"
-
-#include "ExceptionCode.h"
-#include "JSArrayBufferViewHelper.h"
-#include "JSDOMBinding.h"
-#include "JSFloat32Array.h"
-#include "JSInt32Array.h"
-#include <runtime/Error.h>
-#include <runtime/Float64Array.h>
-#include <runtime/Int32Array.h>
-#include <runtime/PropertyNameArray.h>
-#include <wtf/GetPtr.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-/* Hash table */
-
-static const HashTableValue JSFloat64ArrayTableValues[] =
-{
-    { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsFloat64ArrayConstructor), (intptr_t)0, NoIntrinsic },
-    { 0, 0, 0, 0, NoIntrinsic }
-};
-
-static const HashTable JSFloat64ArrayTable = { 2, 1, JSFloat64ArrayTableValues, 0 };
-/* Hash table for constructor */
-
-static const HashTableValue JSFloat64ArrayConstructorTableValues[] =
-{
-    { 0, 0, 0, 0, NoIntrinsic }
-};
-
-static const HashTable JSFloat64ArrayConstructorTable = { 1, 0, JSFloat64ArrayConstructorTableValues, 0 };
-EncodedJSValue JSC_HOST_CALL JSFloat64ArrayConstructor::constructJSFloat64Array(ExecState* exec)
-{
-    JSFloat64ArrayConstructor* jsConstructor = jsCast<JSFloat64ArrayConstructor*>(exec->jsCallee());
-    RefPtr<Float64Array> array = constructArrayBufferView<Float64Array, double>(exec);
-    if (!array.get())
-        // Exception has already been thrown.
-        return JSValue::encode(JSValue());
-    return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), array.get())));
-}
-
-JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Float64Array* object)
-{
-    return toJSArrayBufferView<JSFloat64Array>(exec, globalObject, object);
-}
-
-void JSFloat64Array::indexSetter(JSC::ExecState* exec, unsigned index, JSC::JSValue value)
-{
-    impl()->set(index, value.toNumber(exec));
-}
-
-static const HashTable* getJSFloat64ArrayConstructorTable(ExecState* exec)
-{
-    return getHashTableForGlobalData(exec->vm(), &JSFloat64ArrayConstructorTable);
-}
-
-const ClassInfo JSFloat64ArrayConstructor::s_info = { "Float64ArrayConstructor", &Base::s_info, 0, getJSFloat64ArrayConstructorTable, CREATE_METHOD_TABLE(JSFloat64ArrayConstructor) };
-
-JSFloat64ArrayConstructor::JSFloat64ArrayConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
-    : DOMConstructorObject(structure, globalObject)
-{
-}
-
-void JSFloat64ArrayConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
-{
-    Base::finishCreation(exec->vm());
-    ASSERT(inherits(info()));
-    putDirect(exec->vm(), exec->propertyNames().prototype, JSFloat64ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly);
-    putDirect(exec->vm(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
-}
-
-bool JSFloat64ArrayConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
-{
-    return getStaticValueSlot<JSFloat64ArrayConstructor, JSDOMWrapper>(exec, getJSFloat64ArrayConstructorTable(exec), jsCast<JSFloat64ArrayConstructor*>(object), propertyName, slot);
-}
-
-bool JSFloat64ArrayConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
-{
-    return getStaticValueDescriptor<JSFloat64ArrayConstructor, JSDOMWrapper>(exec, getJSFloat64ArrayConstructorTable(exec), jsCast<JSFloat64ArrayConstructor*>(object), propertyName, descriptor);
-}
-
-ConstructType JSFloat64ArrayConstructor::getConstructData(JSCell*, ConstructData& constructData)
-{
-    constructData.native.function = constructJSFloat64Array;
-    return ConstructType::Host;
-}
-
-/* Hash table for prototype */
-
-static const HashTableValue JSFloat64ArrayPrototypeTableValues[] =
-{
-    { "foo", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsFloat64ArrayPrototypeFunctionFoo), (intptr_t)1, NoIntrinsic },
-    { "set", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsFloat64ArrayPrototypeFunctionSet), (intptr_t)0, NoIntrinsic },
-    { 0, 0, 0, 0, NoIntrinsic }
-};
-
-static const HashTable JSFloat64ArrayPrototypeTable = { 4, 3, JSFloat64ArrayPrototypeTableValues, 0 };
-static const HashTable* getJSFloat64ArrayPrototypeTable(ExecState* exec)
-{
-    return getHashTableForGlobalData(exec->vm(), &JSFloat64ArrayPrototypeTable);
-}
-
-const ClassInfo JSFloat64ArrayPrototype::s_info = { "Float64ArrayPrototype", &Base::s_info, 0, getJSFloat64ArrayPrototypeTable, CREATE_METHOD_TABLE(JSFloat64ArrayPrototype) };
-
-JSObject* JSFloat64ArrayPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
-{
-    return getDOMPrototype<JSFloat64Array>(exec, globalObject);
-}
-
-bool JSFloat64ArrayPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
-{
-    JSFloat64ArrayPrototype* thisObject = jsCast<JSFloat64ArrayPrototype*>(object);
-    return getStaticFunctionSlot<JSObject>(exec, getJSFloat64ArrayPrototypeTable(exec), thisObject, propertyName, slot);
-}
-
-bool JSFloat64ArrayPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
-{
-    JSFloat64ArrayPrototype* thisObject = jsCast<JSFloat64ArrayPrototype*>(object);
-    return getStaticFunctionDescriptor<JSObject>(exec, getJSFloat64ArrayPrototypeTable(exec), thisObject, propertyName, descriptor);
-}
-
-static const HashTable* getJSFloat64ArrayTable(ExecState* exec)
-{
-    return getHashTableForGlobalData(exec->vm(), &JSFloat64ArrayTable);
-}
-
-const ClassInfo JSFloat64Array::s_info = { "Float64Array", &Base::s_info, 0, getJSFloat64ArrayTable , CREATE_METHOD_TABLE(JSFloat64Array) };
-
-JSFloat64Array::JSFloat64Array(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<Float64Array> impl)
-    : JSArrayBufferView(structure, globalObject, impl)
-{
-}
-
-void JSFloat64Array::finishCreation(VM& vm)
-{
-    Base::finishCreation(vm);
-    TypedArrayDescriptor descriptor(JSFloat64Array::info(), OBJECT_OFFSETOF(JSFloat64Array, m_storage), OBJECT_OFFSETOF(JSFloat64Array, m_storageLength));
-    vm.registerTypedArrayDescriptor(impl(), descriptor);
-    m_storage = impl()->data();
-    m_storageLength = impl()->length();
-    ASSERT(inherits(info()));
-}
-
-JSObject* JSFloat64Array::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
-{
-    return JSFloat64ArrayPrototype::create(exec->vm(), globalObject, JSFloat64ArrayPrototype::createStructure(exec->vm(), globalObject, JSArrayBufferViewPrototype::self(exec, globalObject)));
-}
-
-bool JSFloat64Array::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
-{
-    JSFloat64Array* thisObject = jsCast<JSFloat64Array*>(object);
-    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-    std::optional<uint32_t> index = parseIndex(propertyName);
-    if (index && index.value() < static_cast<Float64Array*>(thisObject->impl())->length()) {
-        slot.setValue(thisObject, thisObject->getByIndex(exec, index.value()));
-        return true;
-    }
-    return getStaticValueSlot<JSFloat64Array, Base>(exec, getJSFloat64ArrayTable(exec), thisObject, propertyName, slot);
-}
-
-bool JSFloat64Array::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
-{
-    JSFloat64Array* thisObject = jsCast<JSFloat64Array*>(object);
-    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-    std::optional<uint32_t> index = parseIndex(propertyName);
-    if (index && index.value() < static_cast<Float64Array*>(thisObject->impl())->length()) {
-        descriptor.setDescriptor(thisObject->getByIndex(exec, index.value()), DontDelete);
-        return true;
-    }
-    return getStaticValueDescriptor<JSFloat64Array, Base>(exec, getJSFloat64ArrayTable(exec), thisObject, propertyName, descriptor);
-}
-
-bool JSFloat64Array::getOwnPropertySlotByIndex(JSObject* object, ExecState* exec, unsigned index, PropertySlot& slot)
-{
-    JSFloat64Array* thisObject = jsCast<JSFloat64Array*>(object);
-    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-    if (index < static_cast<Float64Array*>(thisObject->impl())->length()) {
-        slot.setValue(thisObject, thisObject->getByIndex(exec, index));
-        return true;
-    }
-    return Base::getOwnPropertySlotByIndex(thisObject, exec, index, slot);
-}
-
-JSValue jsFloat64ArrayConstructor(ExecState* exec, JSValue slotBase, PropertyName)
-{
-    JSFloat64Array* domObject = jsCast<JSFloat64Array*>(asObject(slotBase));
-    return JSFloat64Array::getConstructor(exec, domObject->globalObject());
-}
-
-void JSFloat64Array::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
-{
-    JSFloat64Array* thisObject = jsCast<JSFloat64Array*>(cell);
-    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-    if (std::optional<uint32_t> index = parseIndex(propertyName)) {
-        thisObject->indexSetter(exec, index.value(), value);
-        return;
-    }
-    Base::put(thisObject, exec, propertyName, value, slot);
-}
-
-void JSFloat64Array::putByIndex(JSCell* cell, ExecState* exec, unsigned index, JSValue value, bool shouldThrow)
-{
-    JSFloat64Array* thisObject = jsCast<JSFloat64Array*>(cell);
-    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-    if (index <= MAX_ARRAY_INDEX) {
-        UNUSED_PARAM(shouldThrow);
-        thisObject->indexSetter(exec, index, value);
-        return;
-    }
-    Base::putByIndex(cell, exec, index, value, shouldThrow);
-}
-
-void JSFloat64Array::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
-{
-    JSFloat64Array* thisObject = jsCast<JSFloat64Array*>(object);
-    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-    for (unsigned i = 0; i < static_cast<Float64Array*>(thisObject->impl())->length(); ++i)
-        propertyNames.add(Identifier::from(exec, i));
-    Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
-}
-
-JSValue JSFloat64Array::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
-{
-    return getDOMConstructor<JSFloat64ArrayConstructor>(exec, jsCast<JSDOMGlobalObject*>(globalObject));
-}
-
-EncodedJSValue JSC_HOST_CALL jsFloat64ArrayPrototypeFunctionFoo(ExecState* exec)
-{
-    JSValue thisValue = exec->thisValue();
-    if (!thisValue.inherits(JSFloat64Array::info()))
-        return throwVMTypeError(exec);
-    JSFloat64Array* castedThis = jsCast<JSFloat64Array*>(asObject(thisValue));
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSFloat64Array::info());
-    Float64Array* impl = static_cast<Float64Array*>(castedThis->impl());
-    if (exec->argumentCount() < 1)
-        return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    Float32Array* array(toFloat32Array(exec->argument(0)));
-    if (exec->hadException())
-        return JSValue::encode(jsUndefined());
-
-    JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->foo(array)));
-    return JSValue::encode(result);
-}
-
-EncodedJSValue JSC_HOST_CALL jsFloat64ArrayPrototypeFunctionSet(ExecState* exec)
-{
-    JSValue thisValue = exec->thisValue();
-    if (!thisValue.inherits(JSFloat64Array::info()))
-        return throwVMTypeError(exec);
-    JSFloat64Array* castedThis = jsCast<JSFloat64Array*>(asObject(thisValue));
-    ASSERT_GC_OBJECT_INHERITS(castedThis, JSFloat64Array::info());
-    return JSValue::encode(setWebGLArrayHelper<Float64Array, double>(exec, castedThis->impl()));
-}
-
-
-JSValue JSFloat64Array::getByIndex(ExecState*, unsigned index)
-{
-    ASSERT_GC_OBJECT_INHERITS(this, info());
-    double result = static_cast<Float64Array*>(impl())->item(index);
-    if (std::isnan(result))
-        return jsNaN();
-    return JSValue(result);
-}
-
-Float64Array* toFloat64Array(JSC::JSValue value)
-{
-    return value.inherits(JSFloat64Array::info()) ? jsCast<JSFloat64Array*>(asObject(value))->impl() : 0;
-}
-
-}

Deleted: trunk/Source/WebCore/bindings/scripts/test/JS/JSFloat64Array.h (210322 => 210323)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSFloat64Array.h	2017-01-05 08:08:11 UTC (rev 210322)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSFloat64Array.h	2017-01-05 08:46:10 UTC (rev 210323)
@@ -1,136 +0,0 @@
-/*
-    This file is part of the WebKit open source project.
-    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#ifndef JSFloat64Array_h
-#define JSFloat64Array_h
-
-#include "JSArrayBufferView.h"
-#include "JSDOMBinding.h"
-#include <runtime/Float64Array.h>
-#include <runtime/JSObject.h>
-
-namespace WebCore {
-
-class JSFloat64Array : public JSArrayBufferView {
-public:
-    typedef JSArrayBufferView Base;
-    static JSFloat64Array* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<Float64Array> impl)
-    {
-        JSFloat64Array* ptr = new (NotNull, JSC::allocateCell<JSFloat64Array>(globalObject->vm().heap)) JSFloat64Array(structure, globalObject, impl);
-        ptr->finishCreation(globalObject->vm());
-        return ptr;
-    }
-
-    static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);
-    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
-    static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertyDescriptor&);
-    static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
-    static void put(JSC::JSCell*, JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&);
-    static void putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);
-    DECLARE_INFO;
-
-    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
-    {
-        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
-    }
-
-    static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
-    static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*);
-    Float64Array* impl() const
-    {
-        return static_cast<Float64Array*>(Base::impl());
-    }
-    static const JSC::TypedArrayType TypedArrayStorageType = JSC::TypedArrayFloat64;
-    intptr_t m_storageLength;
-    void* m_storage;
-protected:
-    JSFloat64Array(JSC::Structure*, JSDOMGlobalObject*, PassRefPtr<Float64Array>);
-    void finishCreation(JSC::VM&);
-    static const unsigned StructureFlags = JSC::OverridesGetPropertyNames | JSC::OverridesGetOwnPropertySlot | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | Base::StructureFlags;
-    JSC::JSValue getByIndex(JSC::ExecState*, unsigned index);
-    void indexSetter(JSC::ExecState*, unsigned index, JSC::JSValue);
-};
-
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, Float64Array*);
-Float64Array* toFloat64Array(JSC::JSValue);
-
-class JSFloat64ArrayPrototype : public JSC::JSNonFinalObject {
-public:
-    typedef JSC::JSNonFinalObject Base;
-    static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*);
-    static JSFloat64ArrayPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
-    {
-        JSFloat64ArrayPrototype* ptr = new (NotNull, JSC::allocateCell<JSFloat64ArrayPrototype>(vm.heap)) JSFloat64ArrayPrototype(vm, globalObject, structure);
-        ptr->finishCreation(vm);
-        return ptr;
-    }
-
-    DECLARE_INFO;
-    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
-    static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertyDescriptor&);
-    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
-    {
-        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
-    }
-
-private:
-    JSFloat64ArrayPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) : JSC::JSNonFinalObject(vm, structure) { }
-protected:
-    static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags;
-};
-
-class JSFloat64ArrayConstructor : public DOMConstructorObject {
-private:
-    JSFloat64ArrayConstructor(JSC::Structure*, JSDOMGlobalObject*);
-    void finishCreation(JSC::ExecState*, JSDOMGlobalObject*);
-
-public:
-    typedef DOMConstructorObject Base;
-    static JSFloat64ArrayConstructor* create(JSC::ExecState* exec, JSC::Structure* structure, JSDOMGlobalObject* globalObject)
-    {
-        JSFloat64ArrayConstructor* ptr = new (NotNull, JSC::allocateCell<JSFloat64ArrayConstructor>(*exec->heap())) JSFloat64ArrayConstructor(structure, globalObject);
-        ptr->finishCreation(exec, globalObject);
-        return ptr;
-    }
-
-    static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
-    static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertyDescriptor&);
-    DECLARE_INFO;
-    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
-    {
-        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
-    }
-protected:
-    static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
-    static JSC::EncodedJSValue JSC_HOST_CALL constructJSFloat64Array(JSC::ExecState*);
-    static JSC::ConstructType getConstructData(JSC::JSCell*, JSC::ConstructData&);
-};
-
-// Functions
-
-JSC::EncodedJSValue JSC_HOST_CALL jsFloat64ArrayPrototypeFunctionFoo(JSC::ExecState*);
-JSC::EncodedJSValue JSC_HOST_CALL jsFloat64ArrayPrototypeFunctionSet(JSC::ExecState*);
-// Attributes
-
-JSC::JSValue jsFloat64ArrayConstructor(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);
-
-} // namespace WebCore
-
-#endif

Modified: trunk/Source/WebCore/svg/SVGElement.cpp (210322 => 210323)


--- trunk/Source/WebCore/svg/SVGElement.cpp	2017-01-05 08:08:11 UTC (rev 210322)
+++ trunk/Source/WebCore/svg/SVGElement.cpp	2017-01-05 08:46:10 UTC (rev 210323)
@@ -537,7 +537,7 @@
     if (containingShadowRoot())
         return Node::removeEventListener(eventType, listener, options);
 
-    // EventTarget::removeEventListener creates a PassRefPtr around the given EventListener
+    // EventTarget::removeEventListener creates a Ref around the given EventListener
     // object when creating a temporary RegisteredEventListener object used to look up the
     // event listener in a cache. If we want to be able to call removeEventListener() multiple
     // times on different nodes, we have to delay its immediate destruction, which would happen

Modified: trunk/Source/WebCore/testing/Internals.cpp (210322 => 210323)


--- trunk/Source/WebCore/testing/Internals.cpp	2017-01-05 08:08:11 UTC (rev 210322)
+++ trunk/Source/WebCore/testing/Internals.cpp	2017-01-05 08:46:10 UTC (rev 210323)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2012 Google Inc. All rights reserved.
- * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -811,7 +811,7 @@
     return element.renderer() && element.renderer()->hasPausedImageAnimations();
 }
 
-RefPtr<CSSComputedStyleDeclaration> Internals::computedStyleIncludingVisitedInfo(Element& element) const
+Ref<CSSComputedStyleDeclaration> Internals::computedStyleIncludingVisitedInfo(Element& element) const
 {
     bool allowVisitedStyle = true;
     return CSSComputedStyleDeclaration::create(element, allowVisitedStyle);
@@ -1433,7 +1433,7 @@
     return range.text();
 }
 
-RefPtr<Range> Internals::subrange(Range& range, int rangeLocation, int rangeLength)
+Ref<Range> Internals::subrange(Range& range, int rangeLocation, int rangeLength)
 {
     return TextIterator::subrange(&range, rangeLocation, rangeLength);
 }
@@ -1441,7 +1441,7 @@
 ExceptionOr<RefPtr<Range>> Internals::rangeForDictionaryLookupAtLocation(int x, int y)
 {
 #if PLATFORM(MAC)
-    Document* document = contextDocument();
+    auto* document = contextDocument();
     if (!document || !document->frame())
         return Exception { INVALID_ACCESS_ERR };
 
@@ -1856,11 +1856,10 @@
 
 RefPtr<DOMWindow> Internals::openDummyInspectorFrontend(const String& url)
 {
-    Page* inspectedPage = contextDocument()->frame()->page();
-    RefPtr<DOMWindow> window = inspectedPage->mainFrame().document()->domWindow();
-    RefPtr<DOMWindow> frontendWindow = window->open(url, "", "", *window, *window);
+    auto* inspectedPage = contextDocument()->frame()->page();
+    auto* window = inspectedPage->mainFrame().document()->domWindow();
+    auto frontendWindow = window->open(url, "", "", *window, *window);
     m_inspectorFrontend = std::make_unique<InspectorStubFrontend>(*inspectedPage, frontendWindow.copyRef());
-
     return frontendWindow;
 }
 
@@ -2563,13 +2562,13 @@
 #endif
 }
 
-RefPtr<ArrayBuffer> Internals::serializeObject(PassRefPtr<SerializedScriptValue> value) const
+Ref<ArrayBuffer> Internals::serializeObject(const RefPtr<SerializedScriptValue>& value) const
 {
     auto& bytes = value->data();
     return ArrayBuffer::create(bytes.data(), bytes.size());
 }
 
-RefPtr<SerializedScriptValue> Internals::deserializeBuffer(ArrayBuffer& buffer) const
+Ref<SerializedScriptValue> Internals::deserializeBuffer(ArrayBuffer& buffer) const
 {
     Vector<uint8_t> bytes;
     bytes.append(static_cast<const uint8_t*>(buffer.data()), buffer.byteLength());
@@ -2578,8 +2577,7 @@
 
 bool Internals::isFromCurrentWorld(JSC::JSValue value) const
 {
-    ASSERT(value);
-    JSC::ExecState& state = *contextDocument()->vm().topCallFrame;
+    auto& state = *contextDocument()->vm().topCallFrame;
     return !value.isObject() || &worldForDOMObject(asObject(value)) == &currentWorld(&state);
 }
 
@@ -2600,7 +2598,7 @@
 
 void Internals::enableAutoSizeMode(bool enabled, int minimumWidth, int minimumHeight, int maximumWidth, int maximumHeight)
 {
-    Document* document = contextDocument();
+    auto* document = contextDocument();
     if (!document || !document->view())
         return;
     document->view()->enableAutoSizeMode(enabled, IntSize(minimumWidth, minimumHeight), IntSize(maximumWidth, maximumHeight));
@@ -2607,21 +2605,24 @@
 }
 
 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
+
 void Internals::initializeMockCDM()
 {
-    CDM::registerCDMFactory([](CDM* cdm) { return std::make_unique<MockCDM>(cdm); },
+    CDM::registerCDMFactory([] (CDM* cdm) { return std::make_unique<MockCDM>(cdm); },
         MockCDM::supportsKeySystem, MockCDM::supportsKeySystemAndMimeType);
 }
+
 #endif
 
 #if ENABLE(ENCRYPTED_MEDIA)
+
 Ref<MockCDMFactory> Internals::registerMockCDM()
 {
     return MockCDMFactory::create();
 }
+
 #endif
 
-
 String Internals::markerTextForListItem(Element& element)
 {
     return WebCore::markerTextForListItem(&element);
@@ -3487,10 +3488,9 @@
 
 RefPtr<GCObservation> Internals::observeGC(JSC::JSValue value)
 {
-    if (!value || value.isNull() || value.isUndefined() || !value.getObject())
+    if (!value.isObject())
         return nullptr;
-
-    return GCObservation::create(value.getObject());
+    return GCObservation::create(asObject(value));
 }
 
 void Internals::setUserInterfaceLayoutDirection(UserInterfaceLayoutDirection userInterfaceLayoutDirection)

Modified: trunk/Source/WebCore/testing/Internals.h (210322 => 210323)


--- trunk/Source/WebCore/testing/Internals.h	2017-01-05 08:08:11 UTC (rev 210322)
+++ trunk/Source/WebCore/testing/Internals.h	2017-01-05 08:46:10 UTC (rev 210323)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2012 Google Inc. All rights reserved.
- * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -111,7 +111,7 @@
     void clearPageCache();
     unsigned pageCacheSize() const;
 
-    RefPtr<CSSComputedStyleDeclaration> computedStyleIncludingVisitedInfo(Element&) const;
+    Ref<CSSComputedStyleDeclaration> computedStyleIncludingVisitedInfo(Element&) const;
 
     Node* ensureUserAgentShadowRoot(Element& host);
     Node* shadowRoot(Element& host);
@@ -199,7 +199,7 @@
     unsigned locationFromRange(Element& scope, const Range&);
     unsigned lengthFromRange(Element& scope, const Range&);
     String rangeAsText(const Range&);
-    RefPtr<Range> subrange(Range&, int rangeLocation, int rangeLength);
+    Ref<Range> subrange(Range&, int rangeLocation, int rangeLength);
     ExceptionOr<RefPtr<Range>> rangeForDictionaryLookupAtLocation(int x, int y);
 
     ExceptionOr<void> setDelegatesScrolling(bool enabled);
@@ -351,8 +351,8 @@
     ExceptionOr<void> updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node*);
     unsigned layoutCount() const;
 
-    RefPtr<ArrayBuffer> serializeObject(PassRefPtr<SerializedScriptValue>) const;
-    RefPtr<SerializedScriptValue> deserializeBuffer(ArrayBuffer&) const;
+    Ref<ArrayBuffer> serializeObject(const RefPtr<SerializedScriptValue>&) const;
+    Ref<SerializedScriptValue> deserializeBuffer(ArrayBuffer&) const;
 
     bool isFromCurrentWorld(JSC::JSValue) const;
 

Modified: trunk/Source/WebCore/testing/Internals.idl (210322 => 210323)


--- trunk/Source/WebCore/testing/Internals.idl	2017-01-05 08:08:11 UTC (rev 210322)
+++ trunk/Source/WebCore/testing/Internals.idl	2017-01-05 08:46:10 UTC (rev 210323)
@@ -153,7 +153,7 @@
     [MayThrowException] DOMString inspectorHighlightObject();
 
     [MayThrowException] unsigned long markerCountForNode(Node node, DOMString markerType);
-    [MayThrowException] Range markerRangeForNode(Node node, DOMString markerType, unsigned long index);
+    [MayThrowException] Range? markerRangeForNode(Node node, DOMString markerType, unsigned long index);
     [MayThrowException] DOMString markerDescriptionForNode(Node node, DOMString markerType, unsigned long index);
     [MayThrowException] DOMString dumpMarkerRects(DOMString markerType);
     void addTextMatchMarker(Range range, boolean isActive);
@@ -187,12 +187,12 @@
 
     [MayThrowException] void scrollElementToRect(Element element, long x, long y, long w, long h);
 
-    Range rangeFromLocationAndLength(Element scope, long rangeLocation, long rangeLength);
+    Range? rangeFromLocationAndLength(Element scope, long rangeLocation, long rangeLength);
     unsigned long locationFromRange(Element scope, Range range);
     unsigned long lengthFromRange(Element scope, Range range);
     DOMString rangeAsText(Range range);
     Range subrange(Range range, long rangeLocation, long rangeLength);
-    [MayThrowException] Range rangeForDictionaryLookupAtLocation(long x, long y);
+    [MayThrowException] Range? rangeForDictionaryLookupAtLocation(long x, long y);
 
     [MayThrowException] void setDelegatesScrolling(boolean enabled);
 
@@ -208,7 +208,7 @@
     [MayThrowException] unsigned long wheelEventHandlerCount();
     [MayThrowException] unsigned long touchEventHandlerCount();
 
-    [MayThrowException] NodeList nodesFromRect(Document document, long x, long y,
+    [MayThrowException] NodeList? nodesFromRect(Document document, long x, long y,
         unsigned long topPadding, unsigned long rightPadding, unsigned long bottomPadding, unsigned long leftPadding,
         boolean ignoreClipping, boolean allowShadowContent, boolean allowChildFrameContent);
 
@@ -253,7 +253,7 @@
 
     [MayThrowException] DOMString scrollingStateTreeAsText();
     [MayThrowException] DOMString mainThreadScrollingReasons(); // FIXME: rename to synchronousScrollingReasons().
-    [MayThrowException] ClientRectList nonFastScrollableRects();
+    [MayThrowException] ClientRectList? nonFastScrollableRects();
 
     [MayThrowException] DOMString repaintRectsAsText();
 
@@ -283,7 +283,7 @@
 
     unsigned long numberOfLiveNodes();
     unsigned long numberOfLiveDocuments();
-    DOMWindow openDummyInspectorFrontend(DOMString url);
+    DOMWindow? openDummyInspectorFrontend(DOMString url);
     void closeDummyInspectorFrontend();
     [MayThrowException] void setInspectorIsUnderTest(boolean isUnderTest);
 
@@ -369,7 +369,7 @@
     DOMString toolTipFromElement(Element element);
 
     SerializedScriptValue deserializeBuffer(ArrayBuffer buffer);
-    ArrayBuffer serializeObject(SerializedScriptValue obj);
+    ArrayBuffer serializeObject(SerializedScriptValue object);
 
     boolean isFromCurrentWorld(any obj);
 
@@ -446,7 +446,7 @@
 
     void setPageDefersLoading(boolean defersLoading);
 
-    File createFile(DOMString url);
+    File? createFile(DOMString url);
     void queueMicroTask(long testNumber);
     boolean testPreloaderSettingViewport();
 
@@ -488,7 +488,7 @@
     
     boolean isProcessingUserGesture();
 
-    GCObservation observeGC(any observed);
+    GCObservation? observeGC(any observed);
 
     void setUserInterfaceLayoutDirection(UserInterfaceLayoutDirection userInterfaceLayoutDirection);
     void setBaseWritingDirection(BaseWritingDirection direction);

Modified: trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp (210322 => 210323)


--- trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp	2017-01-05 08:08:11 UTC (rev 210322)
+++ trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp	2017-01-05 08:46:10 UTC (rev 210323)
@@ -48,9 +48,9 @@
 {
 }
 
-Ref<WorkerGlobalScope> DedicatedWorkerThread::createWorkerGlobalScope(const URL& url, const String& identifier, const String& userAgent, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin)
+Ref<WorkerGlobalScope> DedicatedWorkerThread::createWorkerGlobalScope(const URL& url, const String& identifier, const String& userAgent, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders, bool shouldBypassMainWorldContentSecurityPolicy, RefPtr<SecurityOrigin>&& topOrigin)
 {
-    return DedicatedWorkerGlobalScope::create(url, identifier, userAgent, *this, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, topOrigin, idbConnectionProxy(), socketProvider());
+    return DedicatedWorkerGlobalScope::create(url, identifier, userAgent, *this, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, WTFMove(topOrigin), idbConnectionProxy(), socketProvider());
 }
 
 void DedicatedWorkerThread::runEventLoop()

Modified: trunk/Source/WebCore/workers/DedicatedWorkerThread.h (210322 => 210323)


--- trunk/Source/WebCore/workers/DedicatedWorkerThread.h	2017-01-05 08:08:11 UTC (rev 210322)
+++ trunk/Source/WebCore/workers/DedicatedWorkerThread.h	2017-01-05 08:46:10 UTC (rev 210323)
@@ -49,7 +49,7 @@
     WorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; }
 
 protected:
-    Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& identifier, const String& userAgent, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin) override;
+    Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& identifier, const String& userAgent, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, RefPtr<SecurityOrigin>&& topOrigin) override;
     void runEventLoop() override;
 
 private:

Modified: trunk/Source/WebCore/workers/Worker.cpp (210322 => 210323)


--- trunk/Source/WebCore/workers/Worker.cpp	2017-01-05 08:08:11 UTC (rev 210322)
+++ trunk/Source/WebCore/workers/Worker.cpp	2017-01-05 08:46:10 UTC (rev 210323)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008-2017 Apple Inc. All Rights Reserved.
  * Copyright (C) 2009 Google Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -54,7 +54,7 @@
 inline Worker::Worker(ScriptExecutionContext& context, JSC::RuntimeFlags runtimeFlags)
     : ActiveDOMObject(&context)
     , m_identifier("worker:" + Inspector::IdentifiersFactory::createIdentifier())
-    , m_contextProxy(WorkerGlobalScopeProxy::create(this))
+    , m_contextProxy(WorkerGlobalScopeProxy::create(*this))
     , m_runtimeFlags(runtimeFlags)
 {
     if (!allWorkers) {
@@ -62,7 +62,7 @@
         networkStateNotifier().addNetworkStateChangeListener(networkStateChanged);
     }
 
-    HashSet<Worker*>::AddResult addResult = allWorkers->add(this);
+    auto addResult = allWorkers->add(this);
     ASSERT_UNUSED(addResult, addResult.isNewEntry);
 }
 
@@ -98,7 +98,7 @@
     ASSERT(isMainThread());
     ASSERT(scriptExecutionContext()); // The context is protected by worker context proxy, so it cannot be destroyed while a Worker exists.
     allWorkers->remove(this);
-    m_contextProxy->workerObjectDestroyed();
+    m_contextProxy.workerObjectDestroyed();
 }
 
 ExceptionOr<void> Worker::postMessage(JSC::ExecState& state, JSC::JSValue messageValue, Vector<JSC::Strong<JSC::JSObject>>&& transfer)
@@ -112,13 +112,13 @@
     auto channels = MessagePort::disentanglePorts(WTFMove(ports));
     if (channels.hasException())
         return channels.releaseException();
-    m_contextProxy->postMessageToWorkerGlobalScope(message.releaseReturnValue(), channels.releaseReturnValue());
+    m_contextProxy.postMessageToWorkerGlobalScope(message.releaseReturnValue(), channels.releaseReturnValue());
     return { };
 }
 
 void Worker::terminate()
 {
-    m_contextProxy->terminateWorkerGlobalScope();
+    m_contextProxy.terminateWorkerGlobalScope();
 }
 
 bool Worker::canSuspendForDocumentSuspension() const
@@ -139,12 +139,12 @@
 
 bool Worker::hasPendingActivity() const
 {
-    return m_contextProxy->hasPendingActivity() || ActiveDOMObject::hasPendingActivity();
+    return m_contextProxy.hasPendingActivity() || ActiveDOMObject::hasPendingActivity();
 }
 
 void Worker::notifyNetworkStateChange(bool isOnLine)
 {
-    m_contextProxy->notifyNetworkStateChange(isOnLine);
+    m_contextProxy.notifyNetworkStateChange(isOnLine);
 }
 
 void Worker::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
@@ -161,7 +161,7 @@
         dispatchEvent(Event::create(eventNames().errorEvent, false, true));
     else {
         const ContentSecurityPolicyResponseHeaders& contentSecurityPolicyResponseHeaders = m_contentSecurityPolicyResponseHeaders ? m_contentSecurityPolicyResponseHeaders.value() : scriptExecutionContext()->contentSecurityPolicy()->responseHeaders();
-        m_contextProxy->startWorkerGlobalScope(m_scriptLoader->url(), scriptExecutionContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), contentSecurityPolicyResponseHeaders, m_shouldBypassMainWorldContentSecurityPolicy, m_runtimeFlags);
+        m_contextProxy.startWorkerGlobalScope(m_scriptLoader->url(), scriptExecutionContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), contentSecurityPolicyResponseHeaders, m_shouldBypassMainWorldContentSecurityPolicy, m_runtimeFlags);
         InspectorInstrumentation::scriptImported(*scriptExecutionContext(), m_scriptLoader->identifier(), m_scriptLoader->script());
     }
     m_scriptLoader = nullptr;

Modified: trunk/Source/WebCore/workers/Worker.h (210322 => 210323)


--- trunk/Source/WebCore/workers/Worker.h	2017-01-05 08:08:11 UTC (rev 210322)
+++ trunk/Source/WebCore/workers/Worker.h	2017-01-05 08:46:10 UTC (rev 210323)
@@ -80,7 +80,7 @@
 
     RefPtr<WorkerScriptLoader> m_scriptLoader;
     String m_identifier;
-    WorkerGlobalScopeProxy* m_contextProxy; // The proxy outlives the worker to perform thread shutdown.
+    WorkerGlobalScopeProxy& m_contextProxy; // The proxy outlives the worker to perform thread shutdown.
     std::optional<ContentSecurityPolicyResponseHeaders> m_contentSecurityPolicyResponseHeaders;
     bool m_shouldBypassMainWorldContentSecurityPolicy { false };
     JSC::RuntimeFlags m_runtimeFlags;

Modified: trunk/Source/WebCore/workers/WorkerGlobalScopeProxy.h (210322 => 210323)


--- trunk/Source/WebCore/workers/WorkerGlobalScopeProxy.h	2017-01-05 08:08:11 UTC (rev 210322)
+++ trunk/Source/WebCore/workers/WorkerGlobalScopeProxy.h	2017-01-05 08:46:10 UTC (rev 210323)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2017 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
@@ -30,35 +31,29 @@
 
 #pragma once
 
-#include "MessagePort.h"
-#include "WorkerThread.h"
-#include <memory>
-#include <wtf/Forward.h>
+#include "MessagePortChannel.h"
+#include <runtime/RuntimeFlags.h>
 
 namespace WebCore {
 
-    class ContentSecurityPolicyResponseHeaders;
-    class URL;
-    class Worker;
+class ContentSecurityPolicyResponseHeaders;
+class URL;
+class Worker;
 
-    // A proxy to talk to the worker context.
-    class WorkerGlobalScopeProxy {
-    public:
-        static WorkerGlobalScopeProxy* create(Worker*);
+// A proxy to talk to the worker context.
+class WorkerGlobalScopeProxy {
+public:
+    static WorkerGlobalScopeProxy& create(Worker&);
 
-        virtual ~WorkerGlobalScopeProxy() { }
+    virtual void startWorkerGlobalScope(const URL& scriptURL, const String& userAgent, const String& sourceCode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, JSC::RuntimeFlags) = 0;
+    virtual void terminateWorkerGlobalScope() = 0;
+    virtual void postMessageToWorkerGlobalScope(RefPtr<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>) = 0;
+    virtual bool hasPendingActivity() const = 0;
+    virtual void workerObjectDestroyed() = 0;
+    virtual void notifyNetworkStateChange(bool isOnline) = 0;
 
-        virtual void startWorkerGlobalScope(const URL& scriptURL, const String& userAgent, const String& sourceCode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, JSC::RuntimeFlags) = 0;
+protected:
+    virtual ~WorkerGlobalScopeProxy() { }
+};
 
-        virtual void terminateWorkerGlobalScope() = 0;
-
-        virtual void postMessageToWorkerGlobalScope(RefPtr<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>) = 0;
-
-        virtual bool hasPendingActivity() const = 0;
-
-        virtual void workerObjectDestroyed() = 0;
-
-        virtual void notifyNetworkStateChange(bool isOnline) = 0;
-    };
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp (210322 => 210323)


--- trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp	2017-01-05 08:08:11 UTC (rev 210322)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp	2017-01-05 08:46:10 UTC (rev 210323)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2016 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008-2017 Apple Inc. All Rights Reserved.
  * Copyright (C) 2009 Google Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,7 +34,6 @@
 #include "DedicatedWorkerThread.h"
 #include "Document.h"
 #include "ErrorEvent.h"
-#include "Event.h"
 #include "EventNames.h"
 #include "MessageEvent.h"
 #include "PageGroup.h"
@@ -48,21 +47,16 @@
 
 namespace WebCore {
 
-WorkerGlobalScopeProxy* WorkerGlobalScopeProxy::create(Worker* worker)
+WorkerGlobalScopeProxy& WorkerGlobalScopeProxy::create(Worker& worker)
 {
-    return new WorkerMessagingProxy(worker);
+    return *new WorkerMessagingProxy(worker);
 }
 
-WorkerMessagingProxy::WorkerMessagingProxy(Worker* workerObject)
-    : m_scriptExecutionContext(workerObject->scriptExecutionContext())
-    , m_inspectorProxy(std::make_unique<WorkerInspectorProxy>(workerObject->identifier()))
-    , m_workerObject(workerObject)
-    , m_mayBeDestroyed(false)
-    , m_unconfirmedMessageCount(0)
-    , m_workerThreadHadPendingActivity(false)
-    , m_askedToTerminate(false)
+WorkerMessagingProxy::WorkerMessagingProxy(Worker& workerObject)
+    : m_scriptExecutionContext(workerObject.scriptExecutionContext())
+    , m_inspectorProxy(std::make_unique<WorkerInspectorProxy>(workerObject.identifier()))
+    , m_workerObject(&workerObject)
 {
-    ASSERT(m_workerObject);
     ASSERT((is<Document>(*m_scriptExecutionContext) && isMainThread())
         || (is<WorkerGlobalScope>(*m_scriptExecutionContext) && currentThread() == downcast<WorkerGlobalScope>(*m_scriptExecutionContext).thread().threadID()));
 }
@@ -94,12 +88,12 @@
     SocketProvider* socketProvider = nullptr;
 #endif
 
-    RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptURL, identifier, userAgent, sourceCode, *this, *this, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, document.topOrigin(), proxy, socketProvider, runtimeFlags);
+    auto thread = DedicatedWorkerThread::create(scriptURL, identifier, userAgent, sourceCode, *this, *this, startMode, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, document.topOrigin(), proxy, socketProvider, runtimeFlags);
 
-    workerThreadCreated(thread);
+    workerThreadCreated(thread.get());
     thread->start();
 
-    m_inspectorProxy->workerStarted(m_scriptExecutionContext.get(), thread.get(), scriptURL);
+    m_inspectorProxy->workerStarted(m_scriptExecutionContext.get(), thread.ptr(), scriptURL);
 }
 
 void WorkerMessagingProxy::postMessageToWorkerObject(RefPtr<SerializedScriptValue>&& message, std::unique_ptr<MessagePortChannelArray> channels)
@@ -174,9 +168,9 @@
     });
 }
 
-void WorkerMessagingProxy::workerThreadCreated(PassRefPtr<DedicatedWorkerThread> workerThread)
+void WorkerMessagingProxy::workerThreadCreated(DedicatedWorkerThread& workerThread)
 {
-    m_workerThread = workerThread;
+    m_workerThread = &workerThread;
 
     if (m_askedToTerminate) {
         // Worker.terminate() could be called from JS before the thread was created.

Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.h (210322 => 210323)


--- trunk/Source/WebCore/workers/WorkerMessagingProxy.h	2017-01-05 08:08:11 UTC (rev 210322)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.h	2017-01-05 08:46:10 UTC (rev 210323)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008-2017 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -25,79 +25,69 @@
 
 #pragma once
 
-#include "ScriptExecutionContext.h"
 #include "WorkerGlobalScopeProxy.h"
 #include "WorkerLoaderProxy.h"
 #include "WorkerObjectProxy.h"
-#include <memory>
-#include <wtf/Forward.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
 
 namespace WebCore {
 
-    class ContentSecurityPolicyResponseHeaders;
-    class DedicatedWorkerThread;
-    class Worker;
-    class WorkerInspectorProxy;
+class DedicatedWorkerThread;
+class WorkerInspectorProxy;
 
-    class WorkerMessagingProxy : public WorkerGlobalScopeProxy, public WorkerObjectProxy, public WorkerLoaderProxy {
-        WTF_MAKE_NONCOPYABLE(WorkerMessagingProxy); WTF_MAKE_FAST_ALLOCATED;
-    public:
-        explicit WorkerMessagingProxy(Worker*);
+class WorkerMessagingProxy final : public WorkerGlobalScopeProxy, public WorkerObjectProxy, public WorkerLoaderProxy {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    explicit WorkerMessagingProxy(Worker&);
 
-        // Implementations of WorkerGlobalScopeProxy.
-        // (Only use these methods in the worker object thread.)
-        void startWorkerGlobalScope(const URL& scriptURL, const String& userAgent, const String& sourceCode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, JSC::RuntimeFlags) override;
-        void terminateWorkerGlobalScope() override;
-        void postMessageToWorkerGlobalScope(RefPtr<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>) override;
-        bool hasPendingActivity() const override;
-        void workerObjectDestroyed() override;
-        void notifyNetworkStateChange(bool isOnline) override;
+private:
+    virtual ~WorkerMessagingProxy();
 
-        // Implementations of WorkerObjectProxy.
-        // (Only use these methods in the worker context thread.)
-        void postMessageToWorkerObject(RefPtr<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>) override;
-        void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL) override;
-        void postMessageToPageInspector(const String&) override;
-        void confirmMessageFromWorkerObject(bool hasPendingActivity) override;
-        void reportPendingActivity(bool hasPendingActivity) override;
-        void workerGlobalScopeClosed() override;
-        void workerGlobalScopeDestroyed() override;
+    // Implementations of WorkerGlobalScopeProxy.
+    // (Only use these functions in the worker object thread.)
+    void startWorkerGlobalScope(const URL& scriptURL, const String& userAgent, const String& sourceCode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, JSC::RuntimeFlags) final;
+    void terminateWorkerGlobalScope() final;
+    void postMessageToWorkerGlobalScope(RefPtr<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>) final;
+    bool hasPendingActivity() const final;
+    void workerObjectDestroyed() final;
+    void notifyNetworkStateChange(bool isOnline) final;
 
-        // Implementation of WorkerLoaderProxy.
-        // These methods are called on different threads to schedule loading
-        // requests and to send callbacks back to WorkerGlobalScope.
-        void postTaskToLoader(ScriptExecutionContext::Task&&) override;
-        bool postTaskForModeToWorkerGlobalScope(ScriptExecutionContext::Task&&, const String& mode) override;
+    // Implementations of WorkerObjectProxy.
+    // (Only use these functions in the worker context thread.)
+    void postMessageToWorkerObject(RefPtr<SerializedScriptValue>&&, std::unique_ptr<MessagePortChannelArray>) final;
+    void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL) final;
+    void postMessageToPageInspector(const String&) final;
+    void confirmMessageFromWorkerObject(bool hasPendingActivity) final;
+    void reportPendingActivity(bool hasPendingActivity) final;
+    void workerGlobalScopeClosed() final;
+    void workerGlobalScopeDestroyed() final;
 
-        void workerThreadCreated(PassRefPtr<DedicatedWorkerThread>);
+    // Implementation of WorkerLoaderProxy.
+    // These functions are called on different threads to schedule loading
+    // requests and to send callbacks back to WorkerGlobalScope.
+    void postTaskToLoader(ScriptExecutionContext::Task&&) final;
+    bool postTaskForModeToWorkerGlobalScope(ScriptExecutionContext::Task&&, const String& mode) final;
 
-        // Only use this method on the worker object thread.
-        bool askedToTerminate() const { return m_askedToTerminate; }
+    void workerThreadCreated(DedicatedWorkerThread&);
 
-    protected:
-        virtual ~WorkerMessagingProxy();
+    // Only use this method on the worker object thread.
+    bool askedToTerminate() const { return m_askedToTerminate; }
 
-    private:
-        void workerGlobalScopeDestroyedInternal();
-        void reportPendingActivityInternal(bool confirmingMessage, bool hasPendingActivity);
-        Worker* workerObject() const { return m_workerObject; }
+    void workerGlobalScopeDestroyedInternal();
+    void reportPendingActivityInternal(bool confirmingMessage, bool hasPendingActivity);
+    Worker* workerObject() const { return m_workerObject; }
 
-        RefPtr<ScriptExecutionContext> m_scriptExecutionContext;
-        std::unique_ptr<WorkerInspectorProxy> m_inspectorProxy;
-        Worker* m_workerObject;
-        bool m_mayBeDestroyed;
-        RefPtr<DedicatedWorkerThread> m_workerThread;
+    RefPtr<ScriptExecutionContext> m_scriptExecutionContext;
+    std::unique_ptr<WorkerInspectorProxy> m_inspectorProxy;
+    Worker* m_workerObject;
+    bool m_mayBeDestroyed { false };
+    RefPtr<DedicatedWorkerThread> m_workerThread;
 
-        unsigned m_unconfirmedMessageCount; // Unconfirmed messages from worker object to worker thread.
-        bool m_workerThreadHadPendingActivity; // The latest confirmation from worker thread reported that it was still active.
+    unsigned m_unconfirmedMessageCount { 0 }; // Unconfirmed messages from worker object to worker thread.
+    bool m_workerThreadHadPendingActivity { false }; // The latest confirmation from worker thread reported that it was still active.
 
-        bool m_askedToTerminate;
+    bool m_askedToTerminate { false };
 
-        Vector<std::unique_ptr<ScriptExecutionContext::Task>> m_queuedEarlyTasks; // Tasks are queued here until there's a thread object created.
-    };
+    Vector<std::unique_ptr<ScriptExecutionContext::Task>> m_queuedEarlyTasks; // Tasks are queued here until there's a thread object created.
+};
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/workers/WorkerThread.h (210322 => 210323)


--- trunk/Source/WebCore/workers/WorkerThread.h	2017-01-05 08:08:11 UTC (rev 210322)
+++ trunk/Source/WebCore/workers/WorkerThread.h	2017-01-05 08:46:10 UTC (rev 210323)
@@ -29,7 +29,6 @@
 #include <memory>
 #include <runtime/RuntimeFlags.h>
 #include <wtf/Forward.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
@@ -84,7 +83,7 @@
     WorkerThread(const URL&, const String& identifier, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, const SecurityOrigin* topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*, JSC::RuntimeFlags);
 
     // Factory method for creating a new worker context for the thread.
-    virtual Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& identifier, const String& userAgent, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, PassRefPtr<SecurityOrigin> topOrigin) = 0;
+    virtual Ref<WorkerGlobalScope> createWorkerGlobalScope(const URL&, const String& identifier, const String& userAgent, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, RefPtr<SecurityOrigin>&& topOrigin) = 0;
 
     // Executes the event loop for the worker thread. Derived classes can override to perform actions before/after entering the event loop.
     virtual void runEventLoop();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to