Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 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_SRC_SCOPED_THREAD_STATE_CHANGE_H_ |
| 18 | #define ART_SRC_SCOPED_THREAD_STATE_CHANGE_H_ |
| 19 | |
Elliott Hughes | 1aa246d | 2012-12-13 09:29:36 -0800 | [diff] [blame] | 20 | #include "base/casts.h" |
Ian Rogers | 81d425b | 2012-09-27 16:03:43 -0700 | [diff] [blame] | 21 | #include "jni_internal.h" |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 22 | #include "thread-inl.h" |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 23 | |
| 24 | namespace art { |
| 25 | |
| 26 | // Scoped change into and out of a particular state. Handles Runnable transitions that require |
| 27 | // more complicated suspension checking. The subclasses ScopedObjectAccessUnchecked and |
| 28 | // ScopedObjectAccess are used to handle the change into Runnable to get direct access to objects, |
| 29 | // the unchecked variant doesn't aid annotalysis. |
| 30 | class ScopedThreadStateChange { |
| 31 | public: |
| 32 | ScopedThreadStateChange(Thread* self, ThreadState new_thread_state) |
Ian Rogers | c0fa3ad | 2013-02-05 00:11:55 -0800 | [diff] [blame^] | 33 | LOCKS_EXCLUDED(Locks::thread_suspend_count_lock_) __attribute__ ((always_inline)) |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 34 | : self_(self), thread_state_(new_thread_state), expected_has_no_thread_(false) { |
Ian Rogers | c0fa3ad | 2013-02-05 00:11:55 -0800 | [diff] [blame^] | 35 | if (UNLIKELY(self_ == NULL)) { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 36 | // Value chosen arbitrarily and won't be used in the destructor since thread_ == NULL. |
| 37 | old_thread_state_ = kTerminated; |
Ian Rogers | 50b35e2 | 2012-10-04 10:09:15 -0700 | [diff] [blame] | 38 | MutexLock mu(NULL, *Locks::runtime_shutdown_lock_); |
Ian Rogers | 120f1c7 | 2012-09-28 17:17:10 -0700 | [diff] [blame] | 39 | Runtime* runtime = Runtime::Current(); |
| 40 | CHECK(runtime == NULL || !runtime->IsStarted() || runtime->IsShuttingDown()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 41 | } else { |
| 42 | bool runnable_transition; |
Ian Rogers | 22f454c | 2012-09-08 11:06:29 -0700 | [diff] [blame] | 43 | DCHECK_EQ(self, Thread::Current()); |
| 44 | // Read state without locks, ok as state is effectively thread local and we're not interested |
| 45 | // in the suspend count (this will be handled in the runnable transitions). |
Ian Rogers | 474b6da | 2012-09-25 00:20:38 -0700 | [diff] [blame] | 46 | old_thread_state_ = self->GetState(); |
Ian Rogers | 22f454c | 2012-09-08 11:06:29 -0700 | [diff] [blame] | 47 | runnable_transition = old_thread_state_ == kRunnable || new_thread_state == kRunnable; |
| 48 | if (!runnable_transition) { |
| 49 | // A suspended transition to another effectively suspended transition, ok to use Unsafe. |
Ian Rogers | 474b6da | 2012-09-25 00:20:38 -0700 | [diff] [blame] | 50 | self_->SetState(new_thread_state); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 51 | } |
Mathieu Chartier | 858f1c5 | 2012-10-17 17:45:55 -0700 | [diff] [blame] | 52 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 53 | if (runnable_transition && old_thread_state_ != new_thread_state) { |
| 54 | if (new_thread_state == kRunnable) { |
| 55 | self_->TransitionFromSuspendedToRunnable(); |
| 56 | } else { |
| 57 | DCHECK_EQ(old_thread_state_, kRunnable); |
| 58 | self_->TransitionFromRunnableToSuspended(new_thread_state); |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | |
Ian Rogers | c0fa3ad | 2013-02-05 00:11:55 -0800 | [diff] [blame^] | 64 | ~ScopedThreadStateChange() LOCKS_EXCLUDED(Locks::thread_suspend_count_lock_) __attribute__ ((always_inline)) { |
| 65 | if (UNLIKELY(self_ == NULL)) { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 66 | if (!expected_has_no_thread_) { |
Ian Rogers | 50b35e2 | 2012-10-04 10:09:15 -0700 | [diff] [blame] | 67 | MutexLock mu(NULL, *Locks::runtime_shutdown_lock_); |
Ian Rogers | 120f1c7 | 2012-09-28 17:17:10 -0700 | [diff] [blame] | 68 | Runtime* runtime = Runtime::Current(); |
| 69 | bool shutting_down = (runtime == NULL) || runtime->IsShuttingDown(); |
| 70 | CHECK(shutting_down); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 71 | } |
| 72 | } else { |
| 73 | if (old_thread_state_ != thread_state_) { |
| 74 | if (old_thread_state_ == kRunnable) { |
| 75 | self_->TransitionFromSuspendedToRunnable(); |
| 76 | } else if (thread_state_ == kRunnable) { |
| 77 | self_->TransitionFromRunnableToSuspended(old_thread_state_); |
| 78 | } else { |
Ian Rogers | 22f454c | 2012-09-08 11:06:29 -0700 | [diff] [blame] | 79 | // A suspended transition to another effectively suspended transition, ok to use Unsafe. |
Ian Rogers | 474b6da | 2012-09-25 00:20:38 -0700 | [diff] [blame] | 80 | self_->SetState(old_thread_state_); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 81 | } |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | Thread* Self() const { |
| 87 | return self_; |
| 88 | } |
| 89 | |
| 90 | protected: |
| 91 | // Constructor used by ScopedJniThreadState for an unattached thread that has access to the VM*. |
| 92 | ScopedThreadStateChange() |
| 93 | : self_(NULL), thread_state_(kTerminated), old_thread_state_(kTerminated), |
| 94 | expected_has_no_thread_(true) {} |
| 95 | |
| 96 | Thread* const self_; |
| 97 | const ThreadState thread_state_; |
| 98 | |
| 99 | private: |
| 100 | ThreadState old_thread_state_; |
| 101 | const bool expected_has_no_thread_; |
| 102 | |
| 103 | DISALLOW_COPY_AND_ASSIGN(ScopedThreadStateChange); |
| 104 | }; |
| 105 | |
| 106 | // Entry/exit processing for transitions from Native to Runnable (ie within JNI functions). |
| 107 | // |
| 108 | // This class performs the necessary thread state switching to and from Runnable and lets us |
| 109 | // amortize the cost of working out the current thread. Additionally it lets us check (and repair) |
| 110 | // apps that are using a JNIEnv on the wrong thread. The class also decodes and encodes Objects |
| 111 | // into jobjects via methods of this class. Performing this here enforces the Runnable thread state |
| 112 | // for use of Object, thereby inhibiting the Object being modified by GC whilst native or VM code |
| 113 | // is also manipulating the Object. |
| 114 | // |
| 115 | // The destructor transitions back to the previous thread state, typically Native. In this state |
| 116 | // GC and thread suspension may occur. |
| 117 | // |
| 118 | // For annotalysis the subclass ScopedObjectAccess (below) makes it explicit that a shared of |
| 119 | // the mutator_lock_ will be acquired on construction. |
| 120 | class ScopedObjectAccessUnchecked : public ScopedThreadStateChange { |
| 121 | public: |
| 122 | explicit ScopedObjectAccessUnchecked(JNIEnv* env) |
Ian Rogers | c0fa3ad | 2013-02-05 00:11:55 -0800 | [diff] [blame^] | 123 | LOCKS_EXCLUDED(Locks::thread_suspend_count_lock_) __attribute__ ((always_inline)) |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 124 | : ScopedThreadStateChange(ThreadForEnv(env), kRunnable), |
| 125 | env_(reinterpret_cast<JNIEnvExt*>(env)), vm_(env_->vm) { |
| 126 | self_->VerifyStack(); |
| 127 | } |
| 128 | |
| 129 | explicit ScopedObjectAccessUnchecked(Thread* self) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 130 | LOCKS_EXCLUDED(Locks::thread_suspend_count_lock_) |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 131 | : ScopedThreadStateChange(self, kRunnable), |
| 132 | env_(reinterpret_cast<JNIEnvExt*>(self->GetJniEnv())), |
| 133 | vm_(env_ != NULL ? env_->vm : NULL) { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 134 | self_->VerifyStack(); |
| 135 | } |
| 136 | |
| 137 | // Used when we want a scoped JNI thread state but have no thread/JNIEnv. Consequently doesn't |
| 138 | // change into Runnable or acquire a share on the mutator_lock_. |
| 139 | explicit ScopedObjectAccessUnchecked(JavaVM* vm) |
| 140 | : ScopedThreadStateChange(), env_(NULL), vm_(reinterpret_cast<JavaVMExt*>(vm)) {} |
| 141 | |
Ian Rogers | c0fa3ad | 2013-02-05 00:11:55 -0800 | [diff] [blame^] | 142 | ~ScopedObjectAccessUnchecked() __attribute__ ((always_inline)) { |
| 143 | } |
| 144 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 145 | JNIEnvExt* Env() const { |
| 146 | return env_; |
| 147 | } |
| 148 | |
| 149 | JavaVMExt* Vm() const { |
| 150 | return vm_; |
| 151 | } |
| 152 | |
| 153 | /* |
| 154 | * Add a local reference for an object to the indirect reference table associated with the |
| 155 | * current stack frame. When the native function returns, the reference will be discarded. |
| 156 | * Part of the ScopedJniThreadState as native code shouldn't be working on raw Object* without |
| 157 | * having transitioned its state. |
| 158 | * |
| 159 | * We need to allow the same reference to be added multiple times. |
| 160 | * |
| 161 | * This will be called on otherwise unreferenced objects. We cannot do GC allocations here, and |
| 162 | * it's best if we don't grab a mutex. |
| 163 | * |
| 164 | * Returns the local reference (currently just the same pointer that was |
| 165 | * passed in), or NULL on failure. |
| 166 | */ |
| 167 | template<typename T> |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 168 | T AddLocalReference(mirror::Object* obj) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 169 | DCHECK_EQ(thread_state_, kRunnable); // Don't work with raw objects in non-runnable states. |
| 170 | if (obj == NULL) { |
| 171 | return NULL; |
| 172 | } |
| 173 | |
| 174 | DCHECK_NE((reinterpret_cast<uintptr_t>(obj) & 0xffff0000), 0xebad0000); |
| 175 | |
| 176 | IndirectReferenceTable& locals = Env()->locals; |
| 177 | |
| 178 | uint32_t cookie = Env()->local_ref_cookie; |
| 179 | IndirectRef ref = locals.Add(cookie, obj); |
| 180 | |
| 181 | #if 0 // TODO: fix this to understand PushLocalFrame, so we can turn it on. |
| 182 | if (Env()->check_jni) { |
| 183 | size_t entry_count = locals.Capacity(); |
| 184 | if (entry_count > 16) { |
| 185 | LOG(WARNING) << "Warning: more than 16 JNI local references: " |
| 186 | << entry_count << " (most recent was a " << PrettyTypeOf(obj) << ")\n" |
| 187 | << Dumpable<IndirectReferenceTable>(locals); |
| 188 | // TODO: LOG(FATAL) in a later release? |
| 189 | } |
| 190 | } |
| 191 | #endif |
| 192 | |
| 193 | if (Vm()->work_around_app_jni_bugs) { |
| 194 | // Hand out direct pointers to support broken old apps. |
| 195 | return reinterpret_cast<T>(obj); |
| 196 | } |
| 197 | |
| 198 | return reinterpret_cast<T>(ref); |
| 199 | } |
| 200 | |
| 201 | template<typename T> |
| 202 | T Decode(jobject obj) const |
| 203 | LOCKS_EXCLUDED(JavaVMExt::globals_lock, |
| 204 | JavaVMExt::weak_globals_lock) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 205 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 81d425b | 2012-09-27 16:03:43 -0700 | [diff] [blame] | 206 | Locks::mutator_lock_->AssertSharedHeld(Self()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 207 | DCHECK_EQ(thread_state_, kRunnable); // Don't work with raw objects in non-runnable states. |
| 208 | return down_cast<T>(Self()->DecodeJObject(obj)); |
| 209 | } |
| 210 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 211 | mirror::Field* DecodeField(jfieldID fid) const |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 212 | LOCKS_EXCLUDED(JavaVMExt::globals_lock, |
| 213 | JavaVMExt::weak_globals_lock) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 214 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 81d425b | 2012-09-27 16:03:43 -0700 | [diff] [blame] | 215 | Locks::mutator_lock_->AssertSharedHeld(Self()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 216 | DCHECK_EQ(thread_state_, kRunnable); // Don't work with raw objects in non-runnable states. |
| 217 | #ifdef MOVING_GARBAGE_COLLECTOR |
| 218 | // TODO: we should make these unique weak globals if Field instances can ever move. |
| 219 | UNIMPLEMENTED(WARNING); |
| 220 | #endif |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 221 | return reinterpret_cast<mirror::Field*>(fid); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 222 | } |
| 223 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 224 | jfieldID EncodeField(mirror::Field* field) const |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 225 | LOCKS_EXCLUDED(JavaVMExt::globals_lock, |
| 226 | JavaVMExt::weak_globals_lock) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 227 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 81d425b | 2012-09-27 16:03:43 -0700 | [diff] [blame] | 228 | Locks::mutator_lock_->AssertSharedHeld(Self()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 229 | DCHECK_EQ(thread_state_, kRunnable); // Don't work with raw objects in non-runnable states. |
| 230 | #ifdef MOVING_GARBAGE_COLLECTOR |
| 231 | UNIMPLEMENTED(WARNING); |
| 232 | #endif |
| 233 | return reinterpret_cast<jfieldID>(field); |
| 234 | } |
| 235 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 236 | mirror::AbstractMethod* DecodeMethod(jmethodID mid) const |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 237 | LOCKS_EXCLUDED(JavaVMExt::globals_lock, |
| 238 | JavaVMExt::weak_globals_lock) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 239 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 81d425b | 2012-09-27 16:03:43 -0700 | [diff] [blame] | 240 | Locks::mutator_lock_->AssertSharedHeld(Self()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 241 | DCHECK_EQ(thread_state_, kRunnable); // Don't work with raw objects in non-runnable states. |
| 242 | #ifdef MOVING_GARBAGE_COLLECTOR |
| 243 | // TODO: we should make these unique weak globals if Method instances can ever move. |
| 244 | UNIMPLEMENTED(WARNING); |
| 245 | #endif |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 246 | return reinterpret_cast<mirror::AbstractMethod*>(mid); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 247 | } |
| 248 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 249 | jmethodID EncodeMethod(mirror::AbstractMethod* method) const |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 250 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 81d425b | 2012-09-27 16:03:43 -0700 | [diff] [blame] | 251 | Locks::mutator_lock_->AssertSharedHeld(Self()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 252 | DCHECK_EQ(thread_state_, kRunnable); // Don't work with raw objects in non-runnable states. |
| 253 | #ifdef MOVING_GARBAGE_COLLECTOR |
| 254 | UNIMPLEMENTED(WARNING); |
| 255 | #endif |
| 256 | return reinterpret_cast<jmethodID>(method); |
| 257 | } |
| 258 | |
| 259 | private: |
| 260 | static Thread* ThreadForEnv(JNIEnv* env) { |
| 261 | JNIEnvExt* full_env(reinterpret_cast<JNIEnvExt*>(env)); |
Ian Rogers | c0fa3ad | 2013-02-05 00:11:55 -0800 | [diff] [blame^] | 262 | return full_env->self; |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | // The full JNIEnv. |
| 266 | JNIEnvExt* const env_; |
| 267 | // The full JavaVM. |
| 268 | JavaVMExt* const vm_; |
| 269 | |
| 270 | DISALLOW_COPY_AND_ASSIGN(ScopedObjectAccessUnchecked); |
| 271 | }; |
| 272 | |
| 273 | // Annotalysis helping variant of the above. |
| 274 | class ScopedObjectAccess : public ScopedObjectAccessUnchecked { |
| 275 | public: |
| 276 | explicit ScopedObjectAccess(JNIEnv* env) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 277 | LOCKS_EXCLUDED(Locks::thread_suspend_count_lock_) |
Ian Rogers | c0fa3ad | 2013-02-05 00:11:55 -0800 | [diff] [blame^] | 278 | SHARED_LOCK_FUNCTION(Locks::mutator_lock_) __attribute__ ((always_inline)) |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 279 | : ScopedObjectAccessUnchecked(env) { |
Ian Rogers | 81d425b | 2012-09-27 16:03:43 -0700 | [diff] [blame] | 280 | Locks::mutator_lock_->AssertSharedHeld(Self()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 281 | } |
| 282 | |
| 283 | explicit ScopedObjectAccess(Thread* self) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 284 | LOCKS_EXCLUDED(Locks::thread_suspend_count_lock_) |
| 285 | SHARED_LOCK_FUNCTION(Locks::mutator_lock_) |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 286 | : ScopedObjectAccessUnchecked(self) { |
Ian Rogers | 81d425b | 2012-09-27 16:03:43 -0700 | [diff] [blame] | 287 | Locks::mutator_lock_->AssertSharedHeld(Self()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 288 | } |
| 289 | |
Ian Rogers | c0fa3ad | 2013-02-05 00:11:55 -0800 | [diff] [blame^] | 290 | ~ScopedObjectAccess() UNLOCK_FUNCTION(Locks::mutator_lock_) __attribute__ ((always_inline)) { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 291 | // Base class will release share of lock. Invoked after this destructor. |
| 292 | } |
| 293 | |
| 294 | private: |
| 295 | // TODO: remove this constructor. It is used by check JNI's ScopedCheck to make it believe that |
| 296 | // routines operating with just a VM are sound, they are not, but when you have just a VM |
| 297 | // you cannot call the unsound routines. |
| 298 | explicit ScopedObjectAccess(JavaVM* vm) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 299 | SHARED_LOCK_FUNCTION(Locks::mutator_lock_) |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 300 | : ScopedObjectAccessUnchecked(vm) {} |
| 301 | |
| 302 | friend class ScopedCheck; |
| 303 | DISALLOW_COPY_AND_ASSIGN(ScopedObjectAccess); |
| 304 | }; |
| 305 | |
| 306 | } // namespace art |
| 307 | |
| 308 | #endif // ART_SRC_SCOPED_THREAD_STATE_CHANGE_H_ |