blob: 134f1cdee40a748d786261d97a2c8e80396948be [file] [log] [blame]
Elliott Hughes2faa5f12012-01-30 14:42:07 -08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Brian Carlstrom1f870082011-08-23 16:02:11 -070016
Brian Carlstromfc0e3212013-07-17 14:40:12 -070017#ifndef ART_RUNTIME_MIRROR_CLASS_LOADER_H_
18#define ART_RUNTIME_MIRROR_CLASS_LOADER_H_
Brian Carlstrom1f870082011-08-23 16:02:11 -070019
Ian Rogers7e70b002014-10-08 11:47:24 -070020#include "object.h"
Brian Carlstrom1f870082011-08-23 16:02:11 -070021
22namespace art {
23
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080024struct ClassLoaderOffsets;
25
26namespace mirror {
27
Ian Rogers0cfe1fb2011-08-26 03:29:44 -070028// C++ mirror of java.lang.ClassLoader
Brian Carlstromaded5f72011-10-07 17:15:04 -070029class MANAGED ClassLoader : public Object {
Mingyao Yang98d1cc82014-05-15 17:02:16 -070030 public:
31 // Size of an instance of java.lang.ClassLoader.
32 static constexpr uint32_t InstanceSize() {
33 return sizeof(ClassLoader);
34 }
Mathieu Chartier90443472015-07-16 20:32:27 -070035 ClassLoader* GetParent() SHARED_REQUIRES(Locks::mutator_lock_) {
Mathieu Chartier6bcae8f2014-09-04 18:33:17 -070036 return GetFieldObject<ClassLoader>(OFFSET_OF_OBJECT_MEMBER(ClassLoader, parent_));
37 }
Mingyao Yang98d1cc82014-05-15 17:02:16 -070038
Brian Carlstrom1f870082011-08-23 16:02:11 -070039 private:
40 // Field order required by test "ValidateFieldOrderOfJavaCppUnionClasses".
Ian Rogersef7d42f2014-01-06 12:55:46 -080041 HeapReference<Object> packages_;
42 HeapReference<ClassLoader> parent_;
43 HeapReference<Object> proxyCache_;
Brian Carlstrom1f870082011-08-23 16:02:11 -070044
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080045 friend struct art::ClassLoaderOffsets; // for verifying offset information
Brian Carlstrom1f870082011-08-23 16:02:11 -070046 DISALLOW_IMPLICIT_CONSTRUCTORS(ClassLoader);
47};
48
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080049} // namespace mirror
Brian Carlstrom1f870082011-08-23 16:02:11 -070050} // namespace art
51
Brian Carlstromfc0e3212013-07-17 14:40:12 -070052#endif // ART_RUNTIME_MIRROR_CLASS_LOADER_H_