Package com.google.gwt.dev.javac.rebind

Examples of com.google.gwt.dev.javac.rebind.CachedRebindResult


        if (rule == null) {
          return typeName;
        }
       
        CachedRebindResult cachedResult = rebindCacheGet(rule, typeName);
        if (cachedResult != null) {
          genCtx.setCachedGeneratorResult(cachedResult);
        }
       
        // realize the rule (call a generator, or do type replacement, etc.)
View Full Code Here


           */
          break;

        case USE_ALL_NEW:
          // use all new results, add a new cache entry
          cachedResult = new CachedRebindResult(newResult.getReturnedTypeName(),
              genCtx.getArtifacts(), genCtx.getGeneratedUnitMap(),
              System.currentTimeMillis(), newResult.getClientDataMap());
          rebindCachePut(rule, typeName, cachedResult);
          break;

        case USE_ALL_CACHED:
          // use all cached results
          assert (cachedResult != null);

          genCtx.commitArtifactsFromCache(logger);
          genCtx.addGeneratedUnitsFromCache();

          // use cached type name
          resultTypeName = cachedResult.getReturnedTypeName();
          break;

        case USE_PARTIAL_CACHED:
          /*
           * Add cached generated units marked for reuse to the context. 
           * TODO(jbrosenberg): add support for reusing artifacts as well
           * as GeneratedUnits.
           */
          genCtx.addGeneratedUnitsMarkedForReuseFromCache();

          /*
           * Create a new cache entry using the composite set of new and
           * reused cached results currently in genCtx.
           */
          cachedResult = new CachedRebindResult(newResult.getReturnedTypeName(),
              genCtx.getArtifacts(), genCtx.getGeneratedUnitMap(),
              System.currentTimeMillis(), newResult.getClientDataMap());
          rebindCachePut(rule, typeName, cachedResult);
          break;
      }
View Full Code Here

   * Check dependent resources for cacheability.
   */
  private boolean checkDependentResourceCacheability(TreeLogger logger,
      GeneratorContextExt genContext, ResourceContext resourceContext) {

    CachedRebindResult lastRebindResult = genContext.getCachedGeneratorResult();

    if (lastRebindResult == null
        || !genContext.isGeneratorResultCachingEnabled()) {
      return false;
    }
    long lastTimeGenerated = lastRebindResult.getTimeGenerated();

    // check that resource URL's haven't moved, and haven't been modified
    @SuppressWarnings("unchecked")
    Map<String, URL> cachedResolvedResources = (Map<String, URL>)
      lastRebindResult.getClientData(CACHED_RESOURCE_INFORMATION);
   
    if (cachedResolvedResources == null) {
      return false;
    }
   
View Full Code Here

   * Check properties for cacheability
   */
  private boolean checkPropertyCacheability(TreeLogger logger,
      GeneratorContextExt genContext) {

    CachedRebindResult lastRebindResult = genContext.getCachedGeneratorResult();

    if (lastRebindResult == null
        || !genContext.isGeneratorResultCachingEnabled()) {
      return false;
    }

    /*
     * Do a check of deferred-binding and configuration properties, comparing
     * the cached values saved previously with the current properties.
     */
    CachedPropertyInformation cpi = (CachedPropertyInformation)
        lastRebindResult.getClientData(CACHED_PROPERTY_INFORMATION);
     
    return cpi != null && cpi.checkPropertiesWithPropertyOracle(logger,
        genContext.getPropertyOracle());
  }
View Full Code Here

  /*
   * Check source types for cacheability
   */
  private boolean checkSourceTypeCacheability(GeneratorContextExt genContext) {

    CachedRebindResult lastRebindResult = genContext.getCachedGeneratorResult();

    if (lastRebindResult == null
        || !genContext.isGeneratorResultCachingEnabled()) {
      return false;
    }

    /*
     * Do a check over the cached list of types that were previously flagged as
     * required.  Check that none of these types has undergone a version change
     * since the previous cached result was generated.
     */
    @SuppressWarnings("unchecked")
    Map<String, String> cachedTypeSignatures = (Map<String, String>)
      lastRebindResult.getClientData(CACHED_TYPE_INFORMATION);

    return cachedTypeSignatures != null
      && checkCachedTypeSignatures(genContext, cachedTypeSignatures);
  }
View Full Code Here

   * Otherwise return false.
   */
  private boolean findCacheableFieldSerializerAndMarkForReuseIfAvailable(
      GeneratorContextExt ctx, JType type) {
   
    CachedRebindResult lastResult = ctx.getCachedGeneratorResult();
    if (lastResult == null || !ctx.isGeneratorResultCachingEnabled()) {
      return false;
    }
   
    String fieldSerializerName =
      SerializationUtils.getStandardSerializerName((JClassType) type);
   
    if (type instanceof JClassType) {
      // check that it is available for reuse
      if (!lastResult.isTypeCached(fieldSerializerName)) {
        return false;
      }
    } else {
      return false;
    }
         
    try {
      /*
       * TODO(jbrosenberg): Change this check to use getVersion() from
       * TypeOracle, once that is available.
       */
      long lastModified = ctx.getSourceLastModifiedTime((JClassType) type);
     
      if (lastModified != 0L &&
          lastModified < lastResult.getTimeGenerated()) {
       
        // use cached version 
        return ctx.reuseTypeFromCacheIfAvailable(fieldSerializerName);
      }
    } catch (RuntimeException ex) {
View Full Code Here

   * Check dependent resources for cacheability.
   */
  private boolean checkDependentResourceCacheability(TreeLogger logger,
      GeneratorContextExt genContext, ResourceContext resourceContext) {

    CachedRebindResult lastRebindResult = genContext.getCachedGeneratorResult();

    if (lastRebindResult == null
        || !genContext.isGeneratorResultCachingEnabled()) {
      return false;
    }
    long lastTimeGenerated = lastRebindResult.getTimeGenerated();

    // check that resource URL's haven't moved, and haven't been modified
    @SuppressWarnings("unchecked")
    Map<String, URL> cachedResolvedResources = (Map<String, URL>)
      lastRebindResult.getClientData(CACHED_RESOURCE_INFORMATION);
   
    if (cachedResolvedResources == null) {
      return false;
    }
   
View Full Code Here

   * Check properties for cacheability
   */
  private boolean checkPropertyCacheability(TreeLogger logger,
      GeneratorContextExt genContext) {

    CachedRebindResult lastRebindResult = genContext.getCachedGeneratorResult();

    if (lastRebindResult == null
        || !genContext.isGeneratorResultCachingEnabled()) {
      return false;
    }

    /*
     * Do a check of deferred-binding and configuration properties, comparing
     * the cached values saved previously with the current properties.
     */
    CachedPropertyInformation cpi = (CachedPropertyInformation)
        lastRebindResult.getClientData(CACHED_PROPERTY_INFORMATION);
     
    return cpi != null && cpi.checkPropertiesWithPropertyOracle(logger,
        genContext.getPropertyOracle());
  }
View Full Code Here

  /*
   * Check source types for cacheability
   */
  private boolean checkSourceTypeCacheability(TreeLogger logger, GeneratorContextExt genContext) {

    CachedRebindResult lastRebindResult = genContext.getCachedGeneratorResult();

    if (lastRebindResult == null
        || !genContext.isGeneratorResultCachingEnabled()) {
      return false;
    }

    /*
     * Do a check over the cached list of types that were previously flagged as
     * required.  Check that none of these types has undergone a version change
     * since the previous cached result was generated.
     */
    @SuppressWarnings("unchecked")
    Map<String, Long> cachedTypeLastModifiedTimes = (Map<String, Long>)
      lastRebindResult.getClientData(CACHED_TYPE_INFORMATION);

    return cachedTypeLastModifiedTimes != null
      && checkCachedTypeLastModifiedTimes(logger, genContext, cachedTypeLastModifiedTimes);
  }
View Full Code Here

   * return false.
   */
  private boolean findCacheableFieldSerializerAndMarkForReuseIfAvailable(TreeLogger logger,
      GeneratorContextExt ctx, JType type) {

    CachedRebindResult lastResult = ctx.getCachedGeneratorResult();
    if (lastResult == null || !ctx.isGeneratorResultCachingEnabled()) {
      return false;
    }

    String fieldSerializerName = SerializationUtils.getStandardSerializerName((JClassType) type);

    if (type instanceof JClassType) {
      // check that it is available for reuse
      if (!lastResult.isTypeCached(fieldSerializerName)) {
        return false;
      }
    } else {
      return false;
    }

    @SuppressWarnings("unchecked")
    Map<String, Long> cachedLastModifiedTimes =
        (Map<String, Long>) lastResult.getClientData(CACHED_TYPE_INFO_KEY);
    String sourceName = type.getQualifiedSourceName();

    assert cachedLastModifiedTimes != null;
    assert typeLastModifiedTimeMap.get(sourceName) != null;
    boolean foundMatch = false;
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.javac.rebind.CachedRebindResult

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.