Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::ConcurrentForceGrowthScopeTask Class Reference
Inheritance diagram for dart::ConcurrentForceGrowthScopeTask:
dart::ThreadPool::Task dart::IntrusiveDListEntry< Task >

Public Member Functions

 ConcurrentForceGrowthScopeTask (IsolateGroup *isolate_group, Monitor *monitor, intptr_t *done_count)
 
virtual void Run ()
 
- Public Member Functions inherited from dart::ThreadPool::Task
virtual ~Task ()
 
virtual void Run ()=0
 
- Public Member Functions inherited from dart::IntrusiveDListEntry< Task >
 IntrusiveDListEntry ()
 
 ~IntrusiveDListEntry ()
 

Additional Inherited Members

- Protected Member Functions inherited from dart::ThreadPool::Task
 Task ()
 

Detailed Description

Definition at line 779 of file heap_test.cc.

Constructor & Destructor Documentation

◆ ConcurrentForceGrowthScopeTask()

dart::ConcurrentForceGrowthScopeTask::ConcurrentForceGrowthScopeTask ( IsolateGroup isolate_group,
Monitor monitor,
intptr_t *  done_count 
)
inline

Definition at line 781 of file heap_test.cc.

784 : isolate_group_(isolate_group),
785 monitor_(monitor),
786 done_count_(done_count) {}

Member Function Documentation

◆ Run()

virtual void dart::ConcurrentForceGrowthScopeTask::Run ( )
inlinevirtual

Implements dart::ThreadPool::Task.

Definition at line 788 of file heap_test.cc.

788 {
789 const bool kBypassSafepoint = false;
791 kBypassSafepoint);
792 {
793 Thread* thread = Thread::Current();
794 StackZone stack_zone(thread);
795
796 GrowableObjectArray& accumulate =
798 Object& element = Object::Handle();
799 for (intptr_t i = 0; i < 1000; i++) {
800 // Lots of entering and leaving ForceGrowth scopes. Previously, this
801 // would have been data races on the per-Heap force-growth flag.
802 {
803 ForceGrowthScope force_growth(thread);
804 GrowableObjectArrayPtr unsafe_accumulate = accumulate.ptr();
805 element = Array::New(0);
806 accumulate = unsafe_accumulate;
807 }
808 accumulate.Add(element);
809 }
810 }
811 Thread::ExitIsolateGroupAsHelper(kBypassSafepoint);
812 // Notify the main thread that this thread has exited.
813 {
814 MonitorLocker ml(monitor_);
815 *done_count_ += 1;
816 ml.Notify();
817 }
818 }
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
Definition: object.h:10959
static GrowableObjectArrayPtr New(Heap::Space space=Heap::kNew)
Definition: object.h:11144
static Object & Handle()
Definition: object.h:407
@ kUnknownTask
Definition: thread.h:346
static Thread * Current()
Definition: thread.h:362
static void ExitIsolateGroupAsHelper(bool bypass_safepoint)
Definition: thread.cc:499
static bool EnterIsolateGroupAsHelper(IsolateGroup *isolate_group, TaskKind kind, bool bypass_safepoint)
Definition: thread.cc:481

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