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

Side by Side Diff: content/public/child/child_thread.h

Issue 977573002: content: Add an overridable task runner to ChildThreadImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Work around MSVC bug. 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_PUBLIC_CHILD_CHILD_THREAD_H_ 5 #ifndef CONTENT_PUBLIC_CHILD_CHILD_THREAD_H_
6 #define CONTENT_PUBLIC_CHILD_CHILD_THREAD_H_ 6 #define CONTENT_PUBLIC_CHILD_CHILD_THREAD_H_
7 7
8 #include "base/memory/ref_counted.h"
8 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
9 #include "ipc/ipc_sender.h" 10 #include "ipc/ipc_sender.h"
10 11
11 #if defined(OS_WIN) 12 #if defined(OS_WIN)
12 #include <windows.h> 13 #include <windows.h>
13 #endif 14 #endif
14 15
16 namespace base {
17 class SingleThreadTaskRunner;
18 }
19
15 namespace content { 20 namespace content {
16 21
17 class CONTENT_EXPORT ChildThread : public IPC::Sender { 22 class CONTENT_EXPORT ChildThread : public IPC::Sender {
18 public: 23 public:
19 // Returns the one child thread for this process. Note that this can only be 24 // Returns the one child thread for this process. Note that this can only be
20 // accessed when running on the child thread itself. 25 // accessed when running on the child thread itself.
21 static ChildThread* Get(); 26 static ChildThread* Get();
22 27
23 ~ChildThread() override {} 28 ~ChildThread() override {}
24 29
30 // Returns the task runner which should be used to post tasks to be executed
31 // on this child thread. Note that this may be different from the underlying
32 // message loop for this thread, and should therefore be used instead of
33 // going to the message loop directly.
jabdelmalek 2015/03/06 18:06:13 this seems like quite a large change, as there are
Sami 2015/03/06 18:41:46 Yes, it's unfortunate that a lot of code is hard c
Ryan Sleevi 2015/03/06 19:00:31 Then you really should have been having this desig
34 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() = 0;
jabdelmalek 2015/03/06 18:06:13 why is this in the public interface, if only conte
Sami 2015/03/06 18:41:46 Good point, I've now moved GetTaskRunner() back to
35
25 #if defined(OS_WIN) 36 #if defined(OS_WIN)
26 // Request that the given font be loaded by the browser so it's cached by the 37 // Request that the given font be loaded by the browser so it's cached by the
27 // OS. Please see ChildProcessHost::PreCacheFont for details. 38 // OS. Please see ChildProcessHost::PreCacheFont for details.
28 virtual void PreCacheFont(const LOGFONT& log_font) = 0; 39 virtual void PreCacheFont(const LOGFONT& log_font) = 0;
29 40
30 // Release cached font. 41 // Release cached font.
31 virtual void ReleaseCachedFonts() = 0; 42 virtual void ReleaseCachedFonts() = 0;
32 #endif 43 #endif
33 }; 44 };
34 45
35 } // namespace content 46 } // namespace content
36 47
37 #endif // CONTENT_PUBLIC_CHILD_CHILD_THREAD_H_ 48 #endif // CONTENT_PUBLIC_CHILD_CHILD_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698