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

Unified Diff: content/browser/renderer_host/duplicate_resource_handler.h

Issue 10701151: DuplicateContentResourceHandler to monitor resources and track how many times th… (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/duplicate_resource_handler.h
===================================================================
--- content/browser/renderer_host/duplicate_resource_handler.h (revision 0)
+++ content/browser/renderer_host/duplicate_resource_handler.h (revision 0)
@@ -0,0 +1,53 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_DUPLICATE_RESOURCE_HANDLER_H_
+#define CONTENT_BROWSER_RENDERER_HOST_DUPLICATE_RESOURCE_HANDLER_H_
+#pragma once
+
+#include <set>
+
+#include "base/memory/ref_counted.h"
+#include "content/browser/renderer_host/layered_resource_handler.h"
+
+namespace net {
+class IOBuffer;
+class URLRequest;
+}
+
+namespace content {
+
+class DuplicateResourceHandler: public LayeredResourceHandler {
+
+ public:
+ DuplicateResourceHandler(scoped_ptr<ResourceHandler> next_handler,
+ net::URLRequest* request);
+ virtual ~DuplicateResourceHandler();
+
+ private:
+ enum { kReadBufSize = 4000 };
frankwang 2012/07/12 21:50:36 I set the buffer size to be 4000. In other handler
+
+ // ResourceHandler implementation
+ virtual bool OnWillStart(int request_id, const GURL& url,
+ bool* defer) OVERRIDE;
+ virtual bool OnWillRead(int request_id,
+ net::IOBuffer** buf,
+ int* buf_size,
+ int min_size) OVERRIDE;
+ virtual bool OnReadCompleted(int request_id, int bytes_read,
+ bool* defer) OVERRIDE;
+
+ int bytes_hit_; // bytes that hit element in cache
+ int bytes_miss_; // bytes that miss element in cache
+ int read_buffer_size_;
+ scoped_refptr<net::IOBuffer> read_buffer_;
+ net::URLRequest* request_;
+
+ DISALLOW_COPY_AND_ASSIGN(DuplicateResourceHandler);
+}; // class DuplicateResourceHandler
+
+} // namespace content
+
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_DUPLICATE_RESOURCE_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698