Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1402)

Unified Diff: content/child/resource_dispatcher.cc

Issue 109283006: Redirect HTML resource bytes directly to parser thread (Chrome side CL) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
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),

Powered by Google App Engine
This is Rietveld 408576698