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

Unified 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: Move GetTaskRunner back to the RenderThread. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/child/child_thread_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/child_thread_impl.h
diff --git a/content/child/child_thread_impl.h b/content/child/child_thread_impl.h
index 03727d6b0477ef8fc529230e2c763b9d5e0a01b9..87a8e6ba8971dd1691c566ee93b1ee36af305b97 100644
--- a/content/child/child_thread_impl.h
+++ b/content/child/child_thread_impl.h
@@ -81,6 +81,12 @@ class CONTENT_EXPORT ChildThreadImpl
bool Send(IPC::Message* msg) override;
// ChildThread implementation:
+ // Returns the task runner which should be used to post tasks to run on this
+ // child thread. Note that this may be different from the underlying message
+ // loop returned by message_loop(). For this reason, only use message_loop()
+ // if you need to directly manipulate the underlying message loop, e.g., by
+ // adding a task listener instead of just posting tasks for execution.
+ virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner();
#if defined(OS_WIN)
void PreCacheFont(const LOGFONT& log_font) override;
void ReleaseCachedFonts() override;
@@ -166,6 +172,7 @@ class CONTENT_EXPORT ChildThreadImpl
return resource_message_filter_.get();
}
+ // See note in GetTaskRunner().
base::MessageLoop* message_loop() const { return message_loop_; }
// Returns the one child thread. Can only be called on the main thread.
@@ -263,6 +270,7 @@ class CONTENT_EXPORT ChildThreadImpl
bool on_channel_error_called_;
base::MessageLoop* message_loop_;
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
scoped_ptr<FileSystemDispatcher> file_system_dispatcher_;
@@ -314,6 +322,7 @@ struct ChildThreadImpl::Options {
bool use_mojo_channel;
bool in_browser_process;
std::vector<IPC::MessageFilter*> startup_filters;
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner;
private:
Options();
@@ -327,6 +336,8 @@ class ChildThreadImpl::Options::Builder {
Builder& UseMojoChannel(bool use_mojo_channel);
Builder& WithChannelName(const std::string& channel_name);
Builder& AddStartupFilter(IPC::MessageFilter* filter);
+ Builder& WithTaskRunner(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner);
Options Build();
« no previous file with comments | « no previous file | content/child/child_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698