创建一个网络线程来处理请求
->thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(m_request.get(), &WebRequest::start));
---------------------------------------------------------------------------------
网络线程
->WebRequest::start【Http】
->URLRequestHttpJob::Start
->AddExtraHeaders()
->取Cookie
->创建HttpCacheTransaction
HttpCacheTransaction
->启动事务HttpCache::Transaction::Start
->循环Doloop() 状态机
do {
switch (state) {
DoGetBackend();
DoGetBackendComplete(rv);
DoSendRequest();
DoSendRequestComplete(rv);
DoSuccessfulSendRequest();
DoNetworkRead();
DoNetworkReadComplete(rv);
DoInitEntry();
DoOpenEntry();
DoOpenEntryComplete(rv);
DoCreateEntry();
DoCreateEntryComplete(rv);
DoDoomEntry();
DoDoomEntryComplete(rv);
DoAddToEntry();
DoAddToEntryComplete(rv);
DoNotifyBeforeSendHeaders();
DoNotifyBeforeSendHeadersComplete(rv);
DoStartPartialCacheValidation();
DoCompletePartialCacheValidation(rv);
DoUpdateCachedResponse();
DoUpdateCachedResponseComplete(rv);
DoOverwriteCachedResponse();
DoTruncateCachedData();
DoTruncateCachedDataComplete(rv);
DoTruncateCachedMetadata();
DoTruncateCachedMetadataComplete(rv);
DoPartialHeadersReceived();
DoCacheReadResponse();
DoCacheReadResponseComplete(rv);
DoCacheWriteResponse();
DoCacheWriteTruncatedResponse();
DoCacheWriteResponseComplete(rv);
DoCacheReadMetadata();
DoCacheReadMetadataComplete(rv);
DoCacheQueryData();
DoCacheQueryDataComplete(rv);
DoCacheReadData();
DoCacheReadDataComplete(rv);
DoCacheWriteData(rv);
DoCacheWriteDataComplete(rv);
}
} while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE);
->创建HttpNeworkTransaction (HttpCacheTransaction::DoSendRequest)
HttpNeworkTransaction
->启动事务HttpNetworkTransaction::Start
->循环DoLoop() 状态机
do {
switch (state) {
DoCreateStream();
DoCreateStreamComplete(rv);
DoInitStream();
DoInitStreamComplete(rv);
DoGenerateProxyAuthToken();
DoGenerateProxyAuthTokenComplete(rv);
DoGenerateServerAuthToken();
DoGenerateServerAuthTokenComplete(rv);
DoBuildRequest();
DoBuildRequestComplete(rv);
DoSendRequest(); Socket阻塞发送
DoSendRequestComplete(rv);
DoReadHeaders(); Socket阻塞读取
DoReadHeadersComplete(rv);
DoReadBody(); Socket阻塞读取
DoReadBodyComplete(rv);
DoDrainBodyForAuthRestart();
DoDrainBodyForAuthRestartComplete(rv);
}
} while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE);