We adopted DevToolsAgent and DevToolsProtocolHandler from Google Chrome to our WebKit Android NDK port
In Google Chrome, important protocols for Google Chrome Developer Tools for Java are ChromeDevToolsProtocol and V8 Debugger Protocol which are processed by DevToolsProtocolHandler and DevToolsAgent repectively. We modified and reimplemented DevToolsProtocolHandler and DevToolsAgent using Java, because WebKit layer of WebKit Android NDK port used Java.
DevToolsProtocolHandler acts as a server. It opens and listens a port. If ChromeDevTools tries to connect to it, then it starts working. It receives and parses the ChromeDevToolsProtocol message, then it responds to ChromeDevTools for Java, and it calls DevToolsAgent functions with V8 Debugger Protocol messages that are in ChromeDevToolsProtocol messages.
DevToolsAgent is a part of WebView. Its lifecycle equals to WebView. Its main role is to pass V8 Debugger Protocol messages from DevToolsProtocolHandler to V8 engine, and vice versa. Another role is to serve as a handler of system messages when breakpoint stops V8 engine.
Google Chrome Developer Tools for Java