OLD | NEW |
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 #include "content/browser/loader/async_resource_handler.h" | 5 #include "content/browser/loader/async_resource_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 backing_(backing) { | 72 backing_(backing) { |
73 } | 73 } |
74 private: | 74 private: |
75 virtual ~DependentIOBuffer() {} | 75 virtual ~DependentIOBuffer() {} |
76 scoped_refptr<ResourceBuffer> backing_; | 76 scoped_refptr<ResourceBuffer> backing_; |
77 }; | 77 }; |
78 | 78 |
79 AsyncResourceHandler::AsyncResourceHandler( | 79 AsyncResourceHandler::AsyncResourceHandler( |
80 net::URLRequest* request, | 80 net::URLRequest* request, |
81 ResourceDispatcherHostImpl* rdh) | 81 ResourceDispatcherHostImpl* rdh) |
82 : ResourceHandler(request), | 82 : ResourceMessageDelegate(request), |
83 ResourceMessageDelegate(request), | 83 request_(request), |
84 rdh_(rdh), | 84 rdh_(rdh), |
85 pending_data_count_(0), | 85 pending_data_count_(0), |
86 allocation_size_(0), | 86 allocation_size_(0), |
87 did_defer_(false), | 87 did_defer_(false), |
88 has_checked_for_sufficient_resources_(false), | 88 has_checked_for_sufficient_resources_(false), |
89 sent_received_response_msg_(false), | 89 sent_received_response_msg_(false), |
90 sent_first_data_msg_(false) { | 90 sent_first_data_msg_(false) { |
91 InitializeResourceBufferConstants(); | 91 InitializeResourceBufferConstants(); |
92 } | 92 } |
93 | 93 |
94 AsyncResourceHandler::~AsyncResourceHandler() { | 94 AsyncResourceHandler::~AsyncResourceHandler() { |
95 if (has_checked_for_sufficient_resources_) | 95 if (has_checked_for_sufficient_resources_) |
96 rdh_->FinishedWithResourcesForRequest(request()); | 96 rdh_->FinishedWithResourcesForRequest(request_); |
97 } | 97 } |
98 | 98 |
99 bool AsyncResourceHandler::OnMessageReceived(const IPC::Message& message, | 99 bool AsyncResourceHandler::OnMessageReceived(const IPC::Message& message, |
100 bool* message_was_ok) { | 100 bool* message_was_ok) { |
101 bool handled = true; | 101 bool handled = true; |
102 IPC_BEGIN_MESSAGE_MAP_EX(AsyncResourceHandler, message, *message_was_ok) | 102 IPC_BEGIN_MESSAGE_MAP_EX(AsyncResourceHandler, message, *message_was_ok) |
103 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) | 103 IPC_MESSAGE_HANDLER(ResourceHostMsg_FollowRedirect, OnFollowRedirect) |
104 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataReceived_ACK, OnDataReceivedACK) | 104 IPC_MESSAGE_HANDLER(ResourceHostMsg_DataReceived_ACK, OnDataReceivedACK) |
105 IPC_MESSAGE_UNHANDLED(handled = false) | 105 IPC_MESSAGE_UNHANDLED(handled = false) |
106 IPC_END_MESSAGE_MAP_EX() | 106 IPC_END_MESSAGE_MAP_EX() |
107 return handled; | 107 return handled; |
108 } | 108 } |
109 | 109 |
110 void AsyncResourceHandler::OnFollowRedirect( | 110 void AsyncResourceHandler::OnFollowRedirect( |
111 int request_id, | 111 int request_id, |
112 bool has_new_first_party_for_cookies, | 112 bool has_new_first_party_for_cookies, |
113 const GURL& new_first_party_for_cookies) { | 113 const GURL& new_first_party_for_cookies) { |
114 if (!request()->status().is_success()) { | 114 if (!request_->status().is_success()) { |
115 DVLOG(1) << "OnFollowRedirect for invalid request"; | 115 DVLOG(1) << "OnFollowRedirect for invalid request"; |
116 return; | 116 return; |
117 } | 117 } |
118 | 118 |
119 if (has_new_first_party_for_cookies) | 119 if (has_new_first_party_for_cookies) |
120 request()->set_first_party_for_cookies(new_first_party_for_cookies); | 120 request_->set_first_party_for_cookies(new_first_party_for_cookies); |
121 | 121 |
122 ResumeIfDeferred(); | 122 ResumeIfDeferred(); |
123 } | 123 } |
124 | 124 |
125 void AsyncResourceHandler::OnDataReceivedACK(int request_id) { | 125 void AsyncResourceHandler::OnDataReceivedACK(int request_id) { |
126 if (pending_data_count_) { | 126 if (pending_data_count_) { |
127 --pending_data_count_; | 127 --pending_data_count_; |
128 | 128 |
129 buffer_->RecycleLeastRecentlyAllocated(); | 129 buffer_->RecycleLeastRecentlyAllocated(); |
130 if (buffer_->CanAllocate()) | 130 if (buffer_->CanAllocate()) |
131 ResumeIfDeferred(); | 131 ResumeIfDeferred(); |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 bool AsyncResourceHandler::OnUploadProgress(int request_id, | 135 bool AsyncResourceHandler::OnUploadProgress(int request_id, |
136 uint64 position, | 136 uint64 position, |
137 uint64 size) { | 137 uint64 size) { |
138 ResourceMessageFilter* filter = GetFilter(); | 138 const ResourceRequestInfoImpl* info = |
139 if (!filter) | 139 ResourceRequestInfoImpl::ForRequest(request_); |
| 140 if (!info->filter()) |
140 return false; | 141 return false; |
141 return filter->Send( | 142 return info->filter()->Send( |
142 new ResourceMsg_UploadProgress(request_id, position, size)); | 143 new ResourceMsg_UploadProgress(request_id, position, size)); |
143 } | 144 } |
144 | 145 |
145 bool AsyncResourceHandler::OnRequestRedirected(int request_id, | 146 bool AsyncResourceHandler::OnRequestRedirected(int request_id, |
146 const GURL& new_url, | 147 const GURL& new_url, |
147 ResourceResponse* response, | 148 ResourceResponse* response, |
148 bool* defer) { | 149 bool* defer) { |
149 const ResourceRequestInfoImpl* info = GetRequestInfo(); | 150 const ResourceRequestInfoImpl* info = |
| 151 ResourceRequestInfoImpl::ForRequest(request_); |
150 if (!info->filter()) | 152 if (!info->filter()) |
151 return false; | 153 return false; |
152 | 154 |
153 *defer = did_defer_ = true; | 155 *defer = did_defer_ = true; |
154 | 156 |
155 if (rdh_->delegate()) { | 157 if (rdh_->delegate()) { |
156 rdh_->delegate()->OnRequestRedirected( | 158 rdh_->delegate()->OnRequestRedirected( |
157 new_url, request(), info->GetContext(), response); | 159 new_url, request_, info->GetContext(), response); |
158 } | 160 } |
159 | 161 |
160 DevToolsNetLogObserver::PopulateResponseInfo(request(), response); | 162 DevToolsNetLogObserver::PopulateResponseInfo(request_, response); |
161 response->head.request_start = request()->creation_time(); | 163 response->head.request_start = request_->creation_time(); |
162 response->head.response_start = TimeTicks::Now(); | 164 response->head.response_start = TimeTicks::Now(); |
163 return info->filter()->Send(new ResourceMsg_ReceivedRedirect( | 165 return info->filter()->Send(new ResourceMsg_ReceivedRedirect( |
164 request_id, new_url, response->head)); | 166 request_id, new_url, response->head)); |
165 } | 167 } |
166 | 168 |
167 bool AsyncResourceHandler::OnResponseStarted(int request_id, | 169 bool AsyncResourceHandler::OnResponseStarted(int request_id, |
168 ResourceResponse* response, | 170 ResourceResponse* response, |
169 bool* defer) { | 171 bool* defer) { |
170 // For changes to the main frame, inform the renderer of the new URL's | 172 // For changes to the main frame, inform the renderer of the new URL's |
171 // per-host settings before the request actually commits. This way the | 173 // per-host settings before the request actually commits. This way the |
172 // renderer will be able to set these precisely at the time the | 174 // renderer will be able to set these precisely at the time the |
173 // request commits, avoiding the possibility of e.g. zooming the old content | 175 // request commits, avoiding the possibility of e.g. zooming the old content |
174 // or of having to layout the new content twice. | 176 // or of having to layout the new content twice. |
175 | 177 |
176 const ResourceRequestInfoImpl* info = GetRequestInfo(); | 178 const ResourceRequestInfoImpl* info = |
| 179 ResourceRequestInfoImpl::ForRequest(request_); |
177 if (!info->filter()) | 180 if (!info->filter()) |
178 return false; | 181 return false; |
179 | 182 |
180 if (rdh_->delegate()) { | 183 if (rdh_->delegate()) { |
181 rdh_->delegate()->OnResponseStarted( | 184 rdh_->delegate()->OnResponseStarted( |
182 request(), info->GetContext(), response, info->filter()); | 185 request_, info->GetContext(), response, info->filter()); |
183 } | 186 } |
184 | 187 |
185 DevToolsNetLogObserver::PopulateResponseInfo(request(), response); | 188 DevToolsNetLogObserver::PopulateResponseInfo(request_, response); |
186 | 189 |
187 HostZoomMap* host_zoom_map = | 190 HostZoomMap* host_zoom_map = |
188 GetHostZoomMapForResourceContext(info->GetContext()); | 191 GetHostZoomMapForResourceContext(info->GetContext()); |
189 | 192 |
190 if (info->GetResourceType() == ResourceType::MAIN_FRAME && host_zoom_map) { | 193 if (info->GetResourceType() == ResourceType::MAIN_FRAME && host_zoom_map) { |
191 const GURL& request_url = request()->url(); | 194 const GURL& request_url = request_->url(); |
192 info->filter()->Send(new ViewMsg_SetZoomLevelForLoadingURL( | 195 info->filter()->Send(new ViewMsg_SetZoomLevelForLoadingURL( |
193 info->GetRouteID(), | 196 info->GetRouteID(), |
194 request_url, host_zoom_map->GetZoomLevelForHostAndScheme( | 197 request_url, host_zoom_map->GetZoomLevelForHostAndScheme( |
195 request_url.scheme(), | 198 request_url.scheme(), |
196 net::GetHostOrSpecFromURL(request_url)))); | 199 net::GetHostOrSpecFromURL(request_url)))); |
197 } | 200 } |
198 | 201 |
199 response->head.request_start = request()->creation_time(); | 202 response->head.request_start = request_->creation_time(); |
200 response->head.response_start = TimeTicks::Now(); | 203 response->head.response_start = TimeTicks::Now(); |
201 info->filter()->Send(new ResourceMsg_ReceivedResponse(request_id, | 204 info->filter()->Send(new ResourceMsg_ReceivedResponse(request_id, |
202 response->head)); | 205 response->head)); |
203 sent_received_response_msg_ = true; | 206 sent_received_response_msg_ = true; |
204 | 207 |
205 if (request()->response_info().metadata.get()) { | 208 if (request_->response_info().metadata.get()) { |
206 std::vector<char> copy(request()->response_info().metadata->data(), | 209 std::vector<char> copy(request_->response_info().metadata->data(), |
207 request()->response_info().metadata->data() + | 210 request_->response_info().metadata->data() + |
208 request()->response_info().metadata->size()); | 211 request_->response_info().metadata->size()); |
209 info->filter()->Send(new ResourceMsg_ReceivedCachedMetadata(request_id, | 212 info->filter()->Send(new ResourceMsg_ReceivedCachedMetadata(request_id, |
210 copy)); | 213 copy)); |
211 } | 214 } |
212 | 215 |
213 return true; | 216 return true; |
214 } | 217 } |
215 | 218 |
216 bool AsyncResourceHandler::OnWillStart(int request_id, | 219 bool AsyncResourceHandler::OnWillStart(int request_id, |
217 const GURL& url, | 220 const GURL& url, |
218 bool* defer) { | 221 bool* defer) { |
219 return true; | 222 return true; |
220 } | 223 } |
221 | 224 |
222 bool AsyncResourceHandler::OnWillRead(int request_id, | 225 bool AsyncResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf, |
223 scoped_refptr<net::IOBuffer>* buf, | 226 int* buf_size, int min_size) { |
224 int* buf_size, | |
225 int min_size) { | |
226 DCHECK_EQ(-1, min_size); | 227 DCHECK_EQ(-1, min_size); |
227 | 228 |
228 if (!EnsureResourceBufferIsInitialized()) | 229 if (!EnsureResourceBufferIsInitialized()) |
229 return false; | 230 return false; |
230 | 231 |
231 DCHECK(buffer_->CanAllocate()); | 232 DCHECK(buffer_->CanAllocate()); |
232 char* memory = buffer_->Allocate(&allocation_size_); | 233 char* memory = buffer_->Allocate(&allocation_size_); |
233 CHECK(memory); | 234 CHECK(memory); |
234 | 235 |
235 *buf = new DependentIOBuffer(buffer_.get(), memory); | 236 *buf = new DependentIOBuffer(buffer_.get(), memory); |
236 *buf_size = allocation_size_; | 237 *buf_size = allocation_size_; |
237 | 238 |
238 UMA_HISTOGRAM_CUSTOM_COUNTS( | 239 UMA_HISTOGRAM_CUSTOM_COUNTS( |
239 "Net.AsyncResourceHandler_SharedIOBuffer_Alloc", | 240 "Net.AsyncResourceHandler_SharedIOBuffer_Alloc", |
240 *buf_size, 0, kMaxAllocationSize, 100); | 241 *buf_size, 0, kMaxAllocationSize, 100); |
241 return true; | 242 return true; |
242 } | 243 } |
243 | 244 |
244 bool AsyncResourceHandler::OnReadCompleted(int request_id, int bytes_read, | 245 bool AsyncResourceHandler::OnReadCompleted(int request_id, int bytes_read, |
245 bool* defer) { | 246 bool* defer) { |
246 if (!bytes_read) | 247 if (!bytes_read) |
247 return true; | 248 return true; |
248 | 249 |
249 ResourceMessageFilter* filter = GetFilter(); | 250 const ResourceRequestInfoImpl* info = |
250 if (!filter) | 251 ResourceRequestInfoImpl::ForRequest(request_); |
| 252 if (!info->filter()) |
251 return false; | 253 return false; |
252 | 254 |
253 buffer_->ShrinkLastAllocation(bytes_read); | 255 buffer_->ShrinkLastAllocation(bytes_read); |
254 | 256 |
255 UMA_HISTOGRAM_CUSTOM_COUNTS( | 257 UMA_HISTOGRAM_CUSTOM_COUNTS( |
256 "Net.AsyncResourceHandler_SharedIOBuffer_Used", | 258 "Net.AsyncResourceHandler_SharedIOBuffer_Used", |
257 bytes_read, 0, kMaxAllocationSize, 100); | 259 bytes_read, 0, kMaxAllocationSize, 100); |
258 UMA_HISTOGRAM_PERCENTAGE( | 260 UMA_HISTOGRAM_PERCENTAGE( |
259 "Net.AsyncResourceHandler_SharedIOBuffer_UsedPercentage", | 261 "Net.AsyncResourceHandler_SharedIOBuffer_UsedPercentage", |
260 CalcUsedPercentage(bytes_read, allocation_size_)); | 262 CalcUsedPercentage(bytes_read, allocation_size_)); |
261 | 263 |
262 if (!sent_first_data_msg_) { | 264 if (!sent_first_data_msg_) { |
263 base::SharedMemoryHandle handle; | 265 base::SharedMemoryHandle handle; |
264 int size; | 266 int size; |
265 if (!buffer_->ShareToProcess(filter->PeerHandle(), &handle, &size)) | 267 if (!buffer_->ShareToProcess(info->filter()->PeerHandle(), &handle, &size)) |
266 return false; | 268 return false; |
267 filter->Send(new ResourceMsg_SetDataBuffer( | 269 info->filter()->Send(new ResourceMsg_SetDataBuffer( |
268 request_id, handle, size, filter->peer_pid())); | 270 request_id, handle, size, info->filter()->peer_pid())); |
269 sent_first_data_msg_ = true; | 271 sent_first_data_msg_ = true; |
270 } | 272 } |
271 | 273 |
272 int data_offset = buffer_->GetLastAllocationOffset(); | 274 int data_offset = buffer_->GetLastAllocationOffset(); |
273 int encoded_data_length = | 275 int encoded_data_length = |
274 DevToolsNetLogObserver::GetAndResetEncodedDataLength(request()); | 276 DevToolsNetLogObserver::GetAndResetEncodedDataLength(request_); |
275 | 277 |
276 filter->Send(new ResourceMsg_DataReceived( | 278 info->filter()->Send(new ResourceMsg_DataReceived( |
277 request_id, data_offset, bytes_read, encoded_data_length)); | 279 request_id, data_offset, bytes_read, encoded_data_length)); |
278 ++pending_data_count_; | 280 ++pending_data_count_; |
279 UMA_HISTOGRAM_CUSTOM_COUNTS( | 281 UMA_HISTOGRAM_CUSTOM_COUNTS( |
280 "Net.AsyncResourceHandler_PendingDataCount", | 282 "Net.AsyncResourceHandler_PendingDataCount", |
281 pending_data_count_, 0, 100, 100); | 283 pending_data_count_, 0, 100, 100); |
282 | 284 |
283 if (!buffer_->CanAllocate()) { | 285 if (!buffer_->CanAllocate()) { |
284 UMA_HISTOGRAM_CUSTOM_COUNTS( | 286 UMA_HISTOGRAM_CUSTOM_COUNTS( |
285 "Net.AsyncResourceHandler_PendingDataCount_WhenFull", | 287 "Net.AsyncResourceHandler_PendingDataCount_WhenFull", |
286 pending_data_count_, 0, 100, 100); | 288 pending_data_count_, 0, 100, 100); |
287 *defer = did_defer_ = true; | 289 *defer = did_defer_ = true; |
288 } | 290 } |
289 | 291 |
290 return true; | 292 return true; |
291 } | 293 } |
292 | 294 |
293 void AsyncResourceHandler::OnDataDownloaded( | 295 void AsyncResourceHandler::OnDataDownloaded( |
294 int request_id, int bytes_downloaded) { | 296 int request_id, int bytes_downloaded) { |
295 int encoded_data_length = | 297 int encoded_data_length = |
296 DevToolsNetLogObserver::GetAndResetEncodedDataLength(request()); | 298 DevToolsNetLogObserver::GetAndResetEncodedDataLength(request_); |
297 | 299 |
298 ResourceMessageFilter* filter = GetFilter(); | 300 const ResourceRequestInfoImpl* info = |
299 if (filter) { | 301 ResourceRequestInfoImpl::ForRequest(request_); |
300 filter->Send(new ResourceMsg_DataDownloaded( | 302 if (info->filter()) { |
| 303 info->filter()->Send(new ResourceMsg_DataDownloaded( |
301 request_id, bytes_downloaded, encoded_data_length)); | 304 request_id, bytes_downloaded, encoded_data_length)); |
302 } | 305 } |
303 } | 306 } |
304 | 307 |
305 bool AsyncResourceHandler::OnResponseCompleted( | 308 bool AsyncResourceHandler::OnResponseCompleted( |
306 int request_id, | 309 int request_id, |
307 const net::URLRequestStatus& status, | 310 const net::URLRequestStatus& status, |
308 const std::string& security_info) { | 311 const std::string& security_info) { |
309 const ResourceRequestInfoImpl* info = GetRequestInfo(); | 312 const ResourceRequestInfoImpl* info = |
| 313 ResourceRequestInfoImpl::ForRequest(request_); |
310 if (!info->filter()) | 314 if (!info->filter()) |
311 return false; | 315 return false; |
312 | 316 |
313 // If we crash here, figure out what URL the renderer was requesting. | 317 // If we crash here, figure out what URL the renderer was requesting. |
314 // http://crbug.com/107692 | 318 // http://crbug.com/107692 |
315 char url_buf[128]; | 319 char url_buf[128]; |
316 base::strlcpy(url_buf, request()->url().spec().c_str(), arraysize(url_buf)); | 320 base::strlcpy(url_buf, request_->url().spec().c_str(), arraysize(url_buf)); |
317 base::debug::Alias(url_buf); | 321 base::debug::Alias(url_buf); |
318 | 322 |
319 // TODO(gavinp): Remove this CHECK when we figure out the cause of | 323 // TODO(gavinp): Remove this CHECK when we figure out the cause of |
320 // http://crbug.com/124680 . This check mirrors closely check in | 324 // http://crbug.com/124680 . This check mirrors closely check in |
321 // WebURLLoaderImpl::OnCompletedRequest that routes this message to a WebCore | 325 // WebURLLoaderImpl::OnCompletedRequest that routes this message to a WebCore |
322 // ResourceHandleInternal which asserts on its state and crashes. By crashing | 326 // ResourceHandleInternal which asserts on its state and crashes. By crashing |
323 // when the message is sent, we should get better crash reports. | 327 // when the message is sent, we should get better crash reports. |
324 CHECK(status.status() != net::URLRequestStatus::SUCCESS || | 328 CHECK(status.status() != net::URLRequestStatus::SUCCESS || |
325 sent_received_response_msg_); | 329 sent_received_response_msg_); |
326 | 330 |
327 TimeTicks completion_time = TimeTicks::Now(); | 331 TimeTicks completion_time = TimeTicks::Now(); |
328 | 332 |
329 int error_code = status.error(); | 333 int error_code = status.error(); |
330 bool was_ignored_by_handler = info->WasIgnoredByHandler(); | 334 bool was_ignored_by_handler = |
| 335 ResourceRequestInfoImpl::ForRequest(request_)->WasIgnoredByHandler(); |
331 | 336 |
332 DCHECK(status.status() != net::URLRequestStatus::IO_PENDING); | 337 DCHECK(status.status() != net::URLRequestStatus::IO_PENDING); |
333 // If this check fails, then we're in an inconsistent state because all | 338 // If this check fails, then we're in an inconsistent state because all |
334 // requests ignored by the handler should be canceled (which should result in | 339 // requests ignored by the handler should be canceled (which should result in |
335 // the ERR_ABORTED error code). | 340 // the ERR_ABORTED error code). |
336 DCHECK(!was_ignored_by_handler || error_code == net::ERR_ABORTED); | 341 DCHECK(!was_ignored_by_handler || error_code == net::ERR_ABORTED); |
337 | 342 |
338 // TODO(mkosiba): Fix up cases where we create a URLRequestStatus | 343 // TODO(mkosiba): Fix up cases where we create a URLRequestStatus |
339 // with a status() != SUCCESS and an error_code() == net::OK. | 344 // with a status() != SUCCESS and an error_code() == net::OK. |
340 if (status.status() == net::URLRequestStatus::CANCELED && | 345 if (status.status() == net::URLRequestStatus::CANCELED && |
(...skipping 12 matching lines...) Expand all Loading... |
353 completion_time)); | 358 completion_time)); |
354 return true; | 359 return true; |
355 } | 360 } |
356 | 361 |
357 bool AsyncResourceHandler::EnsureResourceBufferIsInitialized() { | 362 bool AsyncResourceHandler::EnsureResourceBufferIsInitialized() { |
358 if (buffer_.get() && buffer_->IsInitialized()) | 363 if (buffer_.get() && buffer_->IsInitialized()) |
359 return true; | 364 return true; |
360 | 365 |
361 if (!has_checked_for_sufficient_resources_) { | 366 if (!has_checked_for_sufficient_resources_) { |
362 has_checked_for_sufficient_resources_ = true; | 367 has_checked_for_sufficient_resources_ = true; |
363 if (!rdh_->HasSufficientResourcesForRequest(request())) { | 368 if (!rdh_->HasSufficientResourcesForRequest(request_)) { |
364 controller()->CancelWithError(net::ERR_INSUFFICIENT_RESOURCES); | 369 controller()->CancelWithError(net::ERR_INSUFFICIENT_RESOURCES); |
365 return false; | 370 return false; |
366 } | 371 } |
367 } | 372 } |
368 | 373 |
369 buffer_ = new ResourceBuffer(); | 374 buffer_ = new ResourceBuffer(); |
370 return buffer_->Initialize(kBufferSize, | 375 return buffer_->Initialize(kBufferSize, |
371 kMinAllocationSize, | 376 kMinAllocationSize, |
372 kMaxAllocationSize); | 377 kMaxAllocationSize); |
373 } | 378 } |
374 | 379 |
375 void AsyncResourceHandler::ResumeIfDeferred() { | 380 void AsyncResourceHandler::ResumeIfDeferred() { |
376 if (did_defer_) { | 381 if (did_defer_) { |
377 did_defer_ = false; | 382 did_defer_ = false; |
378 controller()->Resume(); | 383 controller()->Resume(); |
379 } | 384 } |
380 } | 385 } |
381 | 386 |
382 } // namespace content | 387 } // namespace content |
OLD | NEW |