OLD | NEW |
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_UTILITY_UTILITY_THREAD_IMPL_H_ | 5 #ifndef CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_ |
6 #define CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_ | 6 #define CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "content/child/child_thread.h" | 13 #include "content/child/child_thread.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/public/utility/utility_thread.h" | 15 #include "content/public/utility/utility_thread.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class FilePath; | 18 class FilePath; |
19 } | 19 } |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 class WebKitPlatformSupportImpl; | 22 class WebKitPlatformSupportImpl; |
23 | 23 |
24 // This class represents the background thread where the utility task runs. | 24 // This class represents the background thread where the utility task runs. |
25 class UtilityThreadImpl : public UtilityThread, | 25 class UtilityThreadImpl : public UtilityThread, |
26 public ChildThread { | 26 public ChildThread { |
27 public: | 27 public: |
28 UtilityThreadImpl(); | 28 UtilityThreadImpl(); |
| 29 // Constructor that's used when running in single process mode. |
| 30 explicit UtilityThreadImpl(const std::string& channel_name); |
29 virtual ~UtilityThreadImpl(); | 31 virtual ~UtilityThreadImpl(); |
30 virtual void Shutdown() OVERRIDE; | 32 virtual void Shutdown() OVERRIDE; |
31 | 33 |
32 virtual bool Send(IPC::Message* msg) OVERRIDE; | 34 virtual bool Send(IPC::Message* msg) OVERRIDE; |
33 virtual void ReleaseProcessIfNeeded() OVERRIDE; | 35 virtual void ReleaseProcessIfNeeded() OVERRIDE; |
34 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
35 virtual void PreCacheFont(const LOGFONT& log_font) OVERRIDE; | 37 virtual void PreCacheFont(const LOGFONT& log_font) OVERRIDE; |
36 virtual void ReleaseCachedFonts() OVERRIDE; | 38 virtual void ReleaseCachedFonts() OVERRIDE; |
37 #endif | 39 #endif |
38 | 40 |
39 private: | 41 private: |
| 42 void Init(); |
| 43 |
40 // ChildThread implementation. | 44 // ChildThread implementation. |
41 virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE; | 45 virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE; |
42 | 46 |
43 // IPC message handlers. | 47 // IPC message handlers. |
44 void OnBatchModeStarted(); | 48 void OnBatchModeStarted(); |
45 void OnBatchModeFinished(); | 49 void OnBatchModeFinished(); |
46 | 50 |
47 #if defined(OS_POSIX) | 51 #if defined(OS_POSIX) |
48 void OnLoadPlugins(const std::vector<base::FilePath>& plugin_paths); | 52 void OnLoadPlugins(const std::vector<base::FilePath>& plugin_paths); |
49 #endif // OS_POSIX | 53 #endif // OS_POSIX |
50 | 54 |
51 // True when we're running in batch mode. | 55 // True when we're running in batch mode. |
52 bool batch_mode_; | 56 bool batch_mode_; |
53 | 57 |
| 58 // True if running in single process mode. |
| 59 bool single_process_; |
| 60 |
54 scoped_ptr<WebKitPlatformSupportImpl> webkit_platform_support_; | 61 scoped_ptr<WebKitPlatformSupportImpl> webkit_platform_support_; |
55 | 62 |
56 DISALLOW_COPY_AND_ASSIGN(UtilityThreadImpl); | 63 DISALLOW_COPY_AND_ASSIGN(UtilityThreadImpl); |
57 }; | 64 }; |
58 | 65 |
59 } // namespace content | 66 } // namespace content |
60 | 67 |
61 #endif // CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_ | 68 #endif // CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_ |
OLD | NEW |