Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Package Functions | List of all members
org.dartlang.vm.service.SampleVmServiceListener Class Reference
Inheritance diagram for org.dartlang.vm.service.SampleVmServiceListener:
org.dartlang.vm.service.VmServiceListener

Public Member Functions

void connectionOpened ()
 
void received (String streamId, Event event)
 
void connectionClosed ()
 
Event waitFor (String expectedStreamId, EventKind expectedEventKind)
 

Package Functions

 SampleVmServiceListener (Set< EventKind > ignoreAll)
 

Detailed Description

Sample VmListener for responding to state changes in the running application

Definition at line 24 of file SampleVmServiceListener.java.

Constructor & Destructor Documentation

◆ SampleVmServiceListener()

org.dartlang.vm.service.SampleVmServiceListener.SampleVmServiceListener ( Set< EventKind >  ignoreAll)
inlinepackage

Definition at line 30 of file SampleVmServiceListener.java.

30 {
31 this.ignoreAll = ignoreAll;
32 }

Member Function Documentation

◆ connectionClosed()

void org.dartlang.vm.service.SampleVmServiceListener.connectionClosed ( )
inline

Implements org.dartlang.vm.service.VmServiceListener.

Definition at line 55 of file SampleVmServiceListener.java.

55 {
56
57 }

◆ connectionOpened()

void org.dartlang.vm.service.SampleVmServiceListener.connectionOpened ( )
inline

Implements org.dartlang.vm.service.VmServiceListener.

Definition at line 35 of file SampleVmServiceListener.java.

35 {
36
37 }

◆ received()

void org.dartlang.vm.service.SampleVmServiceListener.received ( String  streamId,
Event  event 
)
inline

Called when a VM event has been received.

Parameters
streamIdthe stream identifier (e.g. VmService#DEBUG_STREAM_ID
eventthe event

Implements org.dartlang.vm.service.VmServiceListener.

Definition at line 40 of file SampleVmServiceListener.java.

40 {
41 synchronized (lock) {
42 if (ignoreAll.contains(event.getKind())) {
43 return;
44 }
45 if (lastStreamId != null) {
46 unexpectedEvent(lastStreamId, lastEvent);
47 }
48 lastStreamId = streamId;
49 lastEvent = event;
50 lock.notifyAll();
51 }
52 }
FlKeyEvent * event

◆ waitFor()

Event org.dartlang.vm.service.SampleVmServiceListener.waitFor ( String  expectedStreamId,
EventKind  expectedEventKind 
)
inline

Definition at line 59 of file SampleVmServiceListener.java.

59 {
60 long end = System.currentTimeMillis() + 5000;
61 synchronized (lock) {
62 while (true) {
63 if (expectedStreamId.equals(lastStreamId) && expectedEventKind.equals(lastEvent.getKind())) {
64 Event event = lastEvent;
65 lastStreamId = null;
66 lastEvent = null;
67 return event;
68 }
69 long timeout = end - System.currentTimeMillis();
70 if (timeout <= 0) {
71 break;
72 }
73 try {
74 lock.wait(timeout);
75 } catch (InterruptedException e) {
76 // ignored
77 }
78 }
79 }
80 throw new RuntimeException("Expected event: " + expectedStreamId + ", " + expectedEventKind);
81 }
glong glong end
timeout(deadline, cmd)

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