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: mojo/services/network/url_loader_impl.cc

Issue 340453002: Mojo: HTML Viewer based on Blink. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build Created 6 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
« no previous file with comments | « mojo/mojo_examples.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/services/network/url_loader_impl.h" 5 #include "mojo/services/network/url_loader_impl.h"
6 6
7 #include "mojo/common/common_type_converters.h" 7 #include "mojo/common/common_type_converters.h"
8 #include "mojo/services/network/network_context.h" 8 #include "mojo/services/network/network_context.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/load_flags.h" 10 #include "net/base/load_flags.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 client()->OnReceivedError(error.Pass()); 200 client()->OnReceivedError(error.Pass());
201 } 201 }
202 202
203 void URLLoaderImpl::ReadMore() { 203 void URLLoaderImpl::ReadMore() {
204 DCHECK(!pending_write_); 204 DCHECK(!pending_write_);
205 205
206 pending_write_ = new PendingWriteToDataPipe(response_body_stream_.Pass()); 206 pending_write_ = new PendingWriteToDataPipe(response_body_stream_.Pass());
207 207
208 uint32_t num_bytes; 208 uint32_t num_bytes;
209 if (!pending_write_->BeginWrite(&num_bytes)) 209 if (!pending_write_->BeginWrite(&num_bytes))
210 CHECK(false); // Oops! 210 CHECK(false); // Oops! TODO(darin): crbug/386877: The pipe might be full!
211 if (num_bytes > static_cast<uint32_t>(std::numeric_limits<int>::max())) 211 if (num_bytes > static_cast<uint32_t>(std::numeric_limits<int>::max()))
212 CHECK(false); // Oops! 212 CHECK(false); // Oops!
213 213
214 scoped_refptr<net::IOBuffer> buf = new DependentIOBuffer(pending_write_); 214 scoped_refptr<net::IOBuffer> buf = new DependentIOBuffer(pending_write_);
215 215
216 int bytes_read; 216 int bytes_read;
217 url_request_->Read(buf, static_cast<int>(num_bytes), &bytes_read); 217 url_request_->Read(buf, static_cast<int>(num_bytes), &bytes_read);
218 218
219 // Drop our reference to the buffer. 219 // Drop our reference to the buffer.
220 buf = NULL; 220 buf = NULL;
(...skipping 23 matching lines...) Expand all
244 if (completed_synchronously) { 244 if (completed_synchronously) {
245 base::MessageLoop::current()->PostTask( 245 base::MessageLoop::current()->PostTask(
246 FROM_HERE, 246 FROM_HERE,
247 base::Bind(&URLLoaderImpl::ReadMore, weak_ptr_factory_.GetWeakPtr())); 247 base::Bind(&URLLoaderImpl::ReadMore, weak_ptr_factory_.GetWeakPtr()));
248 } else { 248 } else {
249 ReadMore(); 249 ReadMore();
250 } 250 }
251 } 251 }
252 252
253 } // namespace mojo 253 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/mojo_examples.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698