Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
thread_state.cc
Go to the documentation of this file.
1// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#include "vm/thread_state.h"
6
7#include "vm/handles_impl.h"
8#include "vm/zone.h"
9
10namespace dart {
11
12ThreadState::ThreadState(bool is_os_thread) : BaseThread(is_os_thread) {}
13
15
17 ASSERT(zone != nullptr);
18 Zone* current = zone_;
19 while (current != nullptr) {
20 if (current == zone) {
21 return true;
22 }
23 current = current->previous();
24 }
25 return false;
26}
27
29 Zone* zone = this->zone();
30 while (zone != nullptr) {
31 if (zone->handles()->IsValidZoneHandle(reinterpret_cast<uword>(object))) {
32 return true;
33 }
34 zone = zone->previous();
35 }
36 return false;
37}
38
40 intptr_t count = 0;
41 Zone* zone = this->zone();
42 while (zone != nullptr) {
44 zone = zone->previous();
45 }
46 ASSERT(count >= 0);
47 return count;
48}
49
51 Zone* zone = this->zone();
52 while (zone != nullptr) {
53 if (zone->handles()->IsValidScopedHandle(reinterpret_cast<uword>(object))) {
54 return true;
55 }
56 zone = zone->previous();
57 }
58 return false;
59}
60
62 intptr_t count = 0;
63 Zone* zone = this->zone();
64 while (zone != nullptr) {
66 zone = zone->previous();
67 }
68 ASSERT(count >= 0);
69 return count;
70}
71
72} // namespace dart
int count
friend class ThreadState
Definition os_thread.h:79
int CountZoneHandles() const
bool IsValidZoneHandle(uword handle) const
int CountScopedHandles() const
bool IsValidScopedHandle(uword handle) const
bool ZoneIsOwnedByThread(Zone *zone) const
Zone * zone() const
bool IsValidZoneHandle(Dart_Handle object) const
virtual ~ThreadState()
bool IsValidScopedHandle(Dart_Handle object) const
intptr_t CountScopedHandles() const
intptr_t CountZoneHandles() const
VMHandles * handles()
Definition zone.h:73
Zone * previous() const
Definition zone.h:77
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258
#define ASSERT(E)
uintptr_t uword
Definition globals.h:501