4
This diagram shows the state machine of
5
the HttpRequest implementation on Android.
8
"chunks" of code (not necessary functions) are dashed
9
Direct transitions (in the same thread) are in black,
10
while interthreads transitions are in blue.
11
Red transitions are just here to highlight the switch
13
Bolded ovals (START/EXIT/ABORT) are not really states,
14
just start/end points.
27
ServeLocally [shape="box", style="solid"];
31
Child_CONNECT_TO_REMOTE;
36
Redirection [shape="box", style="dashed"];
37
ParseHeaders [shape="box", style="solid"];
38
ConnectToRemote [shape="box", style="solid"];
39
SendPostData [shape="box", style="solid"];
40
Receive [shape="box", style="solid"];
54
InsertIntoCache [shape="box", style="solid"];
55
SaveCacheResult [shape="box", style="solid"];
56
StopChild [shape="box", style="solid"];
61
SetReadyState [shape="box"];
62
START -> SetReadyState [label="OPEN(1)"];
63
Child_CONNECTED -> SetReadyState [color="blue", label="SENT(2)"];
64
ParseHeaders -> SetReadyState [color="blue", label="INTERACTIVE(3)"];
65
Main_COMPLETE -> SetReadyState [label="COMPLETE(4)"];
69
ABORT -> Child_ABORT [label="was_aborted_", color="blue"];
72
START -> Main_REQUEST;
73
Main_REQUEST -> ServeLocally;
74
ServeLocally -> Child_CONNECT_TO_REMOTE [color="blue", label="CACHE MISS"];
75
ServeLocally -> Child_PARSE_HEADERS [color="blue"];
76
Child_CONNECT_TO_REMOTE -> ConnectToRemote;
77
ConnectToRemote -> Child_CONNECTED;
78
ConnectToRemote -> Child_ABORT [style="solid", label="FAILED", color=red];
79
Child_CONNECTED -> Child_POST [label="POST"];
80
Child_CONNECTED -> Child_PARSE_HEADERS;
81
Child_POST -> SendPostData;
82
SendPostData -> Child_PARSE_HEADERS [label="POST"];
83
SendPostData -> Child_ABORT [style="solid", label="POST FAILED", color=red];
84
Child_PARSE_HEADERS -> ParseHeaders;
85
Child_PARSE_HEADERS -> Child_ABORT [style="solid", label="FAILED PARSE HEADERS", color=red];
86
Redirection -> Child_RECEIVE [label="NO REDIRECT"];
87
ParseHeaders -> Redirection;
88
Redirection -> Main_REQUEST [color="blue", label="REDIRECT"];
89
Redirection -> Child_ABORT [style="solid", label="CANNOT OPEN AFTER REDIRECT", color=red];
90
Child_RECEIVE -> Receive;
91
Receive -> Main_RECEIVED [color="blue"];
92
Receive -> Child_ABORT [style="solid", "ERROR", color=red];
93
Child_ABORT -> Interrupt;
94
Interrupt -> Main_COMPLETE [color="blue"];
95
Main_RECEIVED -> InsertIntoCache -> SaveCacheResult;
96
SaveCacheResult -> Main_COMPLETE;
97
Main_RECEIVED -> Main_COMPLETE;
98
Main_COMPLETE -> StopChild -> Main_IDLE;