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 #include <string> |
| 11 |
| 12 #include "base/memory/ref_counted.h" |
| 13 #include "content/browser/renderer_host/layered_resource_handler.h" |
| 14 |
| 15 |
| 16 namespace net { |
| 17 class IOBuffer; |
| 18 class URLRequest; |
| 19 class URLRequestStatus; |
| 20 } |
| 21 |
| 22 namespace content { |
| 23 |
| 24 class DuplicateResourceHandler: public LayeredResourceHandler { |
| 25 |
| 26 public: |
| 27 DuplicateResourceHandler(scoped_ptr<ResourceHandler> next_handler, |
| 28 net::URLRequest* request); |
| 29 virtual ~DuplicateResourceHandler(); |
| 30 |
| 31 private: |
| 32 enum { kReadBufSize = 32768 }; |
| 33 |
| 34 // ResourceHandler implementation |
| 35 /*virtual bool OnWillStart(int request_id, const GURL& url, |
| 36 bool* defer) OVERRIDE;*/ |
| 37 virtual bool OnWillRead(int request_id, |
| 38 net::IOBuffer** buf, |
| 39 int* buf_size, |
| 40 int min_size) OVERRIDE; |
| 41 virtual bool OnReadCompleted(int request_id, int bytes_read, |
| 42 bool* defer) OVERRIDE; |
| 43 virtual bool OnResponseCompleted(int request_id, |
| 44 const net::URLRequestStatus& status, |
| 45 const std::string& security_info) OVERRIDE; |
| 46 |
| 47 int bytes_read_; |
| 48 int bytes_hit_; // bytes that hit element in cache |
| 49 int bytes_miss_; // bytes that miss element in cache |
| 50 int read_buffer_size_; |
| 51 scoped_refptr<net::IOBuffer> read_buffer_; |
| 52 net::URLRequest* request_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(DuplicateResourceHandler); |
| 55 }; // class DuplicateResourceHandler |
| 56 |
| 57 } // namespace content |
| 58 |
| 59 |
| 60 #endif // CONTENT_BROWSER_RENDERER_HOST_DUPLICATE_RESOURCE_HANDLER_H_ |
OLD | NEW |