Fixes failures related to stats collection w.r.t. long emulation across JSNI boundaries.

Patch by: jaimeyap
Review by: me


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2155 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Stats.java b/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Stats.java
index baf6b7e..ec48262 100644
--- a/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Stats.java
+++ b/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Stats.java
@@ -36,7 +36,7 @@
   }-*/;
 
   static native JavaScriptObject makeTimeStat() /*-{
-    return {millis : @java.lang.System::currentTimeMillis()()};
+    return {millis : (new Date()).getTime()};
   }-*/;
 
   static native boolean stats(String moduleName, String system, String event,
diff --git a/user/src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java b/user/src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java
index 9f43a29..79832ce 100644
--- a/user/src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java
+++ b/user/src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java
@@ -37,11 +37,11 @@
   /**
    * A global id to track any given request.
    */
-  private static long requestId;
+  private static int requestId;
 
-  public static native JavaScriptObject bytesStat(String method, long count,
-      long bytes) /*-{
-    var stat = @com.google.gwt.user.client.rpc.impl.RemoteServiceProxy::timeStat(Ljava/lang/String;J)(method, count);
+  public static native JavaScriptObject bytesStat(String method, int count,
+      int bytes) /*-{
+    var stat = @com.google.gwt.user.client.rpc.impl.RemoteServiceProxy::timeStat(Ljava/lang/String;I)(method, count);
     stat.bytes = bytes;
     return stat;
   }-*/;
@@ -55,26 +55,26 @@
 
   /**
    * Always use this as {@link #isStatsAvailable()} &&
-   * {@link #stats(String, String, long)}.
+   * {@link #stats(String, String, int)}.
    */
   public static native boolean stats(String invocation, JavaScriptObject data) /*-{
     return $stats(@com.google.gwt.core.client.GWT::getModuleName()(), 'rpc',
       invocation, data);
   }-*/;
 
-  public static native JavaScriptObject timeStat(String method, long count) /*-{
+  public static native JavaScriptObject timeStat(String method, int count) /*-{
     return {
       id: count,
       method: method,
-      millis: @java.lang.System::currentTimeMillis()()
+      millis: (new Date()).getTime()
     };
   }-*/;
 
-  protected static long getNextRequestId() {
+  protected static int getNextRequestId() {
     return requestId++;
   }
 
-  protected static long getRequestId() {
+  protected static int getRequestId() {
     return requestId;
   }
 
@@ -222,7 +222,7 @@
    */
   @SuppressWarnings("unused")
   protected <T> Request doInvoke(ResponseReader responseReader,
-      String methodName, long invocationCount, String requestData,
+      String methodName, int invocationCount, String requestData,
       AsyncCallback<T> callback) {
 
     if (getServiceEntryPoint() == null) {
diff --git a/user/src/com/google/gwt/user/client/rpc/impl/RequestCallbackAdapter.java b/user/src/com/google/gwt/user/client/rpc/impl/RequestCallbackAdapter.java
index fe77f9c..6ec2ee4 100644
--- a/user/src/com/google/gwt/user/client/rpc/impl/RequestCallbackAdapter.java
+++ b/user/src/com/google/gwt/user/client/rpc/impl/RequestCallbackAdapter.java
@@ -143,7 +143,7 @@
   /**
    * Used for stats recording.
    */
-  private final long requestId;
+  private final int requestId;
 
   /**
    * Instance which will read the expected return type out of the
@@ -158,7 +158,7 @@
   private final SerializationStreamFactory streamFactory;
 
   public RequestCallbackAdapter(SerializationStreamFactory streamFactory,
-      String methodName, long requestId, AsyncCallback<T> callback,
+      String methodName, int requestId, AsyncCallback<T> callback,
       ResponseReader responseReader) {
     assert (streamFactory != null);
     assert (callback != null);