Page Speed Optimization Libraries
1.13.35.1
|
#include "serf_url_async_fetcher.h"
Public Types | |
enum | CancelCause { kClientDecision, kSerfError, kFetchTimeout } |
Public Types inherited from net_instaweb::PoolElement< SerfFetch > | |
typedef std::list< SerfFetch * > ::iterator | Position |
Public Member Functions | |
SerfFetch (const GoogleString &url, AsyncFetch *async_fetch, MessageHandler *message_handler, Timer *timer) | |
bool | Start (SerfUrlAsyncFetcher *fetcher, serf_context_t *context) |
GoogleString | DebugInfo () |
void | Cancel (CancelCause cause) |
This must be called while holding SerfUrlAsyncFetcher's mutex_. | |
void | CallCallback (SerfCompletionResult result) |
void | CallbackDone (SerfCompletionResult result) |
void | CleanupIfError () |
void | ParseUrlForTesting (bool *status, apr_uri_t **url, const char **host_header, const char **sni_host) |
void | SetFetcherForTesting (SerfUrlAsyncFetcher *fetcher) |
int64 | TimeDuration () const |
int64 | fetch_start_ms () const |
size_t | bytes_received () const |
MessageHandler * | message_handler () |
Public Member Functions inherited from net_instaweb::PoolElement< SerfFetch > | |
Position * | pool_position () |
net_instaweb::SerfFetch::SerfFetch | ( | const GoogleString & | url, |
AsyncFetch * | async_fetch, | ||
MessageHandler * | message_handler, | ||
Timer * | timer | ||
) |
void net_instaweb::SerfFetch::CallCallback | ( | SerfCompletionResult | result | ) |
Calls the callback supplied by the user. This needs to happen exactly once. In some error cases it appears that Serf calls HandleResponse multiple times on the same object.
This must be called while holding SerfUrlAsyncFetcher's mutex_.
Note that when there are SSL error messages, we immediately call CallCallback, which is robust against duplicate calls in that case.
void net_instaweb::SerfFetch::CleanupIfError | ( | ) |
If last poll of this fetch's connection resulted in an error, clean it up. Must be called after serf_context_run, with fetcher's mutex_ held.
void net_instaweb::SerfFetch::ParseUrlForTesting | ( | bool * | status, |
apr_uri_t ** | url, | ||
const char ** | host_header, | ||
const char ** | sni_host | ||
) |
For use only by unit tests. Calls ParseUrl(), then makes things available for checking.
bool net_instaweb::SerfFetch::Start | ( | SerfUrlAsyncFetcher * | fetcher, |
serf_context_t * | context | ||
) |
Start the fetch. It returns immediately. This can only be run when locked with fetcher->mutex_.