Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
javascript_library_identification.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
17 
18 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_JAVASCRIPT_LIBRARY_IDENTIFICATION_H_
19 #define NET_INSTAWEB_REWRITER_PUBLIC_JAVASCRIPT_LIBRARY_IDENTIFICATION_H_
20 
21 #include <map>
22 
26 
27 namespace net_instaweb {
28 
35  public:
36  typedef uint64 SizeInBytes;
37 
38  static const int kNumHashChars = (126 + 5) / 6;
39 
42 
43  bool empty() const { return libraries_.empty(); }
44 
47  bool RegisterLibrary(
48  SizeInBytes bytes, StringPiece md5_hash, StringPiece canonical_url);
51  StringPiece Find(StringPiece minified_code) const;
53  void Merge(const JavascriptLibraryIdentification& src);
55  void AppendSignature(GoogleString* signature) const;
56 
57  private:
58  class LibraryInfo;
62  typedef GoogleString MD5Signature;
63  typedef std::map<MD5Signature, GoogleString> MD5ToUrlMap;
64  typedef std::map<SizeInBytes, MD5ToUrlMap> LibraryMap;
65 
66  LibraryMap libraries_;
67 
69 };
70 
71 }
72 
73 #endif
void AppendSignature(GoogleString *signature) const
Append a signature for the libraries recognized to *signature.
StringPiece Find(StringPiece minified_code) const
Definition: javascript_library_identification.h:34
bool RegisterLibrary(SizeInBytes bytes, StringPiece md5_hash, StringPiece canonical_url)
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
void Merge(const JavascriptLibraryIdentification &src)
Merge libraries recognized by src into this one.
static const int kNumHashChars
>=126 bits in base64
Definition: javascript_library_identification.h:38