LGTM

On Wed, Aug 3, 2011 at 4:17 PM, <[email protected]> wrote:

> Well, a generator has to keep it's own state anyway, in practice.  In
> the case of AbstractClientBundleGenerator, it actually creates a
> ResourceContext and passes that around, along with the GeneratorContext
> (this was before any IncrementalGenerator enhancements).  In the case of
> RPC, there are 2 SerializableTypeOracleBuilders and the GeneratorContext
> that get passed around.
>
> I'm not sure, it sounds like you are asking to have a generic
> functionality for the GeneratorContext, so generators can park data
> there as needed (not really specific to IncrementalGenerators).  What
> would the semantics be, would it always get added to the cache in
> entirety, or is there a separate api for saving data for current state
> and another for specifically placing data that needs to be cached?  Is
> it cleared when each new generator invocation occurs?
>
> Since this change is not attempting to modify how the framework behaves
> with respect to legacy generators, I'd rather not invent api in this
> patch that's not related to the task at hand.
>
> Using your example, before any IncrementalGenerator work, both
> ClientBundle and RPC look similar to your first example (e.g. there's
> both a GeneratorContext and helperCachedData passed around everywhere).
> The only change I've done is to add a way (without modifying current
> generators), to prepare extra data for subsequent cache reuse checking.
> In fact, the client data stored for cache reuse checking is generally
> newly prepared data, not really needed unless caching is enabled.  So,
> the way things work now, are very similar to the current state, but with
> cache  use support added at the beginning (to check reusability) and at
> the end (to prepare and remember data for future checking).  Like so:
>
>
> generateIncrementally(**TreeLogger logger, GeneratorContext context,
> String
> typeName) {
>
>  if (checkCacheReusability(**context))
>    return new RebindResult(RebindMode.USE_**CACHE,...)
>
>  // this part is no different for non-incremental generators
>  MyGeneratorStateClass generatorState;
>  new HelperOne(context, generatorState).run();
>  new HelperTwo(context, generatorState).run();
>
>  if (canBeCacheable(context)) {
>    // possibly expensive task
>    PreparedClientData pcd = prepareClientData(context, helperData);
>
>
>    RebindResult result = new RebindResult(USE_WHATEVER, typeName +
> "Impl");
>    result.putClientData("pcd", pcd);
>
>    return result;
>  } else {
>    // no need to prepare any client data
>    return new RebindResult(RebindMode.USE_**ALL_NEW_WITH_NO_CACHING,...);
>
>  }
> }
>
> http://gwt-code-reviews.**appspot.com/1468804/<http://gwt-code-reviews.appspot.com/1468804/>
>

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to