Chromium Code Reviews| Index: content/child/resource_dispatcher.cc |
| diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc |
| index c5243b56ddeaa44979c0b64d26afb193e13297aa..0ace723c2a45722b7f5e32e922cb7f4848efa30c 100644 |
| --- a/content/child/resource_dispatcher.cc |
| +++ b/content/child/resource_dispatcher.cc |
| @@ -17,6 +17,7 @@ |
| #include "base/strings/string_util.h" |
| #include "content/child/request_extra_data.h" |
| #include "content/child/site_isolation_policy.h" |
| +#include "content/child/webparserresourcebridge_impl.h" |
| #include "content/common/inter_process_time_ticks_converter.h" |
| #include "content/common/resource_messages.h" |
| #include "content/public/child/resource_dispatcher_delegate.h" |
| @@ -78,6 +79,8 @@ class IPCResourceLoaderBridge : public ResourceLoaderBridge { |
| virtual void Cancel() OVERRIDE; |
| virtual void SetDefersLoading(bool value) OVERRIDE; |
| virtual void DidChangePriority(net::RequestPriority new_priority) OVERRIDE; |
| + virtual blink::WebParserResourceBridge* |
| + ConstructParserResourceBridge() OVERRIDE; |
| virtual void SyncLoad(SyncLoadResponse* response) OVERRIDE; |
| private: |
| @@ -231,6 +234,16 @@ void IPCResourceLoaderBridge::DidChangePriority( |
| dispatcher_->DidChangePriority(routing_id_, request_id_, new_priority); |
| } |
| +blink::WebParserResourceBridge* |
| +IPCResourceLoaderBridge::ConstructParserResourceBridge() { |
| + if (request_id_ < 0) { |
| + NOTREACHED() << "Trying to set parser-resource bridge on unstarted request"; |
| + return NULL; |
| + } |
| + |
| + return dispatcher_->ConstructParserResourceBridge(request_id_); |
| +} |
| + |
| void IPCResourceLoaderBridge::SyncLoad(SyncLoadResponse* response) { |
| if (request_id_ != -1) { |
| NOTREACHED() << "Starting a request twice"; |
| @@ -622,6 +635,30 @@ void ResourceDispatcher::DidChangePriority( |
| request_id, new_priority)); |
| } |
| +blink::WebParserResourceBridge* |
| +ResourceDispatcher::ConstructParserResourceBridge(int request_id) { |
| + PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
| + DCHECK(request_info != NULL); |
|
jam
2013/12/17 00:44:40
nit: this dcheck isn't necessary. in release build
oystein (OOO til 10th of July)
2013/12/17 01:07:27
Done.
|
| + |
| + base::SharedMemoryHandle shm_handle; |
| + if (request_info->buffer != NULL) { |
|
jam
2013/12/17 00:44:40
nit: "!= NULL" is redundant, convention is to skip
oystein (OOO til 10th of July)
2013/12/17 01:07:27
I fixed the possible ones, but for the request_inf
|
| + bool handle_ok = request_info->buffer->ShareToProcess( |
| + base::GetCurrentProcessHandle(), &shm_handle); |
| + DCHECK(handle_ok); |
| + } |
| + |
| + return new WebParserResourceBridgeImpl(request_id, weak_factory_.GetWeakPtr(), |
| + shm_handle, request_info->buffer_size); |
| +} |
| + |
| +void ResourceDispatcher::OnParserResourceMessageFilterAdded(int request_id) { |
| + PendingRequestInfo* request_info = GetPendingRequestInfo(request_id); |
| + if (request_info == NULL) |
| + return; // We can safely ignore completed requests here. |
| + |
| + request_info->peer->OnParserResourceMessageFilterAdded(); |
| +} |
| + |
| ResourceDispatcher::PendingRequestInfo::PendingRequestInfo() |
| : peer(NULL), |
| resource_type(ResourceType::SUB_RESOURCE), |