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"
30 #include "net/instaweb/util/public/gtest_prod.h"
34 namespace net_instaweb {
71 const StringPiece& extension,
88 const ResourceVector& resources()
const {
return resources_; }
95 MessageHandler* handler);
107 OutputResourcePtr
Combine(MessageHandler* handler);
112 const OutputResourcePtr& combination,
113 MessageHandler* handler);
121 MessageHandler* handler);
125 virtual void Clear();
131 friend class AggregateCombiner;
134 virtual const ContentType* CombinationContentType() = 0;
137 void UpdateResolvedBase();
140 void ComputeLeafSize();
144 void AccumulateLeafSize(
const StringPiece& url);
152 virtual void AccumulateCombinedSize(
const ResourcePtr& resource) {}
156 virtual bool ContentSizeTooBig()
const {
return false; }
163 virtual bool ResourceCombinable(Resource* resource,
164 GoogleString* failure_reason,
165 MessageHandler* handler);
167 UrlPartnership partnership_;
168 ResourceVector resources_;
169 StringVector multipart_encoder_urls_;
170 int prev_num_components_;
171 int accumulated_leaf_size_;
172 GoogleString resolved_base_;
173 const int url_overhead_;
174 RewriteFilter* filter_;
176 FRIEND_TEST(ResourceCombinerTest, TestRemove);
177 FRIEND_TEST(ResourceCombinerTest, TestRemoveFrom3);
178 FRIEND_TEST(ResourceCombinerTest, TestRebaseRemove);
179 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
ResourceCombiner(RewriteDriver *rewrite_driver, const StringPiece &extension, RewriteFilter *filter)
Note: extension should not include the leading dot here.
Definition: resource.h:56
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
virtual bool WritePiece(int index, const Resource *input, OutputResource *combination, Writer *writer, MessageHandler *handler)
Definition: rewrite_filter.h:37
Definition: resource_combiner.h:57
virtual bool WriteCombination(const ResourceVector &combine_resources, const OutputResourcePtr &combination, MessageHandler *handler)
Definition: rewrite_driver.h:98
Definition: server_context.h:100
GoogleString ResolvedBase() const
virtual void RemoveLastResource()
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)