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

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

Issue 10568005: Balance defers with Resume. (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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 virtual ResourceType::Type GetResourceType() const OVERRIDE; 76 virtual ResourceType::Type GetResourceType() const OVERRIDE;
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 GetAssociatedRenderView(int* render_process_id, 79 virtual bool GetAssociatedRenderView(int* render_process_id,
79 int* render_view_id) const OVERRIDE; 80 int* render_view_id) const OVERRIDE;
80 81
81 void AssociateWithRequest(net::URLRequest* request); 82 void AssociateWithRequest(net::URLRequest* request);
82 83
83 GlobalRequestID GetGlobalRequestID() const; 84 GlobalRequestID GetGlobalRequestID() const;
84 85
85 // CrossSiteResourceHandler for this request, if it is a cross-site request. 86 // CrossSiteResourceHandler for this request. May be null.
86 // (NULL otherwise.) This handler is part of the chain of ResourceHandlers
87 // pointed to by resource_handler, and is not owned by this class.
88 CrossSiteResourceHandler* cross_site_handler() { 87 CrossSiteResourceHandler* cross_site_handler() {
89 return cross_site_handler_; 88 return cross_site_handler_;
90 } 89 }
91 void set_cross_site_handler(CrossSiteResourceHandler* h) { 90 void set_cross_site_handler(CrossSiteResourceHandler* h) {
92 cross_site_handler_ = h; 91 cross_site_handler_ = h;
93 } 92 }
94 93
94 // AsyncResourceHandler for this request. May be null.
95 AsyncResourceHandler* async_handler() {
96 return async_handler_;
97 }
98 void set_async_handler(AsyncResourceHandler* h) {
99 async_handler_ = h;
100 }
101
95 // Identifies the type of process (renderer, plugin, etc.) making the request. 102 // Identifies the type of process (renderer, plugin, etc.) making the request.
96 ProcessType process_type() const { 103 ProcessType process_type() const {
97 return process_type_; 104 return process_type_;
98 } 105 }
99 106
100 // Number of messages we've sent to the renderer that we haven't gotten an
101 // ACK for. This allows us to avoid having too many messages in flight.
102 int pending_data_count() const { return pending_data_count_; }
103 void IncrementPendingDataCount() { pending_data_count_++; }
104 void DecrementPendingDataCount() { pending_data_count_--; }
105
106 // Downloads are allowed only as a top level request. 107 // Downloads are allowed only as a top level request.
107 bool allow_download() const { return allow_download_; } 108 bool allow_download() const { return allow_download_; }
108 109
109 bool has_user_gesture() const { return has_user_gesture_; } 110 bool has_user_gesture() const { return has_user_gesture_; }
110 111
111 // Whether this is a download. 112 // Whether this is a download.
112 bool is_download() const { return is_download_; } 113 bool is_download() const { return is_download_; }
113 void set_is_download(bool download) { is_download_ = download; } 114 void set_is_download(bool download) { is_download_ = download; }
114 115
115 PageTransition transition_type() const { return transition_type_; } 116 PageTransition transition_type() const { return transition_type_; }
116 117
117 void set_upload_size(uint64 upload_size) { upload_size_ = upload_size; } 118 void set_upload_size(uint64 upload_size) { upload_size_ = upload_size; }
118 119
119 // The approximate in-memory size (bytes) that we credited this request 120 // The approximate in-memory size (bytes) that we credited this request
120 // as consuming in |outstanding_requests_memory_cost_map_|. 121 // as consuming in |outstanding_requests_memory_cost_map_|.
121 int memory_cost() const { return memory_cost_; } 122 int memory_cost() const { return memory_cost_; }
122 void set_memory_cost(int cost) { memory_cost_ = cost; } 123 void set_memory_cost(int cost) { memory_cost_ = cost; }
123 124
124 // We hold a reference to the requested blob data to ensure it doesn't 125 // We hold a reference to the requested blob data to ensure it doesn't
125 // get finally released prior to the net::URLRequestJob being started. 126 // get finally released prior to the net::URLRequestJob being started.
126 webkit_blob::BlobData* requested_blob_data() const { 127 webkit_blob::BlobData* requested_blob_data() const {
127 return requested_blob_data_.get(); 128 return requested_blob_data_.get();
128 } 129 }
129 void set_requested_blob_data(webkit_blob::BlobData* data); 130 void set_requested_blob_data(webkit_blob::BlobData* data);
130 131
131 private: 132 private:
132 // Non-owning, may be NULL. 133 // Non-owning, may be NULL.
133 CrossSiteResourceHandler* cross_site_handler_; 134 CrossSiteResourceHandler* cross_site_handler_;
135 AsyncResourceHandler* async_handler_;
134 136
135 ProcessType process_type_; 137 ProcessType process_type_;
136 int child_id_; 138 int child_id_;
137 int route_id_; 139 int route_id_;
138 int origin_pid_; 140 int origin_pid_;
139 int request_id_; 141 int request_id_;
140 bool is_main_frame_; 142 bool is_main_frame_;
141 int64 frame_id_; 143 int64 frame_id_;
142 bool parent_is_main_frame_; 144 bool parent_is_main_frame_;
143 int64 parent_frame_id_; 145 int64 parent_frame_id_;
144 int pending_data_count_;
145 bool is_download_; 146 bool is_download_;
146 bool allow_download_; 147 bool allow_download_;
147 bool has_user_gesture_; 148 bool has_user_gesture_;
148 ResourceType::Type resource_type_; 149 ResourceType::Type resource_type_;
149 PageTransition transition_type_; 150 PageTransition transition_type_;
150 uint64 upload_size_; 151 uint64 upload_size_;
151 int memory_cost_; 152 int memory_cost_;
152 scoped_refptr<webkit_blob::BlobData> requested_blob_data_; 153 scoped_refptr<webkit_blob::BlobData> requested_blob_data_;
153 WebKit::WebReferrerPolicy referrer_policy_; 154 WebKit::WebReferrerPolicy referrer_policy_;
154 ResourceContext* context_; 155 ResourceContext* context_;
155 156
156 DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl); 157 DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl);
157 }; 158 };
158 159
159 } // namespace content 160 } // namespace content
160 161
161 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_INFO_IMPL_H_ 162 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_INFO_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/resource_loader.cc ('k') | content/browser/renderer_host/resource_request_info_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698