OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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_RENDERER_HOST_DUPLICATE_RESOURCE_HANDLER_H_ | |
6 #define CONTENT_BROWSER_RENDERER_HOST_DUPLICATE_RESOURCE_HANDLER_H_ | |
7 #pragma once | |
8 | |
9 #include <set> | |
10 | |
11 #include "base/memory/ref_counted.h" | |
12 #include "content/browser/renderer_host/layered_resource_handler.h" | |
13 | |
14 namespace net { | |
15 class IOBuffer; | |
16 class URLRequest; | |
17 } | |
18 | |
19 namespace content { | |
20 | |
21 class DuplicateResourceHandler: public LayeredResourceHandler { | |
22 | |
23 public: | |
24 DuplicateResourceHandler(scoped_ptr<ResourceHandler> next_handler, | |
25 net::URLRequest* request); | |
26 virtual ~DuplicateResourceHandler(); | |
27 | |
28 private: | |
29 enum { kReadBufSize = 4000 }; | |
frankwang
2012/07/12 21:50:36
I set the buffer size to be 4000. In other handler
| |
30 | |
31 // ResourceHandler implementation | |
32 virtual bool OnWillStart(int request_id, const GURL& url, | |
33 bool* defer) OVERRIDE; | |
34 virtual bool OnWillRead(int request_id, | |
35 net::IOBuffer** buf, | |
36 int* buf_size, | |
37 int min_size) OVERRIDE; | |
38 virtual bool OnReadCompleted(int request_id, int bytes_read, | |
39 bool* defer) OVERRIDE; | |
40 | |
41 int bytes_hit_; // bytes that hit element in cache | |
42 int bytes_miss_; // bytes that miss element in cache | |
43 int read_buffer_size_; | |
44 scoped_refptr<net::IOBuffer> read_buffer_; | |
45 net::URLRequest* request_; | |
46 | |
47 DISALLOW_COPY_AND_ASSIGN(DuplicateResourceHandler); | |
48 }; // class DuplicateResourceHandler | |
49 | |
50 } // namespace content | |
51 | |
52 | |
53 #endif // CONTENT_BROWSER_RENDERER_HOST_DUPLICATE_RESOURCE_HANDLER_H_ | |
OLD | NEW |