Chromium Code Reviews| Index: content/browser/webui/url_data_manager_backend.cc |
| diff --git a/content/browser/webui/url_data_manager_backend.cc b/content/browser/webui/url_data_manager_backend.cc |
| index 4e2e979f59e1bc3e60cf6edd231b3368c8a9a9cf..7a270acc5b573940e9d1d99574e3222a3f9ad62a 100644 |
| --- a/content/browser/webui/url_data_manager_backend.cc |
| +++ b/content/browser/webui/url_data_manager_backend.cc |
| @@ -28,6 +28,8 @@ |
| #include "content/browser/webui/url_data_source_impl.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/content_browser_client.h" |
| +#include "content/public/browser/render_process_host.h" |
| +#include "content/public/browser/resource_request_info.h" |
| #include "content/public/common/url_constants.h" |
| #include "googleurl/src/url_util.h" |
| #include "net/base/io_buffer.h" |
| @@ -507,11 +509,17 @@ bool URLDataManagerBackend::StartRequest(const net::URLRequest* request, |
| job->set_deny_xframe_options( |
| source->source()->ShouldDenyXFrameOptions()); |
| + // Look up additional request info to pass down. |
| + int render_process_id = -1; |
| + int render_view_id = -1; |
| + ResourceRequestInfo::GetRenderViewForRequest(request, |
| + &render_process_id, |
| + &render_view_id); |
| + |
| // Forward along the request to the data source. |
| MessageLoop* target_message_loop = |
| source->source()->MessageLoopForRequestPath(path); |
| if (!target_message_loop) { |
| - bool is_incognito = job->is_incognito(); |
| job->MimeTypeAvailable(source->source()->GetMimeType(path)); |
| // Eliminate potentially dangling pointer to avoid future use. |
| job = NULL; |
| @@ -520,7 +528,7 @@ bool URLDataManagerBackend::StartRequest(const net::URLRequest* request, |
| // on for this path. Call directly into it from this thread, the IO |
| // thread. |
| source->source()->StartDataRequest( |
| - path, is_incognito, |
| + path, render_process_id, render_view_id, |
| base::Bind(&URLDataSourceImpl::SendResponse, source, request_id)); |
| } else { |
| // URLRequestChromeJob should receive mime type before data. This |
| @@ -538,8 +546,8 @@ bool URLDataManagerBackend::StartRequest(const net::URLRequest* request, |
| target_message_loop->PostTask( |
| FROM_HERE, |
| base::Bind(&URLDataManagerBackend::CallStartRequest, |
| - make_scoped_refptr(source), path, job->is_incognito(), |
| - request_id)); |
| + make_scoped_refptr(source), path, render_process_id, |
| + render_view_id, request_id)); |
| } |
| return true; |
| } |
| @@ -547,11 +555,20 @@ bool URLDataManagerBackend::StartRequest(const net::URLRequest* request, |
| void URLDataManagerBackend::CallStartRequest( |
| scoped_refptr<URLDataSourceImpl> source, |
| const std::string& path, |
| - bool is_incognito, |
| + int render_process_id, |
| + int render_view_id, |
| int request_id) { |
| + if (content::RenderProcessHost::FromID(render_process_id) == NULL) { |
|
jam
2013/04/22 18:17:10
this is called on whatever target message loop the
Jered
2013/04/22 20:46:54
Done.
|
| + // Make the request fail if its initiating renderer is no longer valid. |
| + // This can happen when the IO thread posts this task just before the |
| + // renderder shuts down. |
| + source->SendResponse(request_id, NULL); |
| + return; |
| + } |
| source->source()->StartDataRequest( |
| path, |
| - is_incognito, |
| + render_process_id, |
| + render_view_id, |
| base::Bind(&URLDataSourceImpl::SendResponse, source, request_id)); |
| } |