Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / content / utility / utility_thread_impl.h
blob9394a449b04f79c5ec7c0b83e42cd4b8cb86cc17
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 "base/memory/scoped_ptr.h"
14 #include "content/child/child_thread_impl.h"
15 #include "content/common/content_export.h"
16 #include "content/common/process_control.mojom.h"
17 #include "content/public/utility/utility_thread.h"
18 #include "mojo/common/weak_binding_set.h"
20 namespace base {
21 class FilePath;
24 namespace content {
25 class BlinkPlatformImpl;
26 class UtilityBlinkPlatformImpl;
27 class UtilityProcessControlImpl;
29 #if defined(COMPILER_MSVC)
30 // See explanation for other RenderViewHostImpl which is the same issue.
31 #pragma warning(push)
32 #pragma warning(disable: 4250)
33 #endif
35 // This class represents the background thread where the utility task runs.
36 class UtilityThreadImpl : public UtilityThread,
37 public ChildThreadImpl {
38 public:
39 UtilityThreadImpl();
40 // Constructor that's used when running in single process mode.
41 explicit UtilityThreadImpl(const InProcessChildThreadParams& params);
42 ~UtilityThreadImpl() override;
43 void Shutdown() override;
45 void ReleaseProcessIfNeeded() override;
46 void EnsureBlinkInitialized() override;
48 private:
49 void Init();
51 // ChildThread implementation.
52 bool OnControlMessageReceived(const IPC::Message& msg) override;
54 // IPC message handlers.
55 void OnBatchModeStarted();
56 void OnBatchModeFinished();
58 #if defined(OS_POSIX) && defined(ENABLE_PLUGINS)
59 void OnLoadPlugins(const std::vector<base::FilePath>& plugin_paths);
60 #endif
62 void BindProcessControlRequest(
63 mojo::InterfaceRequest<content::ProcessControl> request);
65 // True when we're running in batch mode.
66 bool batch_mode_;
68 scoped_ptr<UtilityBlinkPlatformImpl> blink_platform_impl_;
70 // Process control for Mojo application hosting.
71 scoped_ptr<UtilityProcessControlImpl> process_control_;
73 // Bindings to the ProcessControl impl.
74 mojo::WeakBindingSet<ProcessControl> process_control_bindings_;
76 DISALLOW_COPY_AND_ASSIGN(UtilityThreadImpl);
79 #if defined(COMPILER_MSVC)
80 #pragma warning(pop)
81 #endif
83 } // namespace content
85 #endif // CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_