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 |
| 8 #include <string> |
| 9 |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "content/browser/renderer_host/layered_resource_handler.h" |
| 12 #include "third_party/smhasher/src/PMurHash.h" |
| 13 #include "webkit/glue/resource_type.h" |
| 14 |
| 15 namespace net { |
| 16 class IOBuffer; |
| 17 class URLRequest; |
| 18 class URLRequestStatus; |
| 19 } |
| 20 |
| 21 namespace content { |
| 22 |
| 23 class DuplicateResourceHandler: public LayeredResourceHandler { |
| 24 public: |
| 25 DuplicateResourceHandler(scoped_ptr<ResourceHandler> next_handler, |
| 26 ResourceType::Type resource_type, |
| 27 net::URLRequest* request); |
| 28 virtual ~DuplicateResourceHandler(); |
| 29 |
| 30 private: |
| 31 // ResourceHandler implementation |
| 32 virtual bool OnWillRead(int request_id, |
| 33 net::IOBuffer** buf, |
| 34 int* buf_size, |
| 35 int min_size) OVERRIDE; |
| 36 virtual bool OnReadCompleted(int request_id, |
| 37 int bytes_read, |
| 38 bool* defer) OVERRIDE; |
| 39 virtual bool OnResponseCompleted(int request_id, |
| 40 const net::URLRequestStatus& status, |
| 41 const std::string& security_info) OVERRIDE; |
| 42 |
| 43 ResourceType::Type resource_type_; |
| 44 int bytes_read_; |
| 45 scoped_refptr<net::IOBuffer> read_buffer_; |
| 46 net::URLRequest* request_; |
| 47 |
| 48 // These values are temporary values that are used in each digest of the |
| 49 // inputs for the incremental hash (PMurHash). |
| 50 MH_UINT32 pmurhash_ph1_; |
| 51 MH_UINT32 pmurhash_pcarry_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(DuplicateResourceHandler); |
| 54 }; |
| 55 |
| 56 } // namespace content |
| 57 |
| 58 #endif // CONTENT_BROWSER_RENDERER_HOST_DUPLICATE_RESOURCE_HANDLER_H_ |
| 59 |
OLD | NEW |