Package com.google.speedtracer.client.model.DataDispatcher

Examples of com.google.speedtracer.client.model.DataDispatcher.EventRecordDispatcher


   * @param typeMap the {@link FastStringMap}
   */
  private static void setNetworkEventCallbacks(
      final NetworkEventDispatcher proxy, JsIntegerMap<EventRecordDispatcher> typeMap) {

    typeMap.put(EventRecordType.RESOURCE_SEND_REQUEST, new EventRecordDispatcher() {
      public void onEventRecord(EventRecord data) {
        proxy.onNetworkResourceStarted(data.<ResourceWillSendEvent>cast());
      }
    });

    typeMap.put(EventRecordType.RESOURCE_RECEIVE_RESPONSE, new EventRecordDispatcher() {
      public void onEventRecord(EventRecord data) {
        proxy.onNetworkResourceResponse(data.<ResourceResponseEvent>cast());
      }
    });

    typeMap.put(EventRecordType.RESOURCE_FINISH, new EventRecordDispatcher() {
      public void onEventRecord(EventRecord data) {
        ResourceFinishEvent finish = data.cast();
        proxy.onNetworkResourceFinished(finish);
      }
    });
   
    typeMap.put(EventRecordType.NETWORK_LOADING_FINISHED, new EventRecordDispatcher() {
      public void onEventRecord(EventRecord data) {
        ResourceFinishEvent finish = data.cast();
        proxy.onNetworkResourceFinished(finish);
      }
    });

    typeMap.put(EventRecordType.RESOURCE_UPDATED, new EventRecordDispatcher() {
      public void onEventRecord(EventRecord data) {
        proxy.onNetworkResourceUpdated(data.<ResourceUpdateEvent>cast());
      }
    });

    typeMap.put(EventRecordType.NETWORK_DATA_RECEIVED, new EventRecordDispatcher() {
      public void onEventRecord(EventRecord data) {
        proxy.onNetworkDataReceived(data.<NetworkDataReceivedEvent>cast());
      }
    });

    typeMap.put(EventRecordType.NETWORK_RESPONSE_RECEIVED, new EventRecordDispatcher() {
      public void onEventRecord(EventRecord data) {
        proxy.onNetworkResponseReceived(data.<NetworkResponseReceivedEvent>cast());
      }
    });

    typeMap.put(EventRecordType.NETWORK_REQUEST_WILL_BE_SENT, new EventRecordDispatcher() {
      public void onEventRecord(EventRecord data) {
        proxy.onNetworkRequestWillBeSent(data.<NetworkRequestWillBeSentEvent>cast());
      }
    });
  }
View Full Code Here


  public NetworkResource getResource(String id) {
    return resourceStore.get(id);
  }

  public void onEventRecord(EventRecord data) {
    final EventRecordDispatcher handler = typeMap.get(data.getType());
    if (handler != null) {
      handler.onEventRecord(data);
    }
  }
View Full Code Here

   */
  private static void setSpecialCasedEventCallbacks(
      final UiEventDispatcher dispatcher,
      JsIntegerMap<EventRecordDispatcher> typeMap) {

    typeMap.put(TimerCleared.TYPE, new EventRecordDispatcher() {
      public void onEventRecord(EventRecord data) {
        dispatcher.onTimerCleared(data.<TimerCleared> cast());
      }
    });

    typeMap.put(TimerInstalled.TYPE, new EventRecordDispatcher() {
      public void onEventRecord(EventRecord data) {
        dispatcher.onTimerInstalled(data.<TimerInstalled> cast());
      }
    });

    typeMap.put(ResourceResponseEvent.TYPE, new EventRecordDispatcher() {
      public void onEventRecord(EventRecord data) {
        // TODO(jaimeyap): For now we ignore this event. But this event seems to
        // measure things coming out of Application cache, and possibly XHR
        // callbacks coming out of memory cache. We should try to show this
        // properly on the sluggishness view without confusing it with Resource
        // Data Received events.
      }
    });

    typeMap.put(WindowLoadEvent.TYPE, new EventRecordDispatcher() {
      public void onEventRecord(EventRecord data) {
        List<LoadEventListener> listeners = dispatcher.loadEventListeners;
        for (int i = 0, n = listeners.size(); i < n; i++) {
          listeners.get(i).onWindowLoad(data.<WindowLoadEvent> cast());
        }
      }
    });

    typeMap.put(DomContentLoadedEvent.TYPE, new EventRecordDispatcher() {
      public void onEventRecord(EventRecord data) {
        List<LoadEventListener> listeners = dispatcher.loadEventListeners;
        for (int i = 0, n = listeners.size(); i < n; i++) {
          listeners.get(i).onDomContentLoaded(
              data.<DomContentLoadedEvent> cast());
View Full Code Here

   * If the incoming EventRecord belongs to one of the special cased types, we
   * return a proxy object to handle those types. Otherwise, we use the default
   * UiEvent dispatch proxy.
   */
  public void onEventRecord(EventRecord data) {
    final EventRecordDispatcher specialHandler = specialCasedTypeMap.get(data.getType());
    if (specialHandler != null) {
      specialHandler.onEventRecord(data);
    } else if (UiEvent.isUiEvent(data)) {
      onUiEventFinished(data.<UiEvent> cast());
    }
  }
View Full Code Here

TOP

Related Classes of com.google.speedtracer.client.model.DataDispatcher.EventRecordDispatcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.