Index: content/browser/loader/mojo_async_resource_handler.cc |
diff --git a/content/browser/loader/mojo_async_resource_handler.cc b/content/browser/loader/mojo_async_resource_handler.cc |
index 0d103654468e3923424646aa51031246b07daeef..1b8e719faa49ff91909205a0c85edf60f73d862c 100644 |
--- a/content/browser/loader/mojo_async_resource_handler.cc |
+++ b/content/browser/loader/mojo_async_resource_handler.cc |
@@ -23,7 +23,6 @@ |
#include "content/public/common/resource_response.h" |
#include "mojo/public/c/system/data_pipe.h" |
#include "mojo/public/cpp/bindings/message.h" |
-#include "mojo/public/cpp/system/data_pipe.h" |
#include "net/base/io_buffer.h" |
#include "net/base/load_flags.h" |
#include "net/base/mime_sniffer.h" |
@@ -181,6 +180,14 @@ bool MojoAsyncResourceHandler::OnResponseStarted(ResourceResponse* response, |
url_loader_client_->OnReceiveResponse(response->head, |
std::move(downloaded_file_ptr)); |
+ |
+ if (data_pipe_consumer_handle_.is_valid()) { |
+ // OnStartLoadingResponseBody waited for OnReceiveResponse. Now it can be |
+ // sent. |
+ url_loader_client_->OnStartLoadingResponseBody( |
+ std::move(data_pipe_consumer_handle_)); |
mmenke
2017/01/17 16:13:57
std::move leaves the original unique_ptr pointer i
dcheng
2017/01/17 23:20:18
Note that std::unique_ptr's moved from state is ac
yhirano
2017/01/18 09:10:45
Done (in OnReadCompleted), though I'm not sure if
|
+ } |
+ |
return true; |
} |
@@ -204,8 +211,14 @@ bool MojoAsyncResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
options.capacity_num_bytes = g_allocation_size; |
mojo::DataPipe data_pipe(options); |
- url_loader_client_->OnStartLoadingResponseBody( |
- std::move(data_pipe.consumer_handle)); |
+ if (sent_received_response_message_) { |
+ // OnResponseStarted has already been sent. It's OK to send this message. |
+ url_loader_client_->OnStartLoadingResponseBody( |
+ std::move(data_pipe.consumer_handle)); |
mmenke
2017/01/17 16:13:57
Is there any significant perf penalty with just al
Randy Smith (Not in Mondays)
2017/01/17 16:45:10
If you wanted to switch course, I don't currently
yhirano
2017/01/18 09:10:45
I found that moving this to OnReadCompleted simpli
|
+ } else { |
+ // To keep the message ordering, store the handle for a while. |
+ data_pipe_consumer_handle_ = std::move(data_pipe.consumer_handle); |
+ } |
if (!data_pipe.producer_handle.is_valid()) |
return false; |