18 #ifndef NET_INSTAWEB_HTTP_PUBLIC_SYNC_FETCHER_ADAPTER_CALLBACK_H_
19 #define NET_INSTAWEB_HTTP_PUBLIC_SYNC_FETCHER_ADAPTER_CALLBACK_H_
22 #include "net/instaweb/http/public/request_context.h"
26 #include "pagespeed/kernel/base/thread_annotations.h"
30 namespace net_instaweb {
58 void Release() LOCKS_EXCLUDED(mutex_);
60 bool IsDone()
const LOCKS_EXCLUDED(mutex_);
64 bool success()
const LOCKS_EXCLUDED(mutex_);
65 bool released()
const LOCKS_EXCLUDED(mutex_);
73 void Unlock() UNLOCK_FUNCTION(mutex_);
81 void TimedWait(int64 timeout_ms) EXCLUSIVE_LOCKS_REQUIRED(mutex_);
84 virtual void HandleDone(
bool success) LOCKS_EXCLUDED(mutex_);
85 virtual bool HandleWrite(
const StringPiece& content,
87 return writer_->Write(content, handler);
90 return writer_->Flush(handler);
92 virtual void HandleHeadersComplete() {
100 class ProtectedWriter :
public Writer {
103 : callback_(callback), orig_writer_(orig_writer) {}
106 LOCKS_EXCLUDED(callback_->mutex_);
108 LOCKS_EXCLUDED(callback_->mutex_);
112 Writer* orig_writer_ GUARDED_BY(callback_->mutex_);
121 bool done_ GUARDED_BY(mutex_);
122 bool success_ GUARDED_BY(mutex_);
123 bool released_ GUARDED_BY(mutex_);
void Release() LOCKS_EXCLUDED(mutex_)
virtual const RequestContextPtr & request_context()
Definition: async_fetch.h:151
Class to help run an asynchronous fetch synchronously with a timeout.
Definition: sync_fetcher_adapter_callback.h:35
void Unlock() UNLOCK_FUNCTION(mutex_)
Releases mutex acquired by a successful LockIfNotReleased() call.
void TimedWait(int64 timeout_ms) EXCLUSIVE_LOCKS_REQUIRED(mutex_)
bool LockIfNotReleased() EXCLUSIVE_TRYLOCK_FUNCTION(true
Definition: scoped_ptr.h:30
Definition: async_fetch.h:53
bool IsDoneLockHeld() const EXCLUSIVE_LOCKS_REQUIRED(mutex_)
Version of IsDone() that may only be called if you already hold the mutex.
Interface for writing bytes to an output stream.
Definition: writer.h:29
Definition: thread_system.h:40
Definition: message_handler.h:39
virtual bool Write(const StringPiece &content, MessageHandler *handler)