19 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_JAVASCRIPT_CODE_BLOCK_H_
20 #define NET_INSTAWEB_REWRITER_PUBLIC_JAVASCRIPT_CODE_BLOCK_H_
24 #include "base/logging.h"
33 namespace pagespeed {
namespace js {
struct JsTokenizerPatterns; } }
35 namespace net_instaweb {
37 class JavascriptLibraryIdentification;
49 static const char kLibrariesIdentified[];
50 static const char kMinificationFailures[];
51 static const char kTotalBytesSaved[];
52 static const char kTotalOriginalBytes[];
53 static const char kMinifyUses[];
54 static const char kNumReducingMinifications[];
58 static const char kJSDidNotShrink[];
59 static const char kJSFailedToWrite[];
69 bool minify()
const {
return minify_; }
75 return library_identification_;
78 return js_tokenizer_patterns_;
81 Variable* blocks_minified() {
return blocks_minified_; }
82 Variable* libraries_identified() {
return libraries_identified_; }
83 Variable* minification_failures() {
return minification_failures_; }
84 Variable* total_bytes_saved() {
return total_bytes_saved_; }
85 Variable* total_original_bytes() {
return total_original_bytes_; }
86 Variable* num_uses() {
return num_uses_; }
87 Variable* num_reducing_uses() {
return num_reducing_minifications_; }
89 Variable* minification_disabled() {
return minification_disabled_; }
90 Variable* did_not_shrink() {
return did_not_shrink_; }
91 Variable* failed_to_write() {
return failed_to_write_; }
95 bool use_experimental_minifier_;
97 const JavascriptLibraryIdentification* library_identification_;
104 Variable* blocks_minified_;
106 Variable* libraries_identified_;
108 Variable* minification_failures_;
110 Variable* total_bytes_saved_;
114 Variable* total_original_bytes_;
119 Variable* num_reducing_minifications_;
123 Variable* minification_disabled_;
125 Variable* did_not_shrink_;
127 Variable* failed_to_write_;
162 return successfully_rewritten_;
168 DCHECK(successfully_rewritten_);
169 return rewritten_code_;
177 DCHECK(successfully_rewritten_);
178 return source_mappings_;
223 while ((pos = url_hash.find_first_of(
'-', pos)) != GoogleString::npos) {
234 static bool IsSanitarySourceMapUrl(StringPiece url);
238 source_map::MappingVector* source_mappings);
244 source_map::MappingVector source_mappings_;
249 bool successfully_rewritten_;
class GoogleUrl
Definition: google_url.h:58
void AppendSourceMapUrl(StringPiece url)
bool use_experimental_minifier() const
Definition: javascript_code_block.h:73
static void ToJsStringLiteral(const StringPiece &original, GoogleString *escaped)
Definition: javascript_code_block.h:210
static const char kJSMinificationDisabled[]
Those are JS rewrite failure type statistics.
Definition: javascript_code_block.h:57
Base class for implementations of monitoring statistics.
Definition: statistics.h:342
GoogleString Hash(const StringPiece &content) const
StringPiece rewritten_code() const
Definition: javascript_code_block.h:166
static bool UnsafeToRename(const StringPiece &script)
void EscapeToJsStringLiteral(const StringPiece &original, bool add_quotes, GoogleString *escaped)
void SwapRewrittenString(GoogleString *other)
Definition: javascript_library_identification.h:34
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
StringPiece ComputeJavascriptLibrary() const
Definition: js_tokenizer.h:194
const source_map::MappingVector & SourceMappings() const
Definition: javascript_code_block.h:175
bool minify() const
Whether to minify javascript output.
Definition: javascript_code_block.h:69
const GoogleString & message_id() const
Get message id passed in at creation time, for external diagnostics.
Definition: javascript_code_block.h:230
bool successfully_rewritten() const
Definition: javascript_code_block.h:160
static GoogleString JsUrlHash(const GoogleString &url, Hasher *hasher)
Definition: javascript_code_block.h:218
Definition: javascript_code_block.h:45
Definition: message_handler.h:39
static const char kIntrospectionComment[]
Definition: javascript_code_block.h:144
static const char kBlocksMinified[]
Statistics names.
Definition: javascript_code_block.h:48
Definition: javascript_code_block.h:139