| 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_impl.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 BlinkPlatformImpl; | 22 class BlinkPlatformImpl; |
| 23 | 23 |
| 24 #if defined(COMPILER_MSVC) |
| 25 // See explanation for other RenderViewHostImpl which is the same issue. |
| 26 #pragma warning(push) |
| 27 #pragma warning(disable: 4250) |
| 28 #endif |
| 29 |
| 24 // This class represents the background thread where the utility task runs. | 30 // This class represents the background thread where the utility task runs. |
| 25 class UtilityThreadImpl : public UtilityThread, | 31 class UtilityThreadImpl : public UtilityThread, |
| 26 public ChildThread { | 32 public ChildThreadImpl { |
| 27 public: | 33 public: |
| 28 UtilityThreadImpl(); | 34 UtilityThreadImpl(); |
| 29 // Constructor that's used when running in single process mode. | 35 // Constructor that's used when running in single process mode. |
| 30 explicit UtilityThreadImpl(const std::string& channel_name); | 36 explicit UtilityThreadImpl(const std::string& channel_name); |
| 31 ~UtilityThreadImpl() override; | 37 ~UtilityThreadImpl() override; |
| 32 void Shutdown() override; | 38 void Shutdown() override; |
| 33 | 39 |
| 34 bool Send(IPC::Message* msg) override; | |
| 35 void ReleaseProcessIfNeeded() override; | 40 void ReleaseProcessIfNeeded() override; |
| 36 #if defined(OS_WIN) | |
| 37 virtual void PreCacheFont(const LOGFONT& log_font) override; | |
| 38 virtual void ReleaseCachedFonts() override; | |
| 39 #endif | |
| 40 | 41 |
| 41 private: | 42 private: |
| 42 void Init(); | 43 void Init(); |
| 43 | 44 |
| 44 // ChildThread implementation. | 45 // ChildThread implementation. |
| 45 bool OnControlMessageReceived(const IPC::Message& msg) override; | 46 bool OnControlMessageReceived(const IPC::Message& msg) override; |
| 46 | 47 |
| 47 // IPC message handlers. | 48 // IPC message handlers. |
| 48 void OnBatchModeStarted(); | 49 void OnBatchModeStarted(); |
| 49 void OnBatchModeFinished(); | 50 void OnBatchModeFinished(); |
| 50 | 51 |
| 51 #if defined(OS_POSIX) && defined(ENABLE_PLUGINS) | 52 #if defined(OS_POSIX) && defined(ENABLE_PLUGINS) |
| 52 void OnLoadPlugins(const std::vector<base::FilePath>& plugin_paths); | 53 void OnLoadPlugins(const std::vector<base::FilePath>& plugin_paths); |
| 53 #endif | 54 #endif |
| 54 | 55 |
| 55 // True when we're running in batch mode. | 56 // True when we're running in batch mode. |
| 56 bool batch_mode_; | 57 bool batch_mode_; |
| 57 | 58 |
| 58 // True if running in single process mode. | 59 // True if running in single process mode. |
| 59 bool single_process_; | 60 bool single_process_; |
| 60 | 61 |
| 61 scoped_ptr<BlinkPlatformImpl> blink_platform_impl_; | 62 scoped_ptr<BlinkPlatformImpl> blink_platform_impl_; |
| 62 | 63 |
| 63 DISALLOW_COPY_AND_ASSIGN(UtilityThreadImpl); | 64 DISALLOW_COPY_AND_ASSIGN(UtilityThreadImpl); |
| 64 }; | 65 }; |
| 65 | 66 |
| 67 #if defined(COMPILER_MSVC) |
| 68 #pragma warning(pop) |
| 69 #endif |
| 70 |
| 66 } // namespace content | 71 } // namespace content |
| 67 | 72 |
| 68 #endif // CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_ | 73 #endif // CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_ |
| OLD | NEW |