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

Side by Side Diff: content/browser/renderer_host/doomed_resource_handler.h

Issue 9113028: Substitute ResourceHandlers with dummy ResourceHandler while request is transferred (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Darin's comments Created 8 years, 11 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 | Annotate | Revision Log
OLDNEW
(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_DOOMED_RESOURCE_HANDLER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_DOOMED_RESOURCE_HANDLER_H_
7 #pragma once
8
9 #include "base/memory/ref_counted.h"
10 #include "content/browser/renderer_host/resource_handler.h"
11
12 // ResourceHandler that DCHECKs on all events but canceling and failing of
13 // requests while activated for a URLRequest.
14 class DoomedResourceHandler : public ResourceHandler {
15 public:
16 // As the DoomedResourceHandler is constructed and substituted from code
17 // of another ResourceHandler, we need to make sure that this other handler
18 // does not lose its last reference and gets destroyed by being substituted.
19 // Therefore, we retain a reference to |old_handler| that prevents the
20 // destruction.
21 explicit DoomedResourceHandler(ResourceHandler* old_handler);
22
23 // ResourceHandler implementation:
24 virtual bool OnUploadProgress(int request_id,
25 uint64 position,
26 uint64 size) OVERRIDE;
27 virtual bool OnRequestRedirected(int request_id,
28 const GURL& new_url,
29 content::ResourceResponse* response,
30 bool* defer) OVERRIDE;
31 virtual bool OnResponseStarted(int request_id,
32 content::ResourceResponse* response) OVERRIDE;
33 virtual bool OnWillStart(int request_id,
34 const GURL& url,
35 bool* defer) OVERRIDE;
36 virtual bool OnWillRead(int request_id,
37 net::IOBuffer** buf,
38 int* buf_size,
39 int min_size) OVERRIDE;
40 virtual bool OnReadCompleted(int request_id,
41 int* bytes_read) OVERRIDE;
42 virtual bool OnResponseCompleted(int request_id,
43 const net::URLRequestStatus& status,
44 const std::string& security_info) OVERRIDE;
45 virtual void OnRequestClosed() OVERRIDE;
46 virtual void OnDataDownloaded(int request_id,
47 int bytes_downloaded) OVERRIDE;
48
49 private:
50 virtual ~DoomedResourceHandler();
51
52 scoped_refptr<ResourceHandler> old_handler_;
53
54 DISALLOW_COPY_AND_ASSIGN(DoomedResourceHandler);
55 };
56
57 #endif // CONTENT_BROWSER_RENDERER_HOST_DOOMED_RESOURCE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698