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

Side by Side Diff: content/child/resource_dispatcher.h

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 6 years, 9 months 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 unified diff | Download patch
OLDNEW
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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #ifndef CONTENT_CHILD_RESOURCE_DISPATCHER_H_ 7 #ifndef CONTENT_CHILD_RESOURCE_DISPATCHER_H_
8 #define CONTENT_CHILD_RESOURCE_DISPATCHER_H_ 8 #define CONTENT_CHILD_RESOURCE_DISPATCHER_H_
9 9
10 #include <deque> 10 #include <deque>
11 #include <string> 11 #include <string>
12 12
13 #include "base/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
14 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
15 #include "base/memory/shared_memory.h" 15 #include "base/memory/shared_memory.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
19 #include "ipc/ipc_listener.h" 19 #include "ipc/ipc_listener.h"
20 #include "ipc/ipc_sender.h" 20 #include "ipc/ipc_sender.h"
21 #include "webkit/child/resource_loader_bridge.h" 21 #include "webkit/child/resource_loader_bridge.h"
22 22
23 struct ResourceMsg_RequestCompleteData; 23 struct ResourceMsg_RequestCompleteData;
24 24
25 namespace content { 25 namespace content {
26 class ResourceDispatcherDelegate; 26 class ResourceDispatcherDelegate;
27 struct ResourceResponseHead; 27 struct ResourceResponseHead;
28 struct SiteIsolationResponseMetaData; 28 struct SiteIsolationResponseMetaData;
29 class ThreadedDataProvider;
darin (slow to review) 2014/03/31 17:00:01 nit: "class" before "struct"
29 30
30 // This class serves as a communication interface between the 31 // This class serves as a communication interface between the
31 // ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in 32 // ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in
32 // the child process. It can be used from any child process. 33 // the child process. It can be used from any child process.
33 class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener { 34 class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
34 public: 35 public:
35 explicit ResourceDispatcher(IPC::Sender* sender); 36 explicit ResourceDispatcher(IPC::Sender* sender);
36 virtual ~ResourceDispatcher(); 37 virtual ~ResourceDispatcher();
37 38
38 // IPC::Listener implementation. 39 // IPC::Listener implementation.
(...skipping 24 matching lines...) Expand all
63 return message_sender_; 64 return message_sender_;
64 } 65 }
65 66
66 // Toggles the is_deferred attribute for the specified request. 67 // Toggles the is_deferred attribute for the specified request.
67 void SetDefersLoading(int request_id, bool value); 68 void SetDefersLoading(int request_id, bool value);
68 69
69 // Indicates the priority of the specified request changed. 70 // Indicates the priority of the specified request changed.
70 void DidChangePriority(int routing_id, int request_id, 71 void DidChangePriority(int routing_id, int request_id,
71 net::RequestPriority new_priority); 72 net::RequestPriority new_priority);
72 73
74 // The provided data receiver will receive incoming resource data rather
75 // than the resource bridge.
76 bool AttachThreadedDataReceiver(
77 int request_id, blink::WebThreadedDataReceiver* threaded_data_receiver);
78
73 // This does not take ownership of the delegate. It is expected that the 79 // This does not take ownership of the delegate. It is expected that the
74 // delegate have a longer lifetime than the ResourceDispatcher. 80 // delegate have a longer lifetime than the ResourceDispatcher.
75 void set_delegate(ResourceDispatcherDelegate* delegate) { 81 void set_delegate(ResourceDispatcherDelegate* delegate) {
76 delegate_ = delegate; 82 delegate_ = delegate;
77 } 83 }
78 84
79 // Remembers IO thread timestamp for next resource message. 85 // Remembers IO thread timestamp for next resource message.
80 void set_io_timestamp(base::TimeTicks io_timestamp) { 86 void set_io_timestamp(base::TimeTicks io_timestamp) {
81 io_timestamp_ = io_timestamp; 87 io_timestamp_ = io_timestamp;
82 } 88 }
83 89
84 private: 90 private:
85 friend class ResourceDispatcherTest; 91 friend class ResourceDispatcherTest;
86 92
87 typedef std::deque<IPC::Message*> MessageQueue; 93 typedef std::deque<IPC::Message*> MessageQueue;
88 struct PendingRequestInfo { 94 struct PendingRequestInfo {
89 PendingRequestInfo(); 95 PendingRequestInfo();
90 96
91 PendingRequestInfo(webkit_glue::ResourceLoaderBridge::Peer* peer, 97 PendingRequestInfo(webkit_glue::ResourceLoaderBridge::Peer* peer,
92 ResourceType::Type resource_type, 98 ResourceType::Type resource_type,
93 int origin_pid, 99 int origin_pid,
94 const GURL& frame_origin, 100 const GURL& frame_origin,
95 const GURL& request_url); 101 const GURL& request_url);
96 102
97 ~PendingRequestInfo(); 103 ~PendingRequestInfo();
98 104
99 webkit_glue::ResourceLoaderBridge::Peer* peer; 105 webkit_glue::ResourceLoaderBridge::Peer* peer;
106 ThreadedDataProvider* threaded_data_provider;
100 ResourceType::Type resource_type; 107 ResourceType::Type resource_type;
101 // The PID of the original process which issued this request. This gets 108 // The PID of the original process which issued this request. This gets
102 // non-zero only for a request proxied by another renderer, particularly 109 // non-zero only for a request proxied by another renderer, particularly
103 // requests from plugins. 110 // requests from plugins.
104 int origin_pid; 111 int origin_pid;
105 MessageQueue deferred_message_queue; 112 MessageQueue deferred_message_queue;
106 bool is_deferred; 113 bool is_deferred;
107 // Original requested url. 114 // Original requested url.
108 GURL url; 115 GURL url;
109 // The security origin of the frame that initiates this request. 116 // The security origin of the frame that initiates this request.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 210
204 // IO thread timestamp for ongoing IPC message. 211 // IO thread timestamp for ongoing IPC message.
205 base::TimeTicks io_timestamp_; 212 base::TimeTicks io_timestamp_;
206 213
207 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); 214 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher);
208 }; 215 };
209 216
210 } // namespace content 217 } // namespace content
211 218
212 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ 219 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_
OLDNEW
« no previous file with comments | « no previous file | content/child/resource_dispatcher.cc » ('j') | content/child/resource_dispatcher.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698