Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
http_dump_url_async_writer.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  */
16 
18 
19 #ifndef NET_INSTAWEB_HTTP_PUBLIC_HTTP_DUMP_URL_ASYNC_WRITER_H_
20 #define NET_INSTAWEB_HTTP_PUBLIC_HTTP_DUMP_URL_ASYNC_WRITER_H_
21 
27 
28 namespace net_instaweb {
29 
30 class AsyncFetch;
31 class FileSystem;
32 class MessageHandler;
33 class Timer;
34 
40  public:
41  HttpDumpUrlAsyncWriter(const StringPiece& root_dir,
42  UrlAsyncFetcher* base_fetcher,
43  FileSystem* file_system,
44  Timer* timer)
45  : dump_fetcher_(root_dir, file_system, timer),
46  base_fetcher_(base_fetcher),
47  file_system_(file_system),
48  accept_gzip_(true) {
49  root_dir.CopyToString(&root_dir_);
50  }
51  virtual ~HttpDumpUrlAsyncWriter();
52 
53  virtual bool SupportsHttps() const { return base_fetcher_->SupportsHttps(); }
54 
56  virtual void Fetch(const GoogleString& url,
57  MessageHandler* handler,
58  AsyncFetch* base_fetch);
59 
63  void set_accept_gzip(bool x) { accept_gzip_ = x; }
64 
66  void set_print_urls(bool on) { dump_fetcher_.set_print_urls(on); }
67 
68  private:
70  class DumpFetch;
71 
72  HttpDumpUrlFetcher dump_fetcher_;
74  UrlAsyncFetcher* base_fetcher_;
75  GoogleString root_dir_;
76  FileSystem* file_system_;
77  bool accept_gzip_;
78 
79 
80 };
81 
82 }
83 
84 #endif
Definition: http_dump_url_fetcher.h:45
void set_print_urls(bool on)
Print URLs each time they are fetched.
Definition: http_dump_url_async_writer.h:66
virtual bool SupportsHttps() const
Definition: http_dump_url_async_writer.h:53
virtual void Fetch(const GoogleString &url, MessageHandler *handler, AsyncFetch *base_fetch)
This is a synchronous/blocking implementation.
void set_print_urls(bool on)
Print URLs each time they are fetched.
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: http_dump_url_async_writer.h:39
Definition: async_fetch.h:53
Definition: file_system.h:76
void set_accept_gzip(bool x)
Definition: http_dump_url_async_writer.h:63
Definition: message_handler.h:39
virtual bool SupportsHttps() const
Definition: url_async_fetcher.h:54
Timer interface, made virtual so it can be mocked for tests.
Definition: timer.h:27
Definition: url_async_fetcher.h:33