Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
renamed the Socket class to MessageDispatcher
  • Loading branch information
pmuellr committed Feb 17, 2011
1 parent 3d89113 commit 14510d79746cfe17e1a35d88ca1121ae07111405
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 46 deletions.
@@ -15,7 +15,7 @@
<script src="/weinre/common/StackTrace.transportd.js"></script>
<script src="/weinre/common/Weinre.transportd.js"></script>
<script src="/weinre/common/IDLTools.transportd.js"></script>
<script src="/weinre/common/Socket.transportd.js"></script>
<script src="/weinre/common/MessageDispatcher.transportd.js"></script>
<script src="/weinre/common/WebSocketXhr.transportd.js"></script>
<script src="/weinre/common/Binding.transportd.js"></script>
<script src="/weinre/common/Callback.transportd.js"></script>
@@ -9,7 +9,7 @@
requireClass ../common/IDLTools
requireClass ../common/Callback
requireClass ../common/Weinre
requireClass ../common/Socket
requireClass ../common/MessageDispatcher
requireClass ../common/Binding

requireClass ./InspectorBackendImpl
@@ -58,17 +58,17 @@ method initialize
window.addEventListener("load", Binding(this, "onLoaded"), false)

// create the socket
var webSocket = new Socket("../ws/client")
Weinre.webSocket = webSocket
var messageDispatcher = new MessageDispatcher("../ws/client")
Weinre.messageDispatcher = messageDispatcher

// finish setting up InspectorBackend
InspectorBackendImpl.setupProxies()

// create the client commands proxy
Weinre.WeinreClientCommands = webSocket.createProxy("WeinreClientCommands")
Weinre.WeinreClientCommands = messageDispatcher.createProxy("WeinreClientCommands")

// register WebInspector interface
webSocket.registerInterface("WebInspector", WebInspector, false)
messageDispatcher.registerInterface("WebInspector", WebInspector, false)

//-----------------------------------------------------------------------------
method uiAvailable
@@ -119,12 +119,12 @@ method onLoaded

this._installRemotePanel()

var webSocket = Weinre.webSocket
var messageDispatcher = Weinre.messageDispatcher

// Weinre.Socket.verbose(true)

webSocket.registerInterface("WeinreClientEvents", new WeinreClientEventsImpl(this), true)
webSocket.registerInterface("InspectorFrontendHost", InspectorFrontendHost, true)
messageDispatcher.registerInterface("WeinreClientEvents", new WeinreClientEventsImpl(this), true)
messageDispatcher.registerInterface("InspectorFrontendHost", InspectorFrontendHost, true)

Weinre.WeinreClientCommands.registerClient(Binding(this, this.cb_registerClient))

@@ -139,7 +139,7 @@ method cb_registerClient(clientId)
WebInspector.panels.remote.afterInitialConnection()
}

Weinre.webSocket.getWebSocket().addEventListener("close", Binding(this, this.cb_webSocketClosed))
Weinre.messageDispatcher.getWebSocket().addEventListener("close", Binding(this, this.cb_webSocketClosed))

//-----------------------------------------------------------------------------
method cb_webSocketClosed
@@ -8,13 +8,13 @@

requireClass ../common/Ex
requireClass ../common/IDLTools
requireClass ../common/Socket
requireClass ../common/MessageDispatcher
requireClass ../common/Weinre

//-----------------------------------------------------------------------------
class InspectorBackendImpl
this.registeredDomainDispatchers = {}
Socket.setInspectorBackend(this)
MessageDispatcher.setInspectorBackend(this)

//-----------------------------------------------------------------------------
static method setupProxies
@@ -36,7 +36,7 @@ static method setupProxies
]

intfNames.forEach(function(intfName) {
var proxy = Weinre.webSocket.createProxy(intfName)
var proxy = Weinre.messageDispatcher.createProxy(intfName)

var intf = IDLTools.getIDL(intfName)
if (!intf) {
@@ -9,7 +9,7 @@
requireClass ../common/Ex
requireClass ../common/Binding
requireClass ../common/Callback
requireClass ../common/Socket
requireClass ../common/MessageDispatcher
requireClass ../common/Weinre

requireClass ./NodeStore
@@ -92,8 +92,8 @@ method initialize()

window.addEventListener("load", Binding(this, "onLoaded"), false)

var webSocket = new Socket(window.WeinreServerURL + "ws/target")
Weinre.webSocket = webSocket
var messageDispatcher = new MessageDispatcher(window.WeinreServerURL + "ws/target")
Weinre.messageDispatcher = messageDispatcher

Weinre.wi = {}

@@ -111,39 +111,36 @@ method initialize()
Weinre.wi.Profiler = new WiProfilerImpl()
Weinre.wi.Runtime = new WiRuntimeImpl()

webSocket.registerInterface("ApplicationCache", Weinre.wi.ApplicationCache , true)
webSocket.registerInterface("BrowserDebugger" , Weinre.wi.BrowserDebugger , true)
webSocket.registerInterface("Console", Weinre.wi.Console , true)
webSocket.registerInterface("CSS", Weinre.wi.CSS , true)
webSocket.registerInterface("Database", Weinre.wi.Database , true)
webSocket.registerInterface("Debugger", Weinre.wi.Debugger , true)
webSocket.registerInterface("DOM", Weinre.wi.DOM , true)
webSocket.registerInterface("DOMStorage", Weinre.wi.DOMStorage , true)
webSocket.registerInterface("InjectedScript", Weinre.wi.InjectedScript , true)
webSocket.registerInterface("Inspector", Weinre.wi.Inspector , true)
webSocket.registerInterface("Network", Weinre.wi.Network , true)
webSocket.registerInterface("Profiler", Weinre.wi.Profiler , true)
webSocket.registerInterface("Runtime", Weinre.wi.Runtime , true)
messageDispatcher.registerInterface("ApplicationCache", Weinre.wi.ApplicationCache , true)
messageDispatcher.registerInterface("BrowserDebugger" , Weinre.wi.BrowserDebugger , true)
messageDispatcher.registerInterface("Console", Weinre.wi.Console , true)
messageDispatcher.registerInterface("CSS", Weinre.wi.CSS , true)
messageDispatcher.registerInterface("Database", Weinre.wi.Database , true)
messageDispatcher.registerInterface("Debugger", Weinre.wi.Debugger , true)
messageDispatcher.registerInterface("DOM", Weinre.wi.DOM , true)
messageDispatcher.registerInterface("DOMStorage", Weinre.wi.DOMStorage , true)
messageDispatcher.registerInterface("InjectedScript", Weinre.wi.InjectedScript , true)
messageDispatcher.registerInterface("Inspector", Weinre.wi.Inspector , true)
messageDispatcher.registerInterface("Network", Weinre.wi.Network , true)
messageDispatcher.registerInterface("Profiler", Weinre.wi.Profiler , true)
messageDispatcher.registerInterface("Runtime", Weinre.wi.Runtime , true)

webSocket.registerInterface("WeinreTargetEvents", new WeinreTargetEventsImpl(), true)

Weinre.wi.ApplicationCacheNotify = webSocket.createProxy("ApplicationCacheNotify")
Weinre.wi.ConsoleNotify = webSocket.createProxy("ConsoleNotify")
Weinre.wi.DOMNotify = webSocket.createProxy("DOMNotify")
Weinre.wi.DOMStorageNotify = webSocket.createProxy("DOMStorageNotify")
Weinre.wi.DatabaseNotify = webSocket.createProxy("DatabaseNotify")
Weinre.wi.DebuggerNotify = webSocket.createProxy("DebuggerNotify")
Weinre.wi.InspectorNotify = webSocket.createProxy("InspectorNotify")
Weinre.wi.NetworkNotify = webSocket.createProxy("NetworkNotify")
Weinre.wi.ProfilerNotify = webSocket.createProxy("ProfilerNotify")
Weinre.wi.TimelineNotify = webSocket.createProxy("TimelineNotify")
messageDispatcher.registerInterface("WeinreTargetEvents", new WeinreTargetEventsImpl(), true)

Weinre.wi.ApplicationCacheNotify = messageDispatcher.createProxy("ApplicationCacheNotify")
Weinre.wi.ConsoleNotify = messageDispatcher.createProxy("ConsoleNotify")
Weinre.wi.DOMNotify = messageDispatcher.createProxy("DOMNotify")
Weinre.wi.DOMStorageNotify = messageDispatcher.createProxy("DOMStorageNotify")
Weinre.wi.DatabaseNotify = messageDispatcher.createProxy("DatabaseNotify")
Weinre.wi.DebuggerNotify = messageDispatcher.createProxy("DebuggerNotify")
Weinre.wi.InspectorNotify = messageDispatcher.createProxy("InspectorNotify")
Weinre.wi.NetworkNotify = messageDispatcher.createProxy("NetworkNotify")
Weinre.wi.ProfilerNotify = messageDispatcher.createProxy("ProfilerNotify")
Weinre.wi.TimelineNotify = messageDispatcher.createProxy("TimelineNotify")

Weinre.WeinreTargetCommands = webSocket.createProxy("WeinreTargetCommands")
// window.WebInspector = webSocket.createProxy("WebInspector")
Weinre.WeinreTargetCommands = messageDispatcher.createProxy("WeinreTargetCommands")

// Weinre.Socket.verbose(true)
// webSocket.open()
webSocket._socket.addEventListener("open", Binding(this, this.cb_webSocketOpened))
messageDispatcher.getWebSocket().addEventListener("open", Binding(this, this.cb_webSocketOpened))

Weinre.nodeStore = new NodeStore()
Weinre.cssStore = new CSSStore()

0 comments on commit 14510d7

Please sign in to comment.