Page Speed Optimization Libraries
1.13.35.1
|
#include "javascript_library_identification.h"
Public Types | |
typedef uint64 | SizeInBytes |
Public Member Functions | |
bool | empty () const |
bool | RegisterLibrary (SizeInBytes bytes, StringPiece md5_hash, StringPiece canonical_url) |
StringPiece | Find (StringPiece minified_code) const |
void | Merge (const JavascriptLibraryIdentification &src) |
Merge libraries recognized by src into this one. | |
void | AppendSignature (GoogleString *signature) const |
Append a signature for the libraries recognized to *signature. | |
Static Public Attributes | |
static const int | kNumHashChars = (126 + 5) / 6 |
>=126 bits in base64 | |
Holds the data necessary to identify the canonical urls of a set of known javascript libraries. We identify a library as "known" on the basis of its minified size in bytes and the web64-encoded md5 hash of its minified code. Minification allows us to tolerate changes in whitespace and the mix of minified and unminified versions of library code one sees served in the wild.
StringPiece net_instaweb::JavascriptLibraryIdentification::Find | ( | StringPiece | minified_code | ) | const |
Find canonical url of library; empty string if none. Storage for url is owned by the JavascriptLibraryIdentification object.
bool net_instaweb::JavascriptLibraryIdentification::RegisterLibrary | ( | SizeInBytes | bytes, |
StringPiece | md5_hash, | ||
StringPiece | canonical_url | ||
) |
Register a library for recognition. False indicates badly-formed hash or url.