17 #ifndef PAGESPEED_SYSTEM_IN_PLACE_RESOURCE_RECORDER_H_
18 #define PAGESPEED_SYSTEM_IN_PLACE_RESOURCE_RECORDER_H_
23 #include "net/instaweb/http/public/request_context.h"
33 namespace net_instaweb {
59 StringPiece url, StringPiece fragment,
61 int max_response_bytes,
int max_concurrent_recordings,
119 void Fail() { failure_ =
true; }
134 bool entire_response_received);
137 MessageHandler* handler() {
return handler_; }
139 bool failed() {
return failure_; }
140 bool limit_active_recordings() {
return max_concurrent_recordings_ != 0; }
142 const HttpOptions& http_options()
const {
return http_options_; }
145 class HTTPValueFetch :
public AsyncFetchUsingWriter {
147 HTTPValueFetch(
const RequestContextPtr& request_context, HTTPValue* value)
148 : AsyncFetchUsingWriter(request_context, value) {}
149 virtual void HandleDone(
bool ) {}
150 virtual void HandleHeadersComplete() {}
153 bool IsIproContentType(ResponseHeaders* response_headers);
155 void DroppedDueToSize();
156 void DroppedAsUncacheable();
160 const RequestHeaders::Properties request_properties_;
161 const HttpOptions http_options_;
163 int64 max_response_bytes_;
164 const int max_concurrent_recordings_;
166 HTTPValue resource_value_;
167 HTTPValueFetch write_to_resource_value_;
168 InflatingFetch inflating_fetch_;
171 MessageHandler* handler_;
173 Variable* num_resources_;
174 Variable* num_inserted_into_cache_;
175 Variable* num_not_cacheable_;
176 Variable* num_failed_;
177 Variable* num_dropped_due_to_load_;
178 Variable* num_dropped_due_to_size_;
182 static AtomicInt32 active_recordings_;
190 bool full_response_headers_considered_;
193 bool consider_response_headers_called_;
198 bool cache_control_set_;
Definition: in_place_resource_recorder.h:43
Definition: in_place_resource_recorder.h:48
Base class for implementations of monitoring statistics.
Definition: statistics.h:342
void SaveCacheControl(const char *cache_control)
HeadersKind
Definition: in_place_resource_recorder.h:45
void ConsiderResponseHeaders(HeadersKind headers_kind, ResponseHeaders *response_headers)
virtual bool Flush(MessageHandler *handler)
Definition: in_place_resource_recorder.h:76
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
void DoneAndSetHeaders(ResponseHeaders *response_headers, bool entire_response_received)
Headers are complete.
Definition: in_place_resource_recorder.h:51
InPlaceResourceRecorder(const RequestContextPtr &request_context, StringPiece url, StringPiece fragment, const RequestHeaders::Properties &request_properties, int max_response_bytes, int max_concurrent_recordings, HTTPCache *cache, Statistics *statistics, MessageHandler *handler)
void Fail()
Definition: in_place_resource_recorder.h:119
virtual ~InPlaceResourceRecorder()
Interface for writing bytes to an output stream.
Definition: writer.h:29
Definition: message_handler.h:39
virtual bool Write(const StringPiece &contents, MessageHandler *handler)
Definition: http_cache.h:67