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

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

Issue 10644011: Revert r143458 (which re-applies r143341 and r142979). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_INFO_IMPL_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_INFO_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_INFO_IMPL_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_INFO_IMPL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/supports_user_data.h" 14 #include "base/supports_user_data.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "content/public/browser/resource_request_info.h" 16 #include "content/public/browser/resource_request_info.h"
17 #include "content/public/common/page_transition_types.h" 17 #include "content/public/common/page_transition_types.h"
18 #include "content/public/common/process_type.h" 18 #include "content/public/common/process_type.h"
19 #include "content/public/common/referrer.h" 19 #include "content/public/common/referrer.h"
20 #include "net/base/load_states.h" 20 #include "net/base/load_states.h"
21 #include "webkit/glue/resource_type.h" 21 #include "webkit/glue/resource_type.h"
22 22
23 namespace webkit_blob { 23 namespace webkit_blob {
24 class BlobData; 24 class BlobData;
25 } 25 }
26 26
27 namespace content { 27 namespace content {
28 class AsyncResourceHandler;
28 class CrossSiteResourceHandler; 29 class CrossSiteResourceHandler;
29 class ResourceContext; 30 class ResourceContext;
30 struct GlobalRequestID; 31 struct GlobalRequestID;
31 32
32 // Holds the data ResourceDispatcherHost associates with each request. 33 // Holds the data ResourceDispatcherHost associates with each request.
33 // Retrieve this data by calling ResourceDispatcherHost::InfoForRequest. 34 // Retrieve this data by calling ResourceDispatcherHost::InfoForRequest.
34 class ResourceRequestInfoImpl : public ResourceRequestInfo, 35 class ResourceRequestInfoImpl : public ResourceRequestInfo,
35 public base::SupportsUserData::Data { 36 public base::SupportsUserData::Data {
36 public: 37 public:
37 // Returns the ResourceRequestInfoImpl associated with the given URLRequest. 38 // Returns the ResourceRequestInfoImpl associated with the given URLRequest.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 virtual WebKit::WebReferrerPolicy GetReferrerPolicy() const OVERRIDE; 77 virtual WebKit::WebReferrerPolicy GetReferrerPolicy() const OVERRIDE;
77 virtual uint64 GetUploadSize() const OVERRIDE; 78 virtual uint64 GetUploadSize() const OVERRIDE;
78 virtual bool HasUserGesture() const OVERRIDE; 79 virtual bool HasUserGesture() const OVERRIDE;
79 virtual bool GetAssociatedRenderView(int* render_process_id, 80 virtual bool GetAssociatedRenderView(int* render_process_id,
80 int* render_view_id) const OVERRIDE; 81 int* render_view_id) const OVERRIDE;
81 82
82 void AssociateWithRequest(net::URLRequest* request); 83 void AssociateWithRequest(net::URLRequest* request);
83 84
84 GlobalRequestID GetGlobalRequestID() const; 85 GlobalRequestID GetGlobalRequestID() const;
85 86
86 // CrossSiteResourceHandler for this request, if it is a cross-site request. 87 // CrossSiteResourceHandler for this request. May be null.
87 // (NULL otherwise.) This handler is part of the chain of ResourceHandlers
88 // pointed to by resource_handler, and is not owned by this class.
89 CrossSiteResourceHandler* cross_site_handler() { 88 CrossSiteResourceHandler* cross_site_handler() {
90 return cross_site_handler_; 89 return cross_site_handler_;
91 } 90 }
92 void set_cross_site_handler(CrossSiteResourceHandler* h) { 91 void set_cross_site_handler(CrossSiteResourceHandler* h) {
93 cross_site_handler_ = h; 92 cross_site_handler_ = h;
94 } 93 }
95 94
95 // AsyncResourceHandler for this request. May be null.
96 AsyncResourceHandler* async_handler() {
97 return async_handler_;
98 }
99 void set_async_handler(AsyncResourceHandler* h) {
100 async_handler_ = h;
101 }
102
96 // Identifies the type of process (renderer, plugin, etc.) making the request. 103 // Identifies the type of process (renderer, plugin, etc.) making the request.
97 ProcessType process_type() const { 104 ProcessType process_type() const {
98 return process_type_; 105 return process_type_;
99 } 106 }
100 107
101 // Number of messages we've sent to the renderer that we haven't gotten an
102 // ACK for. This allows us to avoid having too many messages in flight.
103 int pending_data_count() const { return pending_data_count_; }
104 void IncrementPendingDataCount() { pending_data_count_++; }
105 void DecrementPendingDataCount() { pending_data_count_--; }
106
107 // Downloads are allowed only as a top level request. 108 // Downloads are allowed only as a top level request.
108 bool allow_download() const { return allow_download_; } 109 bool allow_download() const { return allow_download_; }
109 110
110 // Whether this is a download. 111 // Whether this is a download.
111 bool is_download() const { return is_download_; } 112 bool is_download() const { return is_download_; }
112 void set_is_download(bool download) { is_download_ = download; } 113 void set_is_download(bool download) { is_download_ = download; }
113 114
114 PageTransition transition_type() const { return transition_type_; } 115 PageTransition transition_type() const { return transition_type_; }
115 116
116 void set_upload_size(uint64 upload_size) { upload_size_ = upload_size; } 117 void set_upload_size(uint64 upload_size) { upload_size_ = upload_size; }
117 118
118 // The approximate in-memory size (bytes) that we credited this request 119 // The approximate in-memory size (bytes) that we credited this request
119 // as consuming in |outstanding_requests_memory_cost_map_|. 120 // as consuming in |outstanding_requests_memory_cost_map_|.
120 int memory_cost() const { return memory_cost_; } 121 int memory_cost() const { return memory_cost_; }
121 void set_memory_cost(int cost) { memory_cost_ = cost; } 122 void set_memory_cost(int cost) { memory_cost_ = cost; }
122 123
123 // We hold a reference to the requested blob data to ensure it doesn't 124 // We hold a reference to the requested blob data to ensure it doesn't
124 // get finally released prior to the net::URLRequestJob being started. 125 // get finally released prior to the net::URLRequestJob being started.
125 webkit_blob::BlobData* requested_blob_data() const { 126 webkit_blob::BlobData* requested_blob_data() const {
126 return requested_blob_data_.get(); 127 return requested_blob_data_.get();
127 } 128 }
128 void set_requested_blob_data(webkit_blob::BlobData* data); 129 void set_requested_blob_data(webkit_blob::BlobData* data);
129 130
130 private: 131 private:
131 // Non-owning, may be NULL. 132 // Non-owning, may be NULL.
132 CrossSiteResourceHandler* cross_site_handler_; 133 CrossSiteResourceHandler* cross_site_handler_;
134 AsyncResourceHandler* async_handler_;
133 135
134 ProcessType process_type_; 136 ProcessType process_type_;
135 int child_id_; 137 int child_id_;
136 int route_id_; 138 int route_id_;
137 int origin_pid_; 139 int origin_pid_;
138 int request_id_; 140 int request_id_;
139 bool is_main_frame_; 141 bool is_main_frame_;
140 int64 frame_id_; 142 int64 frame_id_;
141 bool parent_is_main_frame_; 143 bool parent_is_main_frame_;
142 int64 parent_frame_id_; 144 int64 parent_frame_id_;
143 int pending_data_count_;
144 bool is_download_; 145 bool is_download_;
145 bool allow_download_; 146 bool allow_download_;
146 bool has_user_gesture_; 147 bool has_user_gesture_;
147 ResourceType::Type resource_type_; 148 ResourceType::Type resource_type_;
148 PageTransition transition_type_; 149 PageTransition transition_type_;
149 uint64 upload_size_; 150 uint64 upload_size_;
150 int memory_cost_; 151 int memory_cost_;
151 scoped_refptr<webkit_blob::BlobData> requested_blob_data_; 152 scoped_refptr<webkit_blob::BlobData> requested_blob_data_;
152 WebKit::WebReferrerPolicy referrer_policy_; 153 WebKit::WebReferrerPolicy referrer_policy_;
153 ResourceContext* context_; 154 ResourceContext* context_;
154 155
155 DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl); 156 DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl);
156 }; 157 };
157 158
158 } // namespace content 159 } // namespace content
159 160
160 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_INFO_IMPL_H_ 161 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_INFO_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698