blob: 3adb4ec0b6778fde6c1824ac1c05fbaea64ae018 [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
17#include "class_loader.h"
18
19#include "class_linker.h"
20#include "runtime.h"
21
22namespace art {
23
Brian Carlstrom1f870082011-08-23 16:02:11 -070024// TODO: get global references for these
25Class* PathClassLoader::dalvik_system_PathClassLoader_ = NULL;
26
Brian Carlstrom40381fb2011-10-19 14:13:40 -070027PathClassLoader* PathClassLoader::AllocCompileTime(std::vector<const DexFile*>& dex_files) {
Brian Carlstromaded5f72011-10-07 17:15:04 -070028 CHECK(!Runtime::Current()->IsStarted());
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070029 DCHECK(dalvik_system_PathClassLoader_ != NULL);
Brian Carlstrom40381fb2011-10-19 14:13:40 -070030 SirtRef<PathClassLoader> p(down_cast<PathClassLoader*>(dalvik_system_PathClassLoader_->AllocObject()));
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080031 Runtime::Current()->SetCompileTimeClassPath(p.get(), dex_files);
Brian Carlstrom40381fb2011-10-19 14:13:40 -070032 return p.get();
Brian Carlstrom1f870082011-08-23 16:02:11 -070033}
34
35void PathClassLoader::SetClass(Class* dalvik_system_PathClassLoader) {
36 CHECK(dalvik_system_PathClassLoader_ == NULL);
37 CHECK(dalvik_system_PathClassLoader != NULL);
38 dalvik_system_PathClassLoader_ = dalvik_system_PathClassLoader;
39}
40
41void PathClassLoader::ResetClass() {
42 CHECK(dalvik_system_PathClassLoader_ != NULL);
43 dalvik_system_PathClassLoader_ = NULL;
44}
45
46} // namespace art