haikuwebkit/Source/WebKit/WebProcess/WebCoreSupport/WebSpeechRecognitionConnect...

29 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

Set up basic infrastructure for SpeechRecognition https://bugs.webkit.org/show_bug.cgi?id=218216 <rdar://problem/70703788> Reviewed by Youenn Fablet. Source/WebCore: Introduce SpeechRecognitionConnectionClient, SpeechRecognitionConnection and SpeechRecognitionServer. SpeechRecognition is a SpeechRecognitionConnectionClient that can send SpeechRecognitionRequest to SpeechRecognitionServer via SpeechRecognitionConnection. Currently we have one SpeechRecogntionConnection and one SpeechRecogntionServer per page. SpeechRecognitionServer will be responsible for handling SpeechRecognitionRequests, including audio capturing and hosting speech recognition engine, and that implementation is not included in this patch. Our current plan is put SpeechRecognitionServer in UI process (or GPU process when media code is all moved) and keep SpeechRecognitionConnectionClient in web process. Test: fast/speechrecognition/start-recognition-twice-exception.html * Headers.cmake: * Modules/speech/SpeechRecognition.cpp: (WebCore::SpeechRecognition::create): (WebCore::SpeechRecognition::SpeechRecognition): (WebCore::SpeechRecognition::startRecognition): (WebCore::SpeechRecognition::stopRecognition): (WebCore::SpeechRecognition::abortRecognition): (WebCore::SpeechRecognition::didStart): (WebCore::SpeechRecognition::didStartCapturingAudio): (WebCore::SpeechRecognition::didStartCapturingSound): (WebCore::SpeechRecognition::didStartCapturingSpeech): (WebCore::SpeechRecognition::didStopCapturingSpeech): (WebCore::SpeechRecognition::didStopCapturingSound): (WebCore::SpeechRecognition::didStopCapturingAudio): (WebCore::SpeechRecognition::didFindNoMatch): (WebCore::SpeechRecognition::didReceiveResult): (WebCore::SpeechRecognition::didError): (WebCore::SpeechRecognition::didEnd): * Modules/speech/SpeechRecognition.h: * Modules/speech/SpeechRecognitionConnection.h: Added. (WebCore::SpeechRecognitionConnection::~SpeechRecognitionConnection): * Modules/speech/SpeechRecognitionConnectionClient.h: Added. (WebCore::SpeechRecognitionConnectionClient::SpeechRecognitionConnectionClient): (WebCore::SpeechRecognitionConnectionClient::identifier const): * Modules/speech/SpeechRecognitionConnectionClientIdentifier.h: Added. * Modules/speech/SpeechRecognitionError.h: Added. (WebCore::SpeechRecognitionError::encode const): (WebCore::SpeechRecognitionError::decode): * Modules/speech/SpeechRecognitionErrorCode.h: * Modules/speech/SpeechRecognitionRequest.cpp: Added. (WebCore::SpeechRecognitionRequest::create): (WebCore::SpeechRecognitionRequest::SpeechRecognitionRequest): * Modules/speech/SpeechRecognitionRequest.h: Added. (WebCore::SpeechRecognitionRequest::clientIdentifier const): (WebCore::SpeechRecognitionRequest::lang const): (WebCore::SpeechRecognitionRequest::continuous const): (WebCore::SpeechRecognitionRequest::interimResults const): (WebCore::SpeechRecognitionRequest::maxAlternatives const): * Modules/speech/SpeechRecognitionRequestInfo.h: Added. (WebCore::SpeechRecognitionRequestInfo::encode const): (WebCore::SpeechRecognitionRequestInfo::decode): * Modules/speech/SpeechRecognitionResultData.h: Added. (WebCore::SpeechRecognitionAlternativeData::encode const): (WebCore::SpeechRecognitionAlternativeData::decode): (WebCore::SpeechRecognitionResultData::encode const): (WebCore::SpeechRecognitionResultData::decode): * Modules/speech/SpeechRecognitionResultList.h: * Modules/speech/SpeechRecognitionUpdate.cpp: Added. (WebCore::convertEnumerationToString): (WebCore::SpeechRecognitionUpdate::create): (WebCore::SpeechRecognitionUpdate::createError): (WebCore::SpeechRecognitionUpdate::createResult): (WebCore::SpeechRecognitionUpdate::SpeechRecognitionUpdate): (WebCore::SpeechRecognitionUpdate::error const): (WebCore::SpeechRecognitionUpdate::result const): * Modules/speech/SpeechRecognitionUpdate.h: Added. (WebCore::SpeechRecognitionUpdate::clientIdentifier const): (WebCore::SpeechRecognitionUpdate::type const): (WebCore::SpeechRecognitionUpdate::encode const): (WebCore::SpeechRecognitionUpdate::decode): (WTF::LogArgument<WebCore::SpeechRecognitionUpdateType>::toString): * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/TaskSource.h: * loader/EmptyClients.cpp: (WebCore::pageConfigurationWithEmptyClients): * page/Page.cpp: (WebCore::Page::Page): (WebCore::Page::speechRecognitionConnection): * page/Page.h: * page/PageConfiguration.cpp: (WebCore::PageConfiguration::PageConfiguration): * page/PageConfiguration.h: * page/DummySpeechRecognitionProvider.h: Added. * page/SpeechRecognitionProvider.h: Added. Source/WebKit: * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Scripts/webkit/messages.py: * Sources.txt: * UIProcess/SpeechRecognitionServer.cpp: Added. (WebKit::SpeechRecognitionServer::SpeechRecognitionServer): (WebKit::SpeechRecognitionServer::start): (WebKit::SpeechRecognitionServer::processNextPendingRequestIfNeeded): (WebKit::SpeechRecognitionServer::stop): (WebKit::SpeechRecognitionServer::abort): (WebKit::SpeechRecognitionServer::removePendingRequest): (WebKit::SpeechRecognitionServer::invalidate): (WebKit::SpeechRecognitionServer::startPocessingRequest): (WebKit::SpeechRecognitionServer::stopProcessingRequest): (WebKit::SpeechRecognitionServer::messageSenderConnection const): (WebKit::SpeechRecognitionServer::messageSenderDestinationID const): * UIProcess/SpeechRecognitionServer.h: Added. * UIProcess/SpeechRecognitionServer.messages.in: Added. * UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::createSpeechRecognitionServer): (WebKit::WebProcessProxy::destroySpeechRecognitionServer): * UIProcess/WebProcessProxy.h: * UIProcess/WebProcessProxy.messages.in: * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.cpp: Added. (WebKit::WebSpeechRecognitionConnection::create): (WebKit::WebSpeechRecognitionConnection::WebSpeechRecognitionConnection): (WebKit::WebSpeechRecognitionConnection::~WebSpeechRecognitionConnection): (WebKit::WebSpeechRecognitionConnection::registerClient): (WebKit::WebSpeechRecognitionConnection::start): (WebKit::WebSpeechRecognitionConnection::stop): (WebKit::WebSpeechRecognitionConnection::abort): (WebKit::WebSpeechRecognitionConnection::invalidate): (WebKit::WebSpeechRecognitionConnection::didReceiveUpdate): (WebKit::WebSpeechRecognitionConnection::messageSenderConnection const): (WebKit::WebSpeechRecognitionConnection::messageSenderDestinationID const): * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.h: Added. * WebProcess/WebCoreSupport/WebSpeechRecognitionConnection.messages.in: Added. * WebProcess/WebCoreSupport/WebSpeechRecognitionProvider.h: Added. * WebProcess/WebPage/IPCTestingAPI.cpp: (WebKit::IPCTestingAPI::encodeArgument): * WebProcess/WebPage/WebPage.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): Source/WebKitLegacy/mac: * WebView/WebView.mm: (-[WebView _commonInitializationWithFrameName:groupName:]): (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]): Source/WebKitLegacy/win: * Interfaces/IWebPreferencesPrivate.idl: * WebPreferenceKeysPrivate.h: * WebPreferences.cpp: (WebPreferences::initializeDefaultSettings): (WebPreferences::speechRecognitionEnabled): (WebPreferences::setSpeechRecognitionEnabled): * WebPreferences.h: * WebView.cpp: (WebView::initWithFrame): (WebView::notifyPreferencesChanged): Tools: * DumpRenderTree/win/DumpRenderTree.cpp: (resetWebPreferencesToConsistentValues): LayoutTests: * fast/speechrecognition/start-recognition-twice-exception-expected.txt: Added. * fast/speechrecognition/start-recognition-twice-exception.html: Added. Canonical link: https://commits.webkit.org/231192@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269348 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-11-04 01:44:02 +00:00
/*
* Copyright (C) 2020 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.
*/
messages -> WebSpeechRecognitionConnection NotRefCounted {
DidReceiveUpdate(WebCore::SpeechRecognitionUpdate update)
}