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
;
46 void EnsureBlinkInitialized() override
;
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
);
62 void BindProcessControlRequest(
63 mojo::InterfaceRequest
<content::ProcessControl
> request
);
65 // True when we're running in 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)
83 } // namespace content
85 #endif // CONTENT_UTILITY_UTILITY_THREAD_IMPL_H_