commit | 98b9f1efa71855c361059ecbf9bb8e598bc6fda5 | [log] [tgz] |
---|---|---|
author | Noel Gordon <noel@chromium.org> | Thu Dec 13 01:37:11 2018 |
committer | Commit Bot <commit-bot@chromium.org> | Thu Dec 13 01:37:11 2018 |
tree | 9fe5b75c86591c48e5f32d99a45ed0a7457143d1 | |
parent | 49fce927d2e6687739c8a37be243386949938eb4 [diff] |
Add background externs media_import_handler.js to the Closure BUILD This change adds media_import_handler.js to the Closure BUILD and type checks it and also the externs it uses. Immediate result: many Closure compile errors since the types it uses do not have an externs file, or the constructor signatures are incomplete or just plain wrong [1]. [1] importer.MediaImportHandler.ImportTask @extends TaskQueue.BaseTask but the constructor signature in the externs file does not (Closure is not silly, and spots that error). Next issue: TaskQueue.* doesn't have an externs file, which one might use to fix the first error. Typical fix would be to use Impl pattern, add three new externs files, etc. The result would be a large, intrusive change. Simpler, type-safe methods are sought and are readily available. Closure externs can forward declare dependent class types, even define their constructors, to allow the constructor signature of the class of interest to be fully defined, complete with the dependent @param types that Closure can enforce. Use this fact in externs media_import_handler.js: forward declare, and define the constructors / interfaces as needed, of the dependent types namely, TaskQueue.*, DispositionChecker.*, that do not have an externs file. Define importer.MediaImportHandler with @params for Closure type checking. What about the implementations? Simply update the implementation JSDoc with one additional annotation line: @return undefined With that, Closure type-checks the constructor definition by comparing it with the signatures defined in the externs file, and concludes that it does match, that it does not "re-define" any externs file types. No change in test behavior. Bug: 914197 Change-Id: I15c02cd4ab83c19bef1882e77702e975fa1fdc2e Reviewed-on: https://chromium-review.googlesource.com/c/1373893 Reviewed-by: Stuart Langley <slangley@chromium.org> Commit-Queue: Noel Gordon <noel@chromium.org> Cr-Commit-Position: refs/heads/master@{#616151}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .