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

Side by Side Diff: content/browser/renderer_host/async_resource_handler.cc

Issue 10501004: Refactor the guts of ResourceDispatcherHostImpl into a new class named (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 #include "content/browser/renderer_host/async_resource_handler.h" 5 #include "content/browser/renderer_host/async_resource_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 return true; 200 return true;
201 DCHECK(read_buffer_.get()); 201 DCHECK(read_buffer_.get());
202 202
203 if (read_buffer_->buffer_size() == *bytes_read) { 203 if (read_buffer_->buffer_size() == *bytes_read) {
204 // The network layer has saturated our buffer. Next time, we should give it 204 // The network layer has saturated our buffer. Next time, we should give it
205 // a bigger buffer for it to fill, to minimize the number of round trips we 205 // a bigger buffer for it to fill, to minimize the number of round trips we
206 // do with the renderer process. 206 // do with the renderer process.
207 next_buffer_size_ = std::min(next_buffer_size_ * 2, kMaxReadBufSize); 207 next_buffer_size_ = std::min(next_buffer_size_ * 2, kMaxReadBufSize);
208 } 208 }
209 209
210 if (!rdh_->WillSendData(filter_->child_id(), request_id)) { 210 if (!rdh_->WillSendData(filter_->child_id(), request_id, defer)) {
211 // We should not send this data now, we have too many pending requests. 211 // We should not send this data now, we have too many pending requests.
212 return true; 212 return true;
213 } 213 }
214 214
215 base::SharedMemoryHandle handle; 215 base::SharedMemoryHandle handle;
216 if (!read_buffer_->shared_memory()->GiveToProcess( 216 if (!read_buffer_->shared_memory()->GiveToProcess(
217 filter_->peer_handle(), &handle)) { 217 filter_->peer_handle(), &handle)) {
218 // We wrongfully incremented the pending data count. Fake an ACK message 218 // We wrongfully incremented the pending data count. Fake an ACK message
219 // to fix this. We can't move this call above the WillSendData because 219 // to fix this. We can't move this call above the WillSendData because
220 // it's killing our read_buffer_, and we don't want that when we pause 220 // it's killing our read_buffer_, and we don't want that when we pause
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 void AsyncResourceHandler::GlobalCleanup() { 277 void AsyncResourceHandler::GlobalCleanup() {
278 if (g_spare_read_buffer) { 278 if (g_spare_read_buffer) {
279 // Avoid the CHECK in SharedIOBuffer::~SharedIOBuffer(). 279 // Avoid the CHECK in SharedIOBuffer::~SharedIOBuffer().
280 SharedIOBuffer* tmp = g_spare_read_buffer; 280 SharedIOBuffer* tmp = g_spare_read_buffer;
281 g_spare_read_buffer = NULL; 281 g_spare_read_buffer = NULL;
282 tmp->Release(); 282 tmp->Release();
283 } 283 }
284 } 284 }
285 285
286 } // namespace content 286 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698