Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 : * vim: sw=4 ts=4 et :
3 : * This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef GMPProcessParent_h
8 : #define GMPProcessParent_h 1
9 :
10 : #include "mozilla/Attributes.h"
11 : #include "base/basictypes.h"
12 : #include "base/file_path.h"
13 : #include "base/thread.h"
14 : #include "chrome/common/child_process_host.h"
15 : #include "mozilla/ipc/GeckoChildProcessHost.h"
16 :
17 : class nsIRunnable;
18 :
19 : namespace mozilla {
20 : namespace gmp {
21 :
22 : class GMPProcessParent final : public mozilla::ipc::GeckoChildProcessHost
23 : {
24 : public:
25 : explicit GMPProcessParent(const std::string& aGMPPath);
26 : ~GMPProcessParent();
27 :
28 : // Synchronously launch the plugin process. If the process fails to launch
29 : // after timeoutMs, this method will return false.
30 : bool Launch(int32_t aTimeoutMs);
31 :
32 : void Delete(nsCOMPtr<nsIRunnable> aCallback = nullptr);
33 :
34 0 : bool CanShutdown() override { return true; }
35 : const std::string& GetPluginFilePath() { return mGMPPath; }
36 :
37 : using mozilla::ipc::GeckoChildProcessHost::GetChannel;
38 : using mozilla::ipc::GeckoChildProcessHost::GetChildProcessHandle;
39 :
40 : private:
41 : void DoDelete();
42 :
43 : std::string mGMPPath;
44 : nsCOMPtr<nsIRunnable> mDeletedCallback;
45 :
46 : DISALLOW_COPY_AND_ASSIGN(GMPProcessParent);
47 : };
48 :
49 : } // namespace gmp
50 : } // namespace mozilla
51 :
52 : #endif // ifndef GMPProcessParent_h
|