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_
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"
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.
32 #pragma warning(disable: 4250)
35 // This class represents the background thread where the utility task runs.
36 class UtilityThreadImpl
: public UtilityThread
,
37 public ChildThreadImpl
{
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
;
50 // ChildThread implementation.
51 bool OnControlMessageReceived(const IPC::Message
& msg
) override
;
53 // IPC message handlers.
54 void OnBatchModeStarted();
55 void OnBatchModeFinished();
57 #if defined(OS_POSIX) && defined(ENABLE_PLUGINS)
58 void OnLoadPlugins(const std::vector
<base::FilePath
>& plugin_paths
);
61 void BindProcessControlRequest(
62 mojo::InterfaceRequest
<content::ProcessControl
> request
);
64 // True when we're running in batch mode.
67 scoped_ptr
<UtilityBlinkPlatformImpl
> blink_platform_impl_
;
69 // Process control for Mojo application hosting.
70 scoped_ptr
<UtilityProcessControlImpl
> process_control_
;
72 // Bindings to the ProcessControl impl.
73 mojo::WeakBindingSet
<ProcessControl
> process_control_bindings_
;
75 DISALLOW_COPY_AND_ASSIGN(UtilityThreadImpl
);
78 #if defined(COMPILER_MSVC)
82 } // namespace content
84 #endif // CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_