Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(570)

Side by Side Diff: content/browser/loader/null_resource_handler.h

Issue 1041993004: content::ResourceDispatcherHostImpl changes for stale-while-revalidate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@s-w-r-yhirano-patch
Patch Set: Readability improvements suggested by tyoshino Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_LOADER_NULL_RESOURCE_HANDLER_H_
6 #define CONTENT_BROWSER_LOADER_NULL_RESOURCE_HANDLER_H_
7
8 #include "base/basictypes.h"
9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/time/time.h"
13 #include "base/timer/timer.h"
14 #include "content/browser/loader/resource_dispatcher_host_impl.h"
15 #include "content/browser/loader/resource_handler.h"
16
17 namespace net {
18 class IOBuffer;
19 class URLRequest;
20 } // namespace net
21
22 namespace content {
23
24 class ResourceController;
25
26 extern const int kNullResourceHandlerDefaultReadTimeoutSecs;
27
28 // A ResourceHandler which reads the entire response and drops it on the
29 // floor. It does not attempt to pass it to a child process (or even require a
30 // child process to exist).
31 class NullResourceHandler : public ResourceHandler {
32 public:
33 NullResourceHandler(net::URLRequest* request,
34 ResourceDispatcherHostImpl* rdh,
35 base::TimeDelta read_timeout);
36 ~NullResourceHandler() override;
37
38 // ResourceHandler implementation:
39 void SetController(ResourceController* controller) override;
40 bool OnUploadProgress(uint64 position, uint64 size) override;
41 bool OnRequestRedirected(const net::RedirectInfo& redirect_info,
42 ResourceResponse* response,
43 bool* defer) override;
44 bool OnResponseStarted(ResourceResponse* response, bool* defer) override;
45 bool OnWillStart(const GURL& url, bool* defer) override;
46 bool OnBeforeNetworkStart(const GURL& url, bool* defer) override;
47 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf,
48 int* buf_size,
49 int min_size) override;
50 bool OnReadCompleted(int bytes_read, bool* defer) override;
51 void OnResponseCompleted(const net::URLRequestStatus& status,
52 const std::string& security_info,
53 bool* defer) override;
54 void OnDataDownloaded(int bytes_downloaded) override;
55
56 private:
57 void OnReadTimeout();
58
59 scoped_refptr<net::IOBuffer> read_buffer_;
60 ResourceDispatcherHostImpl* rdh_;
61
62 // OneShotTimer does not permit passing the task to the constructor. Since
63 // that is convenient, use the base class instead
64 base::Timer read_timer_;
65
66 DISALLOW_COPY_AND_ASSIGN(NullResourceHandler);
67 };
68
69 } // namespace content
70
71 #endif // CONTENT_BROWSER_LOADER_NULL_RESOURCE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698