Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Static Public Member Functions | Static Public Attributes | List of all members
dart::StackTraceUtils Class Reference

#include <stack_trace.h>

Inheritance diagram for dart::StackTraceUtils:
dart::AllStatic

Classes

struct  Frame
 

Static Public Member Functions

static bool IsNeededForAsyncAwareUnwinding (const Function &function)
 
static bool IsPossibleAwaiterLink (const Class &cls)
 
static void CollectFrames (Thread *thread, int skip_frames, const std::function< void(const Frame &)> &handle_frame, bool *has_async_catch_error=nullptr)
 
static bool GetSuspendState (const Closure &closure, Object *suspend_state)
 

Static Public Attributes

static constexpr uword kFutureListenerPcOffset = 1
 

Detailed Description

Definition at line 17 of file stack_trace.h.

Member Function Documentation

◆ CollectFrames()

void dart::StackTraceUtils::CollectFrames ( Thread thread,
int  skip_frames,
const std::function< void(const Frame &)> &  handle_frame,
bool *  has_async_catch_error = nullptr 
)
static

Collects all frames on the current stack until an async/async* frame is hit which has yielded before (i.e. is not in sync-async case).

From there on finds the closure of the async/async* frame and starts traversing the listeners.

Definition at line 745 of file stack_trace.cc.

749 {
750 AsyncAwareStackUnwinder it(thread, has_async_catch_error);
751 it.Unwind(skip_frames, handle_frame);
752}

◆ GetSuspendState()

bool dart::StackTraceUtils::GetSuspendState ( const Closure closure,
Object suspend_state 
)
static

Definition at line 754 of file stack_trace.cc.

755 {
756 if (TryGetAwaiterLink(closure, suspend_state)) {
757 return suspend_state->IsSuspendState();
758 }
759 return false;
760}

◆ IsNeededForAsyncAwareUnwinding()

bool dart::StackTraceUtils::IsNeededForAsyncAwareUnwinding ( const Function function)
static

Definition at line 730 of file stack_trace.cc.

730 {
731 // If this is a closure function which specifies an awaiter-link then
732 // we need to retain both function and the corresponding code.
733 if (function.HasAwaiterLink()) {
734 return true;
735 }
736
737 if (function.recognized_kind() ==
738 MethodRecognizer::kFutureListenerHandleValue) {
739 return true;
740 }
741
742 return false;
743}
Dart_NativeFunction function
Definition fuchsia.cc:51

◆ IsPossibleAwaiterLink()

bool dart::StackTraceUtils::IsPossibleAwaiterLink ( const Class cls)
static

Definition at line 711 of file stack_trace.cc.

711 {
712 if (cls.library() != Library::AsyncLibrary()) {
713 return false;
714 }
715
716 String& class_name = String::Handle();
717 const auto is_class = [&](const String& name) {
718 class_name = cls.Name();
720 };
721
722 return is_class(Symbols::_AsyncStarStreamController()) ||
723 is_class(Symbols::_SyncStreamController()) ||
724 is_class(Symbols::_StreamController()) ||
725 is_class(Symbols::_Completer()) ||
726 is_class(Symbols::_AsyncCompleter()) ||
727 is_class(Symbols::_SyncCompleter()) || is_class(Symbols::_Future());
728}
static LibraryPtr AsyncLibrary()
Definition object.cc:14826
static Object & Handle()
Definition object.h:407
static bool EqualsIgnoringPrivateKey(const String &str1, const String &str2)
Definition object.cc:24378
const char *const name
const char *const class_name

Member Data Documentation

◆ kFutureListenerPcOffset

constexpr uword dart::StackTraceUtils::kFutureListenerPcOffset = 1
staticconstexpr

Definition at line 19 of file stack_trace.h.


The documentation for this class was generated from the following files: