Revision: 7897
Author: [email protected]
Date: Thu Apr 8 13:25:31 2010
Log: ShmFutex channel is now working with Showcase. Still need client-side
retry
and liveness detection.
http://code.google.com/p/google-web-toolkit/source/detail?r=7897
Modified:
/changes/jat/csproto/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
/changes/jat/csproto/dev/core/src/com/google/gwt/dev/shell/ModuleSpaceOOPHM.java
/changes/jat/csproto/dev/core/src/com/google/gwt/dev/shell/ShellJavaScriptHost.java
/changes/jat/csproto/plugins/common/HostChannel.cpp
/changes/jat/csproto/plugins/common/LoadJsniMessage.cpp
/changes/jat/csproto/plugins/common/LoadModuleMessage.cpp
/changes/jat/csproto/plugins/common/ShmFutexTransport.cpp
/changes/jat/csproto/plugins/xpcom/Makefile
=======================================
---
/changes/jat/csproto/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
Fri Mar 19 08:12:41 2010
+++
/changes/jat/csproto/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
Thu Apr 8 13:25:31 2010
@@ -70,7 +70,7 @@
/**
* An isolated {...@link ClassLoader} for running all user code. All user
files are
- * compiled from source code byte a {...@link ByteCodeCompiler}. After
compilation,
+ * compiled from source code byte a ByteCodeCompiler. After compilation,
* some byte code rewriting is performed to support
* <code>JavaScriptObject</code> and its subtypes.
*
@@ -1212,7 +1212,10 @@
if (unit == null || unit.getJsniMethods() == null) {
return;
}
- shellJavaScriptHost.createNativeMethods(logger, unit.getJsniMethods(),
this);
+ TreeLogger branch = logger.branch(TreeLogger.SPAM,
+ "Injecting JSNI methods for " + unit.getTypeName());
+ shellJavaScriptHost.createNativeMethods(branch, unit.getJsniMethods(),
+ this);
}
private void maybeInitializeScriptOnlyClassLoader() {
=======================================
---
/changes/jat/csproto/dev/core/src/com/google/gwt/dev/shell/ModuleSpaceOOPHM.java
Mon Nov 23 16:21:36 2009
+++
/changes/jat/csproto/dev/core/src/com/google/gwt/dev/shell/ModuleSpaceOOPHM.java
Thu Apr 8 13:25:31 2010
@@ -49,8 +49,11 @@
// The error has been logged; just ignore it for now.
continue;
}
- jsni.append("// " + jsniMethod.location() + ":" + jsniMethod.line()
- + "\n");
+ logger.log(TreeLogger.SPAM, "Size is " + body.length() + " for "
+ + jsniMethod.name());
+ // Disable comments for now -- they are frequently larger than the
JSNI
+ // jsni.append("// " + jsniMethod.location() + ":" +
jsniMethod.line()
+ // + "\n");
jsni.append("this[\"" + jsniMethod.name() + "\"] = function(");
String[] paramNames = jsniMethod.paramNames();
for (int i = 0; i < paramNames.length; ++i) {
@@ -63,6 +66,7 @@
jsni.append(body);
jsni.append(";\n\n");
}
+ logger.log(TreeLogger.SPAM, "Total size is " + jsni.length() + "
chars");
channel.loadJsni(jsni.toString());
}
=======================================
---
/changes/jat/csproto/dev/core/src/com/google/gwt/dev/shell/ShellJavaScriptHost.java
Fri Jan 16 11:50:20 2009
+++
/changes/jat/csproto/dev/core/src/com/google/gwt/dev/shell/ShellJavaScriptHost.java
Thu Apr 8 13:25:31 2010
@@ -37,7 +37,6 @@
* Define one or more JSNI methods.
*
* @param logger
- * @param compiledClass
* @param jsniMethods
* @param dispatchIdOracle
*/
=======================================
--- /changes/jat/csproto/plugins/common/HostChannel.cpp Thu Apr 8 07:10:55
2010
+++ /changes/jat/csproto/plugins/common/HostChannel.cpp Thu Apr 8 13:25:31
2010
@@ -131,7 +131,7 @@
Debug::log(Debug::Debugging) << "Available transports:" << Debug::flush;
for (std::vector<std::string>::iterator it = transports.begin();
it != transports.end(); ++it) {
- Debug::log(Debug::Debugging) << " " << *it << Debug::flush;
+ Debug::log(Debug::Debugging) << " " << *it << Debug::flush;
}
if (!transports.empty()) {
ChooseTransportMessage::send(*this, transports);
@@ -153,16 +153,22 @@
Debug::log(Debug::Debugging) << "Server chose transport \""
<< transportName << "\", args \"" << transportArgs << "\""
<< Debug::flush;
- Transport* newTransport = TransportRegistry::createTransport(
- transportName, transportArgs);
- if (!newTransport) {
- Debug::log(Debug::Error) << "Failed to create transport"
- << transportName << ", args=" << transportArgs <<
Debug::flush;
- return false;
- }
- transport = newTransport;
- Debug::log(Debug::Debugging) << " successfully switched transport"
- << Debug::flush;
+ if (transportName.empty()) {
+ // empty transport name means to stay on the socket
+ Debug::log(Debug::Debugging) << " remaining on socket"
+ << Debug::flush;
+ } else {
+ Transport* newTransport = TransportRegistry::createTransport(
+ transportName, transportArgs);
+ if (!newTransport) {
+ Debug::log(Debug::Error) << "Failed to create transport"
+ << transportName << ", args=" << transportArgs <<
Debug::flush;
+ return false;
+ }
+ transport = newTransport;
+ Debug::log(Debug::Debugging) << " successfully switched
transport"
+ << Debug::flush;
+ }
break;
}
case MESSAGE_TYPE_FATAL_ERROR:
@@ -325,7 +331,7 @@
ReturnMessage* HostChannel::reactToMessages(SessionHandler* handler, bool
expectReturn) {
char type;
while (true) {
- Debug::log(Debug::Debugging) << "Waiting for response" << Debug::flush;
+ Debug::log(Debug::Spam) << "Waiting for response" << Debug::flush;
if (!readMessageType(&type)) {
if (isConnected()) {
Debug::log(Debug::Error) << "Failed to receive message type"
@@ -333,7 +339,7 @@
}
return 0;
}
- Debug::log(Debug::Debugging) << " got type " << int(type) <<
Debug::flush;
+ Debug::log(Debug::Spam) << " got type " << int(type) << Debug::flush;
switch (type) {
case MESSAGE_TYPE_INVOKE:
{
@@ -343,8 +349,9 @@
return 0;
}
Value returnValue;
- bool exception = handler->invoke(*this, imsg->getThis(),
imsg->getMethodName(),
- imsg->getNumArgs(), imsg->getArgs(), &returnValue);
+ bool exception = handler->invoke(*this, imsg->getThis(),
+ imsg->getMethodName(), imsg->getNumArgs(), imsg->getArgs(),
+ &returnValue);
handler->sendFreeValues(*this);
ReturnMessage::send(*this, exception, returnValue);
}
@@ -395,7 +402,7 @@
if (expectReturn) {
Debug::log(Debug::Error) << "Received QUIT while waiting for
return" << Debug::flush;
}
- disconnectFromHost();
+ disconnectFromHost();
return 0;
default:
endReadMessage();
=======================================
--- /changes/jat/csproto/plugins/common/LoadJsniMessage.cpp Thu Apr 8
07:10:55 2010
+++ /changes/jat/csproto/plugins/common/LoadJsniMessage.cpp Thu Apr 8
13:25:31 2010
@@ -22,9 +22,10 @@
char LoadJsniMessage::getType() const {
return TYPE;
}
-
+
LoadJsniMessage* LoadJsniMessage::receive(HostChannel& channel) {
HostChannelReader reader(channel);
std::string js;
+ Debug::log(Debug::Debugging) << "LoadJsniMessage::receive" <<
Debug::flush;
return channel.readString(js) ? new LoadJsniMessage(js) : 0;
}
=======================================
--- /changes/jat/csproto/plugins/common/LoadModuleMessage.cpp Thu Apr 8
07:10:55 2010
+++ /changes/jat/csproto/plugins/common/LoadModuleMessage.cpp Thu Apr 8
13:25:31 2010
@@ -46,8 +46,12 @@
return false;
}
if (!writer.end()) return false;
+ Debug::log(Debug::Debugging) << " finished writing LoadModule"
+ << Debug::flush;
scoped_ptr<ReturnMessage>
ret(channel.reactToMessagesWhileWaitingForReturn(
handler));
+ Debug::log(Debug::Debugging) << " finished waiting for return"
+ << Debug::flush;
if (!ret.get()) {
handler->loadModuleException(Value());
return false;
=======================================
--- /changes/jat/csproto/plugins/common/ShmFutexTransport.cpp Thu Apr 8
07:10:55 2010
+++ /changes/jat/csproto/plugins/common/ShmFutexTransport.cpp Thu Apr 8
13:25:31 2010
@@ -15,7 +15,7 @@
*/
#ifdef linux
-#include <cstdio>
+#include "Debug.h"
// Linux-only for now
@@ -28,31 +28,33 @@
// start reading a message, return true on success
bool ShmFutexTransport::beginReadMessage() {
- printf("beginReadMessage\n");
+ Debug::log(Debug::Spam) << "beginReadMessage" << Debug::flush;
// handle timeouts, here or in caller
bool success = shmFutex->beginClientRead(true);
+ Debug::log(Debug::Spam) << " success=" << success << Debug::flush;
readOffset = success ? 0 : ShmFutex::BUF_SIZE;
return success;
}
// mark that a complete message has been read
void ShmFutexTransport::endReadMessage() {
- printf("endReadMessage\n");
+ Debug::log(Debug::Spam) << "endReadMessage" << Debug::flush;
shmFutex->endClientRead();
}
// start a message being sent, return true on success
bool ShmFutexTransport::beginWriteMessage() {
- printf("beginWriteMessage\n");
+ Debug::log(Debug::Spam) << "beginWriteMessage" << Debug::flush;
// handle timeouts, here or in caller
bool success = shmFutex->beginClientWrite(true);
+ Debug::log(Debug::Spam) << " success=" << success << Debug::flush;
writeOffset = success ? 0 : ShmFutex::BUF_SIZE;
return success;
}
// flush any output buffer and terminate a message to send, true on success
bool ShmFutexTransport::endWriteMessage() {
- printf("endWriteMessage\n");
+ Debug::log(Debug::Spam) << "endWriteMessage" << Debug::flush;
shmFutex->endClientWrite();
return true;
}
@@ -63,11 +65,13 @@
// fragmented message, release buffer and let server refill
endReadMessage();
if (!beginReadMessage()) {
+ Debug::log(Debug::Info) << "EOF reading fragmented message"
+ << Debug::flush;
return -1;
}
readOffset = 0;
}
- return shmFutex->getServerToClientBuf()[readOffset++];
+ return shmFutex->getServerToClientBuf()[readOffset++] & 255;
}
// write a single byte to the transport, return true on success
@@ -76,6 +80,8 @@
// fragmented message, release buffer and let server refill
endWriteMessage();
if (!beginWriteMessage()) {
+ Debug::log(Debug::Info) << "EOF writing fragmented message"
+ << Debug::flush;
return false;
}
writeOffset = 0;
=======================================
--- /changes/jat/csproto/plugins/xpcom/Makefile Thu Apr 8 07:10:55 2010
+++ /changes/jat/csproto/plugins/xpcom/Makefile Thu Apr 8 13:25:31 2010
@@ -165,7 +165,7 @@
$(MAKE) lib BROWSER=ff35 ARCH=x86_64
#$(MAKE) lib BROWSER=ff36 ARCH=x86_64
-macplatforms:
+macplatforms::
$(MAKE) lib BROWSER=ff3
$(MAKE) lib BROWSER=ff35
$(MAKE) lib BROWSER=ff36
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors