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

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

Issue 977573002: content: Add an overridable task runner to ChildThreadImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 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
« no previous file with comments | « no previous file | content/child/child_thread_impl.cc » ('j') | content/public/child/child_thread.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CONTENT_CHILD_CHILD_THREAD_IMPL_H_ 5 #ifndef CONTENT_CHILD_CHILD_THREAD_IMPL_H_
6 #define CONTENT_CHILD_CHILD_THREAD_IMPL_H_ 6 #define CONTENT_CHILD_CHILD_THREAD_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // must be terminated before Shutdown returns. In particular, if a subsystem 73 // must be terminated before Shutdown returns. In particular, if a subsystem
74 // has a thread that post tasks to ChildProcess::main_thread(), that thread 74 // has a thread that post tasks to ChildProcess::main_thread(), that thread
75 // should be joined in Shutdown(). 75 // should be joined in Shutdown().
76 ~ChildThreadImpl() override; 76 ~ChildThreadImpl() override;
77 virtual void Shutdown(); 77 virtual void Shutdown();
78 78
79 // IPC::Sender implementation: 79 // IPC::Sender implementation:
80 bool Send(IPC::Message* msg) override; 80 bool Send(IPC::Message* msg) override;
81 81
82 // ChildThread implementation: 82 // ChildThread implementation:
83 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override;
no sievers 2015/03/04 19:15:02 Is there a way (at least longer term) how we could
Sami 2015/03/04 19:39:28 I agree that it's a mess :( To add on top of the t
83 #if defined(OS_WIN) 84 #if defined(OS_WIN)
84 void PreCacheFont(const LOGFONT& log_font) override; 85 void PreCacheFont(const LOGFONT& log_font) override;
85 void ReleaseCachedFonts() override; 86 void ReleaseCachedFonts() override;
86 #endif 87 #endif
87 88
88 IPC::SyncChannel* channel() { return channel_.get(); } 89 IPC::SyncChannel* channel() { return channel_.get(); }
89 90
90 MessageRouter* GetRouter(); 91 MessageRouter* GetRouter();
91 92
92 // Allocates a block of shared memory of the given size. Returns NULL on 93 // Allocates a block of shared memory of the given size. Returns NULL on
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 // Handles resource loads for this process. 247 // Handles resource loads for this process.
247 scoped_ptr<ResourceDispatcher> resource_dispatcher_; 248 scoped_ptr<ResourceDispatcher> resource_dispatcher_;
248 249
249 scoped_ptr<WebSocketDispatcher> websocket_dispatcher_; 250 scoped_ptr<WebSocketDispatcher> websocket_dispatcher_;
250 251
251 // The OnChannelError() callback was invoked - the channel is dead, don't 252 // The OnChannelError() callback was invoked - the channel is dead, don't
252 // attempt to communicate. 253 // attempt to communicate.
253 bool on_channel_error_called_; 254 bool on_channel_error_called_;
254 255
255 base::MessageLoop* message_loop_; 256 base::MessageLoop* message_loop_;
257 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
256 258
257 scoped_ptr<FileSystemDispatcher> file_system_dispatcher_; 259 scoped_ptr<FileSystemDispatcher> file_system_dispatcher_;
258 260
259 scoped_ptr<QuotaDispatcher> quota_dispatcher_; 261 scoped_ptr<QuotaDispatcher> quota_dispatcher_;
260 262
261 scoped_refptr<ChildHistogramMessageFilter> histogram_message_filter_; 263 scoped_refptr<ChildHistogramMessageFilter> histogram_message_filter_;
262 264
263 scoped_refptr<ChildResourceMessageFilter> resource_message_filter_; 265 scoped_refptr<ChildResourceMessageFilter> resource_message_filter_;
264 266
265 scoped_refptr<ServiceWorkerMessageFilter> service_worker_message_filter_; 267 scoped_refptr<ServiceWorkerMessageFilter> service_worker_message_filter_;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 299
298 struct ChildThreadImpl::Options { 300 struct ChildThreadImpl::Options {
299 ~Options(); 301 ~Options();
300 302
301 class Builder; 303 class Builder;
302 304
303 std::string channel_name; 305 std::string channel_name;
304 bool use_mojo_channel; 306 bool use_mojo_channel;
305 bool in_browser_process; 307 bool in_browser_process;
306 std::vector<IPC::MessageFilter*> startup_filters; 308 std::vector<IPC::MessageFilter*> startup_filters;
309 scoped_refptr<base::SingleThreadTaskRunner> task_runner;
307 310
308 private: 311 private:
309 Options(); 312 Options();
310 }; 313 };
311 314
312 class ChildThreadImpl::Options::Builder { 315 class ChildThreadImpl::Options::Builder {
313 public: 316 public:
314 Builder(); 317 Builder();
315 318
316 Builder& InBrowserProcess(bool in_browser_process); 319 Builder& InBrowserProcess(bool in_browser_process);
317 Builder& UseMojoChannel(bool use_mojo_channel); 320 Builder& UseMojoChannel(bool use_mojo_channel);
318 Builder& WithChannelName(const std::string& channel_name); 321 Builder& WithChannelName(const std::string& channel_name);
319 Builder& AddStartupFilter(IPC::MessageFilter* filter); 322 Builder& AddStartupFilter(IPC::MessageFilter* filter);
323 Builder& WithTaskRunner(
324 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
320 325
321 Options Build(); 326 Options Build();
322 327
323 private: 328 private:
324 struct Options options_; 329 struct Options options_;
325 }; 330 };
326 331
327 } // namespace content 332 } // namespace content
328 333
329 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ 334 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/child/child_thread_impl.cc » ('j') | content/public/child/child_thread.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698