Page Speed Optimization Libraries  1.9.32.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
static_rewriter.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011 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  */
16 
18 
19 #ifndef NET_INSTAWEB_AUTOMATIC_PUBLIC_STATIC_REWRITER_H_
20 #define NET_INSTAWEB_AUTOMATIC_PUBLIC_STATIC_REWRITER_H_
21 
25 #include "net/instaweb/util/public/simple_stats.h"
27 
28 namespace net_instaweb {
29 
30 class FileSystem;
31 class Hasher;
32 class MessageHandler;
33 class ProcessContext;
34 class ServerContext;
35 class Statistics;
36 class UrlAsyncFetcher;
37 class Writer;
38 
46  public:
47  FileRewriter(const ProcessContext& process_context,
48  const RewriteGflags* gflags,
49  bool echo_errors_to_stdout);
50  virtual ~FileRewriter();
51  virtual Hasher* NewHasher();
53  virtual MessageHandler* DefaultHtmlParseMessageHandler();
54  virtual MessageHandler* DefaultMessageHandler();
55  virtual FileSystem* DefaultFileSystem();
56  virtual void SetupCaches(ServerContext* server_context);
57  virtual Statistics* statistics();
60  virtual bool UseBeaconResultsInFilters() const { return false; }
61 
62  private:
63  const RewriteGflags* gflags_;
64  SimpleStats simple_stats_;
65  bool echo_errors_to_stdout_;
66 
67  DISALLOW_COPY_AND_ASSIGN(FileRewriter);
68 };
69 
73  public:
74  StaticRewriter(const ProcessContext& process_context,
75  int* argc, char*** argv);
76  explicit StaticRewriter(const ProcessContext& process_context);
77  ~StaticRewriter();
78 
79  bool ParseText(const StringPiece& text,
80  const StringPiece& url,
81  const StringPiece& id,
82  const StringPiece& output_dir,
83  Writer* writer);
84 
85  FileSystem* file_system();
86  MessageHandler* message_handler();
87 
88  private:
89  RewriteGflags gflags_;
90  FileRewriter file_rewriter_;
91  ServerContext* server_context_;
92 
93  DISALLOW_COPY_AND_ASSIGN(StaticRewriter);
94 };
95 
96 }
97 
98 #endif
Definition: static_rewriter.h:72
virtual void SetupCaches(ServerContext *server_context)
virtual UrlAsyncFetcher * DefaultAsyncUrlFetcher()
Definition: static_rewriter.h:45
virtual ServerContext * NewServerContext()
Definition: rewrite_gflags.h:32
Definition: server_context.h:100
Definition: process_context.h:35
virtual ServerContext * NewDecodingServerContext()
virtual bool UseBeaconResultsInFilters() const
Definition: static_rewriter.h:60
Definition: url_async_fetcher.h:33
Definition: rewrite_driver_factory.h:73