Attempt to fix flaky PlatformAppBrowserTest.Messaging.
[chromium-blink-merge.git] / content / utility / utility_thread_impl.h
blobb4b50379a09b500ab403bfb6c081340788c75701
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_
6 #define CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "content/child/child_thread.h"
14 #include "content/common/content_export.h"
15 #include "content/public/utility/utility_thread.h"
17 namespace base {
18 class FilePath;
21 namespace content {
22 class BlinkPlatformImpl;
24 // This class represents the background thread where the utility task runs.
25 class UtilityThreadImpl : public UtilityThread,
26 public ChildThread {
27 public:
28 UtilityThreadImpl();
29 // Constructor that's used when running in single process mode.
30 explicit UtilityThreadImpl(const std::string& channel_name);
31 virtual ~UtilityThreadImpl();
32 virtual void Shutdown() OVERRIDE;
34 virtual bool Send(IPC::Message* msg) OVERRIDE;
35 virtual void ReleaseProcessIfNeeded() OVERRIDE;
36 #if defined(OS_WIN)
37 virtual void PreCacheFont(const LOGFONT& log_font) OVERRIDE;
38 virtual void ReleaseCachedFonts() OVERRIDE;
39 #endif
41 private:
42 void Init();
44 // ChildThread implementation.
45 virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE;
47 // IPC message handlers.
48 void OnBatchModeStarted();
49 void OnBatchModeFinished();
51 #if defined(OS_POSIX)
52 void OnLoadPlugins(const std::vector<base::FilePath>& plugin_paths);
53 #endif // OS_POSIX
55 // True when we're running in batch mode.
56 bool batch_mode_;
58 // True if running in single process mode.
59 bool single_process_;
61 scoped_ptr<BlinkPlatformImpl> webkit_platform_support_;
63 DISALLOW_COPY_AND_ASSIGN(UtilityThreadImpl);
66 } // namespace content
68 #endif // CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_