diff options
author | 2011-08-23 16:02:11 -0700 | |
---|---|---|
committer | 2011-08-31 09:46:57 -0700 | |
commit | 1f87008b165d26541d832ff805250afdc89c253d (patch) | |
tree | a84122b3757b8f856eb0656a951ed6621b6d01a8 /src/class_loader.cc | |
parent | c5bfa8f49d8548d7c685a99b411311ef56bedffa (diff) |
Add HeapTest and make GC work enough to pass it
Change-Id: If06eaef2921b64b3226bfd347acaec60ec993e67
Diffstat (limited to 'src/class_loader.cc')
-rw-r--r-- | src/class_loader.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/class_loader.cc b/src/class_loader.cc new file mode 100644 index 0000000000..97691362c4 --- /dev/null +++ b/src/class_loader.cc @@ -0,0 +1,37 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +#include "class_loader.h" + +#include "class_linker.h" +#include "runtime.h" + +namespace art { + +const std::vector<const DexFile*>& ClassLoader::GetClassPath(const ClassLoader* class_loader) { + if (class_loader == NULL) { + return Runtime::Current()->GetClassLinker()->GetBootClassPath(); + } + return class_loader->class_path_; +} + +// TODO: get global references for these +Class* PathClassLoader::dalvik_system_PathClassLoader_ = NULL; + +const PathClassLoader* PathClassLoader::Alloc(std::vector<const DexFile*> dex_files) { + PathClassLoader* p = down_cast<PathClassLoader*>(dalvik_system_PathClassLoader_->AllocObject()); + p->SetClassPath(dex_files); + return p; +} + +void PathClassLoader::SetClass(Class* dalvik_system_PathClassLoader) { + CHECK(dalvik_system_PathClassLoader_ == NULL); + CHECK(dalvik_system_PathClassLoader != NULL); + dalvik_system_PathClassLoader_ = dalvik_system_PathClassLoader; +} + +void PathClassLoader::ResetClass() { + CHECK(dalvik_system_PathClassLoader_ != NULL); + dalvik_system_PathClassLoader_ = NULL; +} + +} // namespace art |