blob: 3309a8a629d0704174c82617e6ef3c2f1407703d [file] [log] [blame]
Brian Carlstrom1f870082011-08-23 16:02:11 -07001// Copyright 2011 Google Inc. All Rights Reserved.
2
3#ifndef ART_SRC_CLASS_LOADER_H_
4#define ART_SRC_CLASS_LOADER_H_
5
6#include <vector>
7
8#include "dex_file.h"
9#include "object.h"
10
11namespace art {
12
Ian Rogers0cfe1fb2011-08-26 03:29:44 -070013// C++ mirror of java.lang.ClassLoader
Brian Carlstrom1f870082011-08-23 16:02:11 -070014class ClassLoader : public Object {
15 public:
16 static const std::vector<const DexFile*>& GetClassPath(const ClassLoader* class_loader);
17
18 void SetClassPath(std::vector<const DexFile*>& class_path) {
19 DCHECK_EQ(0U, class_path_.size());
Ian Rogers0cfe1fb2011-08-26 03:29:44 -070020 // TODO: use setter
Brian Carlstrom1f870082011-08-23 16:02:11 -070021 class_path_ = class_path;
22 }
23
24 private:
25 // Field order required by test "ValidateFieldOrderOfJavaCppUnionClasses".
26 Object* packages_;
27 ClassLoader* parent_;
28
29 // TODO: remove once we can create a real PathClassLoader
30 std::vector<const DexFile*> class_path_;
31
32 DISALLOW_IMPLICIT_CONSTRUCTORS(ClassLoader);
33};
34
Ian Rogers0cfe1fb2011-08-26 03:29:44 -070035// C++ mirror of dalvik.system.BaseDexClassLoader
Brian Carlstrom1f870082011-08-23 16:02:11 -070036class BaseDexClassLoader : public ClassLoader {
37 private:
38 // Field order required by test "ValidateFieldOrderOfJavaCppUnionClasses".
39 String* original_path_;
40 Object* path_list_;
41 DISALLOW_IMPLICIT_CONSTRUCTORS(BaseDexClassLoader);
42};
43
Ian Rogers0cfe1fb2011-08-26 03:29:44 -070044// C++ mirror of dalvik.system.PathClassLoader
Brian Carlstrom1f870082011-08-23 16:02:11 -070045class PathClassLoader : public BaseDexClassLoader {
46 public:
47 static const PathClassLoader* Alloc(std::vector<const DexFile*> dex_files);
48 static void SetClass(Class* dalvik_system_PathClassLoader);
49 static void ResetClass();
50 private:
51 static Class* dalvik_system_PathClassLoader_;
52 DISALLOW_IMPLICIT_CONSTRUCTORS(PathClassLoader);
53};
54
55} // namespace art
56
57#endif // ART_SRC_OBJECT_H_