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

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

Issue 2804843005: Implement the infrastructure of creating WorkerFetchContext in worker global scope. (Closed)
Patch Set: s/WebScheduler.h/web_scheduler.h/ Created 3 years, 8 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 <stdint.h> 10 #include <stdint.h>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 class URLLoaderFactory; 53 class URLLoaderFactory;
54 } // namespace mojom 54 } // namespace mojom
55 55
56 // This class serves as a communication interface to the ResourceDispatcherHost 56 // This class serves as a communication interface to the ResourceDispatcherHost
57 // in the browser process. It can be used from any child process. 57 // in the browser process. It can be used from any child process.
58 // Virtual methods are for tests. 58 // Virtual methods are for tests.
59 class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener { 59 class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
60 public: 60 public:
61 ResourceDispatcher( 61 ResourceDispatcher(
62 IPC::Sender* sender, 62 IPC::Sender* sender,
63 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner); 63 scoped_refptr<base::SingleThreadTaskRunner> thread_task_runner);
64 ~ResourceDispatcher() override; 64 ~ResourceDispatcher() override;
65 65
66 // IPC::Listener implementation. 66 // IPC::Listener implementation.
67 bool OnMessageReceived(const IPC::Message& message) override; 67 bool OnMessageReceived(const IPC::Message& message) override;
68 68
69 // Call this method to load the resource synchronously (i.e., in one shot). 69 // Call this method to load the resource synchronously (i.e., in one shot).
70 // This is an alternative to the StartAsync method. Be warned that this method 70 // This is an alternative to the StartAsync method. Be warned that this method
71 // will block the calling thread until the resource is fully downloaded or an 71 // will block the calling thread until the resource is fully downloaded or an
72 // error occurs. It could block the calling thread for a long time, so only 72 // error occurs. It could block the calling thread for a long time, so only
73 // use this if you really need it! There is also no way for the caller to 73 // use this if you really need it! There is also no way for the caller to
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // delegate have a longer lifetime than the ResourceDispatcher. 128 // delegate have a longer lifetime than the ResourceDispatcher.
129 void set_delegate(ResourceDispatcherDelegate* delegate) { 129 void set_delegate(ResourceDispatcherDelegate* delegate) {
130 delegate_ = delegate; 130 delegate_ = delegate;
131 } 131 }
132 132
133 // Remembers IO thread timestamp for next resource message. 133 // Remembers IO thread timestamp for next resource message.
134 void set_io_timestamp(base::TimeTicks io_timestamp) { 134 void set_io_timestamp(base::TimeTicks io_timestamp) {
135 io_timestamp_ = io_timestamp; 135 io_timestamp_ = io_timestamp;
136 } 136 }
137 137
138 void SetMainThreadTaskRunner( 138 void SetThreadTaskRunner(
139 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) { 139 scoped_refptr<base::SingleThreadTaskRunner> thread_task_runner) {
140 main_thread_task_runner_ = main_thread_task_runner; 140 thread_task_runner_ = thread_task_runner;
141 } 141 }
142 142
143 void SetResourceSchedulingFilter( 143 void SetResourceSchedulingFilter(
144 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter); 144 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter);
145 145
146 base::WeakPtr<ResourceDispatcher> GetWeakPtr() { 146 base::WeakPtr<ResourceDispatcher> GetWeakPtr() {
147 return weak_factory_.GetWeakPtr(); 147 return weak_factory_.GetWeakPtr();
148 } 148 }
149 149
150 void OnTransferSizeUpdated(int request_id, int32_t transfer_size_diff); 150 void OnTransferSizeUpdated(int request_id, int32_t transfer_size_diff);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 IPC::Sender* message_sender_; 264 IPC::Sender* message_sender_;
265 265
266 // All pending requests issued to the host 266 // All pending requests issued to the host
267 PendingRequestMap pending_requests_; 267 PendingRequestMap pending_requests_;
268 268
269 ResourceDispatcherDelegate* delegate_; 269 ResourceDispatcherDelegate* delegate_;
270 270
271 // IO thread timestamp for ongoing IPC message. 271 // IO thread timestamp for ongoing IPC message.
272 base::TimeTicks io_timestamp_; 272 base::TimeTicks io_timestamp_;
273 273
274 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 274 scoped_refptr<base::SingleThreadTaskRunner> thread_task_runner_;
275 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_; 275 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_;
276 276
277 base::WeakPtrFactory<ResourceDispatcher> weak_factory_; 277 base::WeakPtrFactory<ResourceDispatcher> weak_factory_;
278 278
279 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher); 279 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher);
280 }; 280 };
281 281
282 } // namespace content 282 } // namespace content
283 283
284 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_ 284 #endif // CONTENT_CHILD_RESOURCE_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_provider_host.cc ('k') | content/child/resource_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698