summaryrefslogtreecommitdiff
path: root/include/androidfw/AttributeResolution.h
blob: 2f60a1d12a209f33043ef06ef76da055016bd98e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * Copyright (C) 2016 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 ANDROIDFW_ATTRIBUTERESOLUTION_H
#define ANDROIDFW_ATTRIBUTERESOLUTION_H

#include <androidfw/ResourceTypes.h>

namespace android {

// These are all variations of the same method. They each perform the exact same operation,
// but on various data sources. I *think* they are re-written to avoid an extra branch
// in the inner loop, but after one branch miss (some pointer != null), the branch predictor should
// predict the rest of the iterations' branch correctly.
// TODO(adamlesinski): Run performance tests against these methods and a new, single method
// that uses all the sources and branches to the right ones within the inner loop.

bool resolveAttrs(ResTable::Theme* theme,
                  uint32_t defStyleAttr,
                  uint32_t defStyleRes,
                  uint32_t* srcValues, size_t srcValuesLength,
                  uint32_t* attrs, size_t attrsLength,
                  uint32_t* outValues,
                  uint32_t* outIndices);

bool applyStyle(ResTable::Theme* theme, ResXMLParser* xmlParser,
                uint32_t defStyleAttr,
                uint32_t defStyleRes,
                uint32_t* attrs, size_t attrsLength,
                uint32_t* outValues,
                uint32_t* outIndices);

bool retrieveAttributes(const ResTable* res, ResXMLParser* xmlParser,
                        uint32_t* attrs, size_t attrsLength,
                        uint32_t* outValues,
                        uint32_t* outIndices);

} // namespace android

#endif /* ANDROIDFW_ATTRIBUTERESOLUTION_H */