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/webui/url_data_manager_backend.h" | 5 #include "content/browser/webui/url_data_manager_backend.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
392 | 392 |
393 void URLRequestChromeJob::MimeTypeAvailable(const std::string& mime_type) { | 393 void URLRequestChromeJob::MimeTypeAvailable(const std::string& mime_type) { |
394 set_mime_type(mime_type); | 394 set_mime_type(mime_type); |
395 NotifyHeadersComplete(); | 395 NotifyHeadersComplete(); |
396 } | 396 } |
397 | 397 |
398 void URLRequestChromeJob::DataAvailable(base::RefCountedMemory* bytes) { | 398 void URLRequestChromeJob::DataAvailable(base::RefCountedMemory* bytes) { |
399 TRACE_EVENT_ASYNC_END0("browser", "DataManager:Request", this); | 399 TRACE_EVENT_ASYNC_END0("browser", "DataManager:Request", this); |
400 DCHECK(!data_); | 400 DCHECK(!data_); |
401 | 401 |
402 // A passed-in nullptr signals an error. | |
403 if (!bytes) { | |
404 ReadRawDataComplete(net::ERR_FAILED); | |
405 return; | |
406 } | |
407 | |
408 // All further requests will be satisfied from the passed-in data. | 402 // All further requests will be satisfied from the passed-in data. |
409 data_ = bytes; | 403 data_ = bytes; |
410 | 404 |
411 if (pending_buf_) { | 405 if (pending_buf_) { |
412 int result = PostReadTask(pending_buf_, pending_buf_size_); | 406 int result = |
407 bytes ? PostReadTask(pending_buf_, pending_buf_size_) : net::ERR_FAILED; | |
413 pending_buf_ = nullptr; | 408 pending_buf_ = nullptr; |
414 if (result != net::ERR_IO_PENDING) | 409 if (result != net::ERR_IO_PENDING) |
415 ReadRawDataComplete(result); | 410 ReadRawDataComplete(result); |
411 } else if (!bytes) { | |
412 // TODO(pkasting): This doesn't seem right, we want FAILED, not CANCELED. | |
413 // NotifyDone() could do that, but we can't access it. | |
414 NotifyCanceled(); | |
mmenke
2016/08/27 12:56:52
For errors, this should be "OnRawReadComplete(net:
mmenke
2016/08/27 13:00:33
If the problem is that this class can't handle bei
Peter Kasting
2016/08/27 19:18:32
"OnRawReadComplete" isn't a string found in codese
mmenke
2016/08/27 20:21:25
Ah, I saw the addition of the "On return, |this| m
mmenke
2016/08/27 20:44:07
Alternatively, we could just remember the failure,
Peter Kasting
2016/08/27 22:03:51
There are no response headers, AFAIK. This isn't
mmenke
2016/08/27 22:28:05
Right, but URLRequest calls Start(), which must re
mmenke
2016/08/27 22:42:43
Also, note that there's no supported out-of-band w
Peter Kasting
2016/08/28 00:27:41
The critical call is URLDataSource::StartDataReque
| |
416 } | 415 } |
417 } | 416 } |
418 | 417 |
419 base::WeakPtr<URLRequestChromeJob> URLRequestChromeJob::AsWeakPtr() { | 418 base::WeakPtr<URLRequestChromeJob> URLRequestChromeJob::AsWeakPtr() { |
420 return weak_factory_.GetWeakPtr(); | 419 return weak_factory_.GetWeakPtr(); |
421 } | 420 } |
422 | 421 |
423 int URLRequestChromeJob::ReadRawData(net::IOBuffer* buf, int buf_size) { | 422 int URLRequestChromeJob::ReadRawData(net::IOBuffer* buf, int buf_size) { |
424 DCHECK(!pending_buf_.get()); | 423 DCHECK(!pending_buf_.get()); |
425 | 424 |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
835 | 834 |
836 } // namespace | 835 } // namespace |
837 | 836 |
838 net::URLRequestJobFactory::ProtocolHandler* CreateDevToolsProtocolHandler( | 837 net::URLRequestJobFactory::ProtocolHandler* CreateDevToolsProtocolHandler( |
839 ResourceContext* resource_context, | 838 ResourceContext* resource_context, |
840 bool is_incognito) { | 839 bool is_incognito) { |
841 return new DevToolsJobFactory(resource_context, is_incognito); | 840 return new DevToolsJobFactory(resource_context, is_incognito); |
842 } | 841 } |
843 | 842 |
844 } // namespace content | 843 } // namespace content |
OLD | NEW |