blob: 97691362c47e01e1d1f75289a524e6284340770c [file] [log] [blame]
Brian Carlstrom1f870082011-08-23 16:02:11 -07001// Copyright 2011 Google Inc. All Rights Reserved.
2
3#include "class_loader.h"
4
5#include "class_linker.h"
6#include "runtime.h"
7
8namespace art {
9
10const std::vector<const DexFile*>& ClassLoader::GetClassPath(const ClassLoader* class_loader) {
11 if (class_loader == NULL) {
12 return Runtime::Current()->GetClassLinker()->GetBootClassPath();
13 }
14 return class_loader->class_path_;
15}
16
17// TODO: get global references for these
18Class* PathClassLoader::dalvik_system_PathClassLoader_ = NULL;
19
20const PathClassLoader* PathClassLoader::Alloc(std::vector<const DexFile*> dex_files) {
21 PathClassLoader* p = down_cast<PathClassLoader*>(dalvik_system_PathClassLoader_->AllocObject());
22 p->SetClassPath(dex_files);
23 return p;
24}
25
26void PathClassLoader::SetClass(Class* dalvik_system_PathClassLoader) {
27 CHECK(dalvik_system_PathClassLoader_ == NULL);
28 CHECK(dalvik_system_PathClassLoader != NULL);
29 dalvik_system_PathClassLoader_ = dalvik_system_PathClassLoader;
30}
31
32void PathClassLoader::ResetClass() {
33 CHECK(dalvik_system_PathClassLoader_ != NULL);
34 dalvik_system_PathClassLoader_ = NULL;
35}
36
37} // namespace art