23 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_RESOURCE_COMBINER_H_
24 #define NET_INSTAWEB_REWRITER_PUBLIC_RESOURCE_COMBINER_H_
28 #include "net/instaweb/rewriter/public/url_partnership.h"
34 namespace net_instaweb {
71 const StringPiece& extension,
88 const ResourceVector& resources()
const {
return resources_; }
126 virtual void Clear();
132 friend class AggregateCombiner;
135 virtual const ContentType* CombinationContentType() = 0;
138 void UpdateResolvedBase();
141 void ComputeLeafSize();
145 void AccumulateLeafSize(
const StringPiece& url);
153 virtual void AccumulateCombinedSize(
const ResourcePtr& resource) {}
157 virtual bool ContentSizeTooBig()
const {
return false; }
164 virtual bool ResourceCombinable(Resource* resource,
166 MessageHandler* handler);
168 UrlPartnership partnership_;
169 ResourceVector resources_;
170 StringVector multipart_encoder_urls_;
171 int prev_num_components_;
172 int accumulated_leaf_size_;
174 const int url_overhead_;
175 RewriteFilter* filter_;
177 FRIEND_TEST(ResourceCombinerTest, TestRemove);
178 FRIEND_TEST(ResourceCombinerTest, TestRemoveFrom3);
179 FRIEND_TEST(ResourceCombinerTest, TestRebaseRemove);
180 FRIEND_TEST(ResourceCombinerTest, TestRebaseRemoveAdd);
int num_urls() const
Returns the number of URLs that have been successfully added.
Definition: url_partnership.h:55
GoogleString UrlSafeId() const
int num_urls() const
Returns the number of URLs that have been successfully added.
Definition: resource_combiner.h:86
virtual bool WritePiece(int index, int num_pieces, const Resource *input, OutputResource *combination, Writer *writer, MessageHandler *handler)
ResourceCombiner(RewriteDriver *rewrite_driver, const StringPiece &extension, RewriteFilter *filter)
Note: extension should not include the leading dot here.
Definition: resource.h:57
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
static const int kUrlSlack
Definition: resource_combiner.h:67
int64 expiration_ms
Definition: resource_combiner.h:47
GoogleString ResolvedBase() const
Base common to all URLs. Always has a trailing slash.
Definition: resource_combiner.h:91
Definition: rewrite_filter.h:35
Definition: resource_combiner.h:57
virtual bool WriteCombination(const ResourceVector &combine_resources, const OutputResourcePtr &combination, MessageHandler *handler)
Interface for writing bytes to an output stream.
Definition: writer.h:29
Definition: rewrite_driver.h:100
Definition: server_context.h:99
Definition: content_type.h:31
GoogleString ResolvedBase() const
virtual void RemoveLastResource()
Definition: message_handler.h:39
Definition: output_resource.h:44
OutputResourcePtr Combine(MessageHandler *handler)
A boolean with an expiration date.
Definition: resource_combiner.h:44
TimedBool AddResourceNoFetch(const ResourcePtr &resource, MessageHandler *handler)