Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.


backport various changes to make #1050 work
Browse files Browse the repository at this point in the history
  • Loading branch information
crowell committed May 14, 2015
1 parent 741a865 commit 3ac0192
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
15 changes: 9 additions & 6 deletions net/instaweb/automatic/
Expand Up @@ -749,22 +749,25 @@ TEST_F(ProxyInterfaceTest, PassThroughEmptyResource) {
ResponseHeaders response_headers;
FetchFromProxy("text.txt", true, &text, &response_headers);
EXPECT_EQ(kContent, text);
// HTTP resource not found the first time.
EXPECT_EQ(1, http_cache()->cache_misses()->Get());
EXPECT_EQ(0, http_cache()->cache_hits()->Get());
// One lookup for ajax metadata and one for the HTTP response. Neither are
// found.
EXPECT_EQ(2, lru_cache()->num_misses());
EXPECT_EQ(1, http_cache()->cache_misses()->Get());
EXPECT_EQ(0, lru_cache()->num_hits());

GoogleString text2;
ResponseHeaders response_headers2;
FetchFromProxy("text.txt", true, &text2, &response_headers2);
EXPECT_EQ(kContent, text2);
// The HTTP response is found but the ajax metadata is not found.
EXPECT_EQ(1, lru_cache()->num_hits());
EXPECT_EQ(1, http_cache()->cache_hits()->Get());
EXPECT_EQ(1, lru_cache()->num_misses());
EXPECT_EQ(0, http_cache()->cache_misses()->Get());
// Empty resources are not remembered in this flow, so stats are exactly the
// same on second load.
EXPECT_EQ(1, http_cache()->cache_misses()->Get());
EXPECT_EQ(0, http_cache()->cache_hits()->Get());
EXPECT_EQ(2, lru_cache()->num_misses());
EXPECT_EQ(0, lru_cache()->num_hits());

TEST_F(ProxyInterfaceTest, SetCookieNotCached) {
Expand Down
2 changes: 1 addition & 1 deletion net/instaweb/rewriter/
Expand Up @@ -605,7 +605,7 @@ TEST_F(CssFlattenImportsTest, DontFlattenOverTinyLimit) {
TEST_F(CssFlattenImportsTest, FlattenEmpty) {
// We intentionally do not inline any empty resources.
const char kFilename[] = "empty.css";
const char css_in[] = "@import url(;";
const char css_in[] = "@import url( ;";
const char empty_content[] = "";

SetResponseWithDefaultHeaders(kFilename, kContentTypeCss, empty_content, 100);
Expand Down
6 changes: 1 addition & 5 deletions net/instaweb/rewriter/
Expand Up @@ -84,12 +84,8 @@ bool InlineRewriteContext::Partition(OutputPartitions* partitions,

bool ok = false;
GoogleString reason_for_failure;
if (!resource->IsSafeToRewrite(rewrite_uncacheable())) {
if (!resource->IsSafeToRewrite(rewrite_uncacheable(), &reason_for_failure)) {
// TODO(morlovich): Follow up by integrating with jmaessen's instrumentation
// of IsSafeToRewrite?
reason_for_failure =
"Can't inline since resource not fetchable or cacheable";
} else {
resource->AddInputInfoToPartition(Resource::kOmitInputHash, 0, partition);
if (ShouldInline(resource, &reason_for_failure)) {
Expand Down

0 comments on commit 3ac0192

Please sign in to comment.