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

Side by Side Diff: content/browser/loader/detached_resource_handler.h

Issue 25772002: Allows prefetch requests to live beyond the renderer by delaying (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added DetachableType function for generality. Created 7 years, 2 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
OLDNEW
(Empty)
1 // Copyright (c) 2013 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_LOADER_DETACHED_RESOURCE_HANDLER_H_
6 #define CONTENT_BROWSER_LOADER_DETACHED_RESOURCE_HANDLER_H_
7
8 #include <string>
9
10 #include "base/memory/ref_counted.h"
11 #include "content/browser/loader/resource_handler.h"
12 #include "content/browser/loader/resource_message_delegate.h"
13 #include "url/gurl.h"
14
15 namespace net {
16 class URLRequest;
17 class IOBuffer;
18 }
19
20 namespace content {
21 class ResourceDispatcherHostImpl;
22
23 // Used to complete an asynchronous resource request in which the renderer only
24 // cares about load and error events, and does not want to see the bytes. The
25 // handler will continue if the renderer dissappears.
26 class DetachedResourceHandler : public ResourceHandler {
27 public:
28 DetachedResourceHandler(net::URLRequest* request,
29 ResourceDispatcherHostImpl* rdh);
30 virtual ~DetachedResourceHandler();
31
32 // ResourceHandler implementation:
33 virtual bool OnUploadProgress(int request_id, uint64 position,
34 uint64 size) OVERRIDE;
35
36 virtual bool OnResponseStarted(int request_id, ResourceResponse* response,
37 bool* defer) OVERRIDE;
38
39 virtual bool OnWillStart(int request_id, const GURL& url,
40 bool* defer) OVERRIDE;
41
42 virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size,
43 int min_size) OVERRIDE;
44
45 virtual bool OnReadCompleted(int request_id, int bytes_read,
46 bool* defer) OVERRIDE;
47
48 virtual bool OnRequestRedirected(int request_id, const GURL& new_url,
49 ResourceResponse* response,
50 bool* defer) OVERRIDE;
51
52 virtual bool OnResponseCompleted(int request_id,
53 const net::URLRequestStatus& status,
54 const std::string& security_info) OVERRIDE;
mmenke 2013/10/11 16:39:07 nit: Add blank line between methods.
jkarlin2 2013/10/11 18:37:04 Done.
55 virtual void OnDataDownloaded(int request_id, int bytes_downloaded) OVERRIDE {
56 }
mmenke 2013/10/11 16:39:07 Suggest not inlining this.
jkarlin2 2013/10/11 18:37:04 Done.
57
58 private:
59 enum {
60 kReadBufSize = 3840
mmenke 2013/10/11 16:39:07 Is there a motivation for making it this size? We
jkarlin2 2013/10/11 18:37:04 Done. I copied it from the SyncResourceHandler. 3
61 };
mmenke 2013/10/11 16:39:07 Why not just use static const int? This also does
jkarlin2 2013/10/11 18:37:04 Done. I was copying SyncResourceHandler. static c
62 net::URLRequest* request_;
63 ResourceDispatcherHostImpl* rdh_;
64 scoped_refptr<net::IOBuffer> read_buffer_;
65 DISALLOW_COPY_AND_ASSIGN(DetachedResourceHandler);
mmenke 2013/10/11 16:39:07 nit: There's generally a blank line before DISALL
jkarlin2 2013/10/11 18:37:04 Done.
66 };
67
68 } // namespace content
69
70 #endif // CONTENT_BROWSER_LOADER_DETACHED_RESOURCE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698