diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2020-08-03 10:46:39 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2020-08-05 16:20:16 +0000 |
commit | 3d22dbb67085bf27e27e55e9b5ab32c5619334f9 (patch) | |
tree | 49b3a69c6f0ba467f72f67d8fb2c88d350746fe8 /libartpalette | |
parent | 9c7b4f1f50cfecc8ac8a8db27ab3434384ec5fab (diff) |
Create an empty hooks data structure in palette.
To enable reporting ART information to the platform.
Bug: 162715919
Test: m
Change-Id: I799ddea1bf07df486204a24ec69a76c470e787db
Diffstat (limited to 'libartpalette')
-rw-r--r-- | libartpalette/apex/palette.cc | 6 | ||||
-rw-r--r-- | libartpalette/apex/palette_test.cc | 6 | ||||
-rw-r--r-- | libartpalette/include/palette/palette.h | 1 | ||||
-rw-r--r-- | libartpalette/include/palette/palette_hooks.h | 44 | ||||
-rw-r--r-- | libartpalette/include/palette/palette_method_list.h | 3 | ||||
-rw-r--r-- | libartpalette/libartpalette.map.txt | 1 | ||||
-rw-r--r-- | libartpalette/system/palette_fake.cc | 5 |
7 files changed, 65 insertions, 1 deletions
diff --git a/libartpalette/apex/palette.cc b/libartpalette/apex/palette.cc index e0697c6a11..bc447bfc15 100644 --- a/libartpalette/apex/palette.cc +++ b/libartpalette/apex/palette.cc @@ -163,4 +163,10 @@ enum PaletteStatus PaletteAshmemSetProtRegion(int fd, int prot) { return m(fd, prot); } +enum PaletteStatus PaletteGetHooks(PaletteHooks** hooks) { + PaletteGetHooksMethod m = + PaletteLoader::Instance().GetPaletteGetHooksMethod(); + return m(hooks); +} + } // extern "C" diff --git a/libartpalette/apex/palette_test.cc b/libartpalette/apex/palette_test.cc index 8bbe0eeffc..3946b18164 100644 --- a/libartpalette/apex/palette_test.cc +++ b/libartpalette/apex/palette_test.cc @@ -62,3 +62,9 @@ TEST_F(PaletteClientTest, Trace) { EXPECT_EQ(PaletteStatus::kOkay, PaletteTraceEnd()); EXPECT_EQ(PaletteStatus::kOkay, PaletteTraceIntegerValue("Beans", /*value=*/ 3)); } + +TEST_F(PaletteClientTest, GetHooks) { + PaletteHooks* hooks = nullptr; + PaletteStatus status = PaletteGetHooks(&hooks); + ASSERT_TRUE(status == PaletteStatus::kOkay || status == PaletteStatus::kNotSupported); +} diff --git a/libartpalette/include/palette/palette.h b/libartpalette/include/palette/palette.h index 1f58403e99..85484072a4 100644 --- a/libartpalette/include/palette/palette.h +++ b/libartpalette/include/palette/palette.h @@ -17,6 +17,7 @@ #ifndef ART_LIBARTPALETTE_INCLUDE_PALETTE_PALETTE_H_ #define ART_LIBARTPALETTE_INCLUDE_PALETTE_PALETTE_H_ +#include "palette_hooks.h" #include "palette_types.h" #ifdef __cplusplus diff --git a/libartpalette/include/palette/palette_hooks.h b/libartpalette/include/palette/palette_hooks.h new file mode 100644 index 0000000000..2f5e3bd03b --- /dev/null +++ b/libartpalette/include/palette/palette_hooks.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ART_LIBARTPALETTE_INCLUDE_PALETTE_PALETTE_HOOKS_H_ +#define ART_LIBARTPALETTE_INCLUDE_PALETTE_PALETTE_HOOKS_H_ + +#include "palette_types.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// 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; +} paletteHooksInterface; + +struct PaletteHooks { + const struct paletteHooksInterface_* functions; +#ifdef __cplusplus + // TODO: Add member functions. +#endif +}; + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // ART_LIBARTPALETTE_INCLUDE_PALETTE_PALETTE_HOOKS_H_ diff --git a/libartpalette/include/palette/palette_method_list.h b/libartpalette/include/palette/palette_method_list.h index 1140399f6d..559e3f482e 100644 --- a/libartpalette/include/palette/palette_method_list.h +++ b/libartpalette/include/palette/palette_method_list.h @@ -31,6 +31,7 @@ M(PaletteTraceEnd) \ M(PaletteTraceIntegerValue, const char* name, int32_t value) \ M(PaletteAshmemCreateRegion, const char* name, size_t size, int* fd) \ - M(PaletteAshmemSetProtRegion, int, int) + M(PaletteAshmemSetProtRegion, int, int) \ + M(PaletteGetHooks, /*out*/PaletteHooks**) #endif // ART_LIBARTPALETTE_INCLUDE_PALETTE_PALETTE_METHOD_LIST_H_ diff --git a/libartpalette/libartpalette.map.txt b/libartpalette/libartpalette.map.txt index d2c90d5873..c5564f0749 100644 --- a/libartpalette/libartpalette.map.txt +++ b/libartpalette/libartpalette.map.txt @@ -27,6 +27,7 @@ LIBARTPALETTE_1 { PaletteTraceIntegerValue; PaletteAshmemCreateRegion; PaletteAshmemSetProtRegion; + PaletteGetHooks; local: *; diff --git a/libartpalette/system/palette_fake.cc b/libartpalette/system/palette_fake.cc index dc0ee76f80..6fff433a75 100644 --- a/libartpalette/system/palette_fake.cc +++ b/libartpalette/system/palette_fake.cc @@ -87,3 +87,8 @@ enum PaletteStatus PaletteAshmemSetProtRegion(int fd ATTRIBUTE_UNUSED, int prot ATTRIBUTE_UNUSED) { return PaletteStatus::kNotSupported; } + +enum PaletteStatus PaletteGetHooks(PaletteHooks** hooks) { + *hooks = nullptr; + return PaletteStatus::kNotSupported; +} |