Attempt to simplify IPC message dispatching logic in WebKit2
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Oct 2012 21:02:35 +0000 (21:02 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Oct 2012 21:02:35 +0000 (21:02 +0000)
commit1d78b2ba0fff8dfab807d3398d95adaae6ec38b3
treea480c8a598aee164f84da6a6178724b008e6edd9
parente5ac1882d16634652d8aaa8d7ba22f9db1dd6a40
Attempt to simplify IPC message dispatching logic in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=98097

Reviewed by Sam Weinig.

Move the Connection::MessageReceiver class to its own header file. Add a MessageReceiverMap helper class
that will be used for dispatching messages based on message class (and eventually destination ID).

Convert AuthenticationManager and WebGeolocationManager over to this new mechanism.

* CMakeLists.txt:
* GNUmakefile.list.am:
Add new files.

* Platform/CoreIPC/Connection.cpp:
(CoreIPC::Connection::dispatchMessage):
Check with the message receiver map first before calling Connection::Client::didReceiveMessage.

* Platform/CoreIPC/Connection.h:
(CoreIPC::Connection::addMessageReceiver):
Call through to the message receiver map.

* Platform/CoreIPC/MessageID.h:
(CoreIPC::MessageID::messageClass):
Rename MessageClassReserved to MessageClassInvalid.

(MessageID):
* Platform/CoreIPC/MessageReceiver.h:
Move MessageReceiver from Connection.h to its own file.

* Platform/CoreIPC/MessageReceiverMap.cpp:
New helper class.

(CoreIPC::MessageReceiverMap::addMessageReceiver):
Add the receiver to the map of receivers.

(CoreIPC::MessageReceiverMap::dispatchMessage):
Check if we have any registered receivers for this message class.

* Platform/CoreIPC/MessageReceiverMap.h:
New file.

* Target.pri:
Add new files.

* WebKit2.xcodeproj/project.pbxproj:
Add new files.

* WebProcess/Authentication/AuthenticationManager.cpp:
(WebKit::AuthenticationManager::AuthenticationManager):
* WebProcess/Authentication/AuthenticationManager.h:
(AuthenticationManager):
Register the authentication manager as a message receiver.

* WebProcess/Geolocation/WebGeolocationManager.cpp:
(WebKit::WebGeolocationManager::WebGeolocationManager):
* WebProcess/Geolocation/WebGeolocationManager.h:
(WebGeolocationManager):
Register the geolocation manager as a message receiver.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::didReceiveMessage):
Remove checks for authentication manager and geolocation manager messages.

* win/WebKit2.vcproj:
Add new files.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@130207 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebKit2/CMakeLists.txt
Source/WebKit2/ChangeLog
Source/WebKit2/GNUmakefile.list.am
Source/WebKit2/Platform/CoreIPC/Connection.cpp
Source/WebKit2/Platform/CoreIPC/Connection.h
Source/WebKit2/Platform/CoreIPC/MessageID.h
Source/WebKit2/Platform/CoreIPC/MessageReceiver.h [new file with mode: 0644]
Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.cpp [new file with mode: 0644]
Source/WebKit2/Platform/CoreIPC/MessageReceiverMap.h [new file with mode: 0644]
Source/WebKit2/Target.pri
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp
Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h
Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.cpp
Source/WebKit2/WebProcess/Geolocation/WebGeolocationManager.h
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/win/WebKit2.vcproj