Move some more assorted classes from ExceptionCode to Exception
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Oct 2016 18:32:04 +0000 (18:32 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Oct 2016 18:32:04 +0000 (18:32 +0000)
commit6bfe112c3413a73569e3f20c4f060077703c6668
tree8ce1c5697ed37e97ee98b570f6475a8d4e88c4aa
parent4d83df1d0b58fdd485aea3a124f30e194123770d
Move some more assorted classes from ExceptionCode to Exception
https://bugs.webkit.org/show_bug.cgi?id=163775

Reviewed by Chris Dumez.

* Modules/fetch/WorkerGlobalScopeFetch.cpp:
(WebCore::WorkerGlobalScopeFetch::fetch): Remove unnecessary calls to
WorkerGlobalScope::scriptExcutionObject, which just returns the scope itself.

* Modules/notifications/Notification.cpp: Added now-needed include.
* Modules/webdatabase/DOMWindowWebDatabase.cpp: Ditto.

* WebCore.xcodeproj/project.pbxproj: Added WindowOrWorkerGlobalScope.idl.

* bindings/js/JSDedicatedWorkerGlobalScopeCustom.cpp:
(WebCore::JSDedicatedWorkerGlobalScope::postMessage): Pass a reference instead
of a pointer to handlePostMessage.
* bindings/js/JSMessagePortCustom.cpp:
(WebCore::JSMessagePort::postMessage): Ditto.

* bindings/js/JSMessagePortCustom.h: Use pragma once. Change handlePostMessage
to take a reference to the object instead of a pointer, and also to use
propagateException since postMessage now uses ExceptionOr.

* bindings/js/JSWorkerCustom.cpp:
(WebCore::JSWorker::postMessage): Pass a reference instead of a pointer to
handlePostMessage.
(WebCore::constructJSWorker): Use the version of toJSNewlyCreated that handles
propagating an exception from ExceptionOr.

* bindings/js/JSWorkerGlobalScopeCustom.cpp:
(WebCore::JSWorkerGlobalScope::visitAdditionalChildren): Use auto.
Remove unnecessary round trip through the scriptExecutionContext function.
(WebCore::JSWorkerGlobalScope::importScripts): Use reserveInitialCapacity and
uncheckedAppend to build up the vector of strings. Use propagateException
to deal with ExceptionOr result.

* dom/MessagePort.cpp:
(WebCore::MessagePort::MessagePort): Initialize boolean data members in the
class definition instead of here.
(WebCore::MessagePort::postMessage): Use ExceptionOr.
(WebCore::MessagePort::entangle): Use an rvalue reference.
(WebCore::MessagePort::dispatchMessages): Use ExceptionOr.
(WebCore::MessagePort::disentanglePorts): Ditto. Also use a more efficient
idiom that does half as much hashing as the old algorithm, and got rid an
unneeded local variable.
(WebCore::MessagePort::entanglePorts): Use an rvalue reference.
* dom/MessagePort.h: Updated for above changes.

* fileapi/FileReader.cpp:
(WebCore::FileReader::create): Use auto.
(WebCore::FileReader::FileReader): Initialize scalars in the class definition.
(WebCore::FileReader::~FileReader): Call cancel on the loader directly
instead of sharing code with the stop function.
(WebCore::FileReader::stop): Moved the body of the terminate function here.
(WebCore::FileReader::readAsArrayBuffer): Use ExceptionOr.
(WebCore::FileReader::readAsBinaryString): Ditto.
(WebCore::FileReader::readAsText): Ditto.
(WebCore::FileReader::readAsDataURL): Ditto.
(WebCore::FileReader::readInternal): Ditto. Also add a cast now that
we derive privately from FileReaderLoaderClient.
(WebCore::FileReader::abort): Call stop instead of terminate.
(WebCore::FileReader::terminate): Deleted. Moved code into stop.
(WebCore::FileReader::didReceiveData): Moved comment to where the constant is.
* fileapi/FileReader.h: Updated for above changes. Made more functions private
and used final instead of override.
* fileapi/FileReader.idl: Use non-legacy exceptions.

* fileapi/FileReaderSync.cpp:
(WebCore::FileReaderSync::readAsArrayBuffer): Use ExceptionOr.
(WebCore::FileReaderSync::readAsBinaryString): Ditto.
(WebCore::FileReaderSync::readAsText): Ditto.
(WebCore::FileReaderSync::readAsDataURL): Ditto.
(WebCore::FileReaderSync::startLoading): Ditto.
(WebCore::FileReaderSync::startLoadingString): Added. Helper to cut down on
repeated code in functions above.
* fileapi/FileReaderSync.h: Updated for above changes.
* fileapi/FileReaderSync.idl: Use non-legacy exceptions.

* page/Base64Utilities.cpp:
(WebCore::Base64Utilities::btoa): Use ExceptionOr.
(WebCore::Base64Utilities::atob): Ditto.
* page/Base64Utilities.h: Updated for above changes.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::navigator): Pass a reference to the frame.
(WebCore::DOMWindow::postMessage): Use ExceptionOr when calling
MessagePort::disentanglePorts. Also udpated for changes to the
PostMessageTimer.

* page/Navigator.cpp:
(WebCore::Navigator::Navigator): Take a reference.
(WebCore::shouldHideFourDot): Ditto
(WebCore::Navigator::appVersion): Pass a reference.
(WebCore::Navigator::plugins): Return a reference.
(WebCore::Navigator::mimeTypes): Ditto.
* page/Navigator.h: Updated for above changes. Also marked the
class final and moved derivation from RefCounted to NavigatorBase.

* page/NavigatorBase.h: Addded derivation from RefCounted since
both derived classes want that, and the destructor is already virtual.

* page/WindowOrWorkerGlobalScope.idl: Use non-legacy exceptions.

* page/WorkerNavigator.cpp:
(WebCore::WorkerNavigator::~WorkerNavigator): Deleted.

* page/WorkerNavigator.h: Moved derivation from RefCounted to
NavigatorBase. Also marked class final.

* workers/AbstractWorker.cpp:
(WebCore::AbstractWorker::resolveURL): Use ExceptionOr.
* workers/AbstractWorker.h: Updated for above changes.

* workers/DedicatedWorkerGlobalScope.cpp:
(WebCore::DedicatedWorkerGlobalScope::create): Use RefPtr&&
instead of PassRefPtr.
(WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
Ditto.
(WebCore::DedicatedWorkerGlobalScope::postMessage): Use ExceptionOr.
(WebCore::DedicatedWorkerGlobalScope::importScripts): Ditto.
* workers/DedicatedWorkerGlobalScope.h: Updated for above changes.
* workers/DedicatedWorkerGlobalScope.idl: Use non-legacy exceptions.

* workers/Worker.cpp:
(WebCore::Worker::create): Use ExceptionOr.
(WebCore::Worker::postMessage): Ditto.
* workers/Worker.h: Updated for above changes.
* workers/Worker.idl: Use non-legacy exception.

* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::WorkerGlobalScope): Moved initialization
of m_closing to class definition.
(WebCore::WorkerGlobalScope::~WorkerGlobalScope): Removed call to
deleted notifyObserversOfStop function.
(WebCore::WorkerGlobalScope::importScripts): Use ExceptionOr. Also use
reserveInitialCapacity and uncheckedAppend to build a vector.
(WebCore::WorkerGlobalScope::addConsoleMessage): Use an rvalue reference.
Also moved the body of one of the addMessageToWorkerConsole overloads into
one of the overloads of this function, and changed the other to call addMessage.
(WebCore::WorkerGlobalScope::addMessage): Moved the body of the other
addMessageToWorkerConsole here.
(WebCore::WorkerGlobalScope::addMessageToWorkerConsole): Deleted.
(WebCore::WorkerGlobalScope::Observer::Observer): Deleted.
(WebCore::WorkerGlobalScope::Observer::~Observer): Deleted.
(WebCore::WorkerGlobalScope::Observer::stopObserving): Deleted.
(WebCore::WorkerGlobalScope::registerObserver): Deleted.
(WebCore::WorkerGlobalScope::unregisterObserver): Deleted.
(WebCore::WorkerGlobalScope::notifyObserversOfStop): Deleted.
* workers/WorkerGlobalScope.h: Removed unneeded includes. Moved many virtual
function overrides into the private section. Marked many functions final instead
of just override. Removed unused Observer class and m_workerObservers set.

* workers/WorkerThread.cpp:
(WebCore::WorkerThread::stop): Removed call to deleted
WorkerGlobalScope::notifyObserversOfStop function.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@207687 268f45cc-cd09-0410-ab3c-d52691b4dbfc
38 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/WorkerGlobalScopeFetch.cpp
Source/WebCore/Modules/notifications/Notification.cpp
Source/WebCore/Modules/webdatabase/DOMWindowWebDatabase.cpp
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSDedicatedWorkerGlobalScopeCustom.cpp
Source/WebCore/bindings/js/JSMessagePortCustom.cpp
Source/WebCore/bindings/js/JSMessagePortCustom.h
Source/WebCore/bindings/js/JSWorkerCustom.cpp
Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp
Source/WebCore/dom/MessagePort.cpp
Source/WebCore/dom/MessagePort.h
Source/WebCore/fileapi/FileReader.cpp
Source/WebCore/fileapi/FileReader.h
Source/WebCore/fileapi/FileReader.idl
Source/WebCore/fileapi/FileReaderSync.cpp
Source/WebCore/fileapi/FileReaderSync.h
Source/WebCore/fileapi/FileReaderSync.idl
Source/WebCore/page/Base64Utilities.cpp
Source/WebCore/page/Base64Utilities.h
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/Navigator.cpp
Source/WebCore/page/Navigator.h
Source/WebCore/page/NavigatorBase.h
Source/WebCore/page/WindowOrWorkerGlobalScope.idl
Source/WebCore/page/WorkerNavigator.cpp
Source/WebCore/page/WorkerNavigator.h
Source/WebCore/workers/AbstractWorker.cpp
Source/WebCore/workers/AbstractWorker.h
Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp
Source/WebCore/workers/DedicatedWorkerGlobalScope.h
Source/WebCore/workers/DedicatedWorkerGlobalScope.idl
Source/WebCore/workers/Worker.cpp
Source/WebCore/workers/Worker.h
Source/WebCore/workers/Worker.idl
Source/WebCore/workers/WorkerGlobalScope.cpp
Source/WebCore/workers/WorkerGlobalScope.h
Source/WebCore/workers/WorkerThread.cpp