diff options
| author | 2020-08-06 15:30:45 +0100 | |
|---|---|---|
| committer | 2020-08-26 15:09:50 +0000 | |
| commit | a78906e9d78b554ee508d0677b29f26e8e859adf (patch) | |
| tree | 7fd8c0b602c6488a93763a4d0161f8be2de0173e | |
| parent | aa3588350bd483db207055b9481b0a57b2245122 (diff) | |
Introduce compilation / loading hooks to the PaletteHooks interface.
Test: m
Bug: 162715919
Bug: 134558686
Change-Id: Ib355daeb8fb7ea06798e1374322a5c5d8e038c85
| -rw-r--r-- | libartpalette/include/palette/palette_hooks.h | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/libartpalette/include/palette/palette_hooks.h b/libartpalette/include/palette/palette_hooks.h index 2f5e3bd03b..14e7b3f912 100644 --- a/libartpalette/include/palette/palette_hooks.h +++ b/libartpalette/include/palette/palette_hooks.h @@ -25,15 +25,37 @@ extern "C" { // Functions provided by the Palette Hooks object, called by ART. typedef struct paletteHooksInterface_ { - // TODO: add functions. Currently only one field to ensure the struct has a - // size. - void* empty; + // Notify the Hooks object that dex2oat is starting compilation of the given + // `source_fd` dex/apk/zip file, and will generate .art/.oat/.vdex files with + // the given file descriptors. + void (*NotifyStartDex2oatCompilation)(int source_fd, int art_fd, int oat_fd, int vdex_fd); + + // Notify the Hooks object that dex2oat has ended compilation of the given + // `source_fd` dex/apk/zip file, and has written the contents into the given file descriptors. + void (*NotifyEndDex2oatCompilation)(int source_fd, int art_fd, int oat_fd, int vdex_fd); + + // Notify the Hooks object that the runtime is loading a dex file. + void (*NotifyDexFileLoaded)(const char* path); + + // Notify the Hooks object that the runtime is loading a .oat file. + void (*NotifyOatFileLoaded)(const char* path); } paletteHooksInterface; struct PaletteHooks { const struct paletteHooksInterface_* functions; #ifdef __cplusplus - // TODO: Add member functions. + void NotifyStartDex2oatCompilation(int source_fd, int art_fd, int oat_fd, int vdex_fd) { + return functions->NotifyStartDex2oatCompilation(source_fd, art_fd, oat_fd, vdex_fd); + } + void NotifyEndDex2oatCompilation(int source_fd, int art_fd, int oat_fd, int vdex_fd) { + return functions->NotifyEndDex2oatCompilation(source_fd, art_fd, oat_fd, vdex_fd); + } + void NotifyDexFileLoaded(const char* path) { + return functions->NotifyDexFileLoaded(path); + } + void NotifyOatFileLoaded(const char* path) { + return functions->NotifyOatFileLoaded(path); + } #endif }; |