heap_bitmap-inl.h revision 0cd7ec2dcd8d7ba30bf3ca420b40dac52849876c
1/*
2 * Copyright (C) 2012 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 */
16
17#ifndef ART_RUNTIME_GC_ACCOUNTING_HEAP_BITMAP_INL_H_
18#define ART_RUNTIME_GC_ACCOUNTING_HEAP_BITMAP_INL_H_
19
20#include "heap_bitmap.h"
21
22namespace art {
23namespace gc {
24namespace accounting {
25
26template <typename Visitor>
27inline void HeapBitmap::Visit(const Visitor& visitor) {
28  // TODO: C++0x auto
29  typedef std::vector<SpaceBitmap*>::iterator It;
30  for (It it = continuous_space_bitmaps_.begin(), end = continuous_space_bitmaps_.end();
31      it != end; ++it) {
32    SpaceBitmap* bitmap = *it;
33    bitmap->VisitMarkedRange(bitmap->HeapBegin(), bitmap->HeapLimit(), visitor, VoidFunctor());
34  }
35  // TODO: C++0x auto
36  typedef std::vector<SpaceSetMap*>::iterator It2;
37  DCHECK(discontinuous_space_sets_.begin() !=  discontinuous_space_sets_.end());
38  for (It2 it = discontinuous_space_sets_.begin(), end = discontinuous_space_sets_.end();
39      it != end; ++it) {
40    SpaceSetMap* set = *it;
41    set->Visit(visitor);
42  }
43}
44
45}  // namespace accounting
46}  // namespace gc
47}  // namespace art
48
49#endif  // ART_RUNTIME_GC_ACCOUNTING_HEAP_BITMAP_INL_H_
50