Arena pool macros don't want to die.
[mozilla-central.git] / dom / ipc / ContentProcessParent.h
blobfc37eca6217e54c52dd654c98c6cb11ad975091c
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* vim: set sw=4 ts=8 et tw=80 : */
3 /* ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
16 * The Original Code is Mozilla Content App.
18 * The Initial Developer of the Original Code is
19 * The Mozilla Foundation.
20 * Portions created by the Initial Developer are Copyright (C) 2009
21 * the Initial Developer. All Rights Reserved.
23 * Contributor(s):
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #ifndef mozilla_dom_ContentProcessParent_h
40 #define mozilla_dom_ContentProcessParent_h
42 #include "base/waitable_event_watcher.h"
44 #include "mozilla/dom/PContentProcessParent.h"
45 #include "mozilla/ipc/GeckoChildProcessHost.h"
47 #include "nsIObserver.h"
48 #include "nsIThreadInternal.h"
49 #include "mozilla/Monitor.h"
50 #include "nsIPrefService.h"
52 namespace mozilla {
54 namespace ipc {
55 class TestShellParent;
58 namespace dom {
60 class TabParent;
62 class ContentProcessParent : public PContentProcessParent
63 , public nsIObserver
64 , public nsIThreadObserver
66 private:
67 typedef mozilla::ipc::GeckoChildProcessHost GeckoChildProcessHost;
68 typedef mozilla::ipc::TestShellParent TestShellParent;
70 public:
71 static ContentProcessParent* GetSingleton(PRBool aForceNew = PR_TRUE);
73 #if 0
74 // TODO: implement this somewhere!
75 static ContentProcessParent* FreeSingleton();
76 #endif
78 NS_DECL_ISUPPORTS
79 NS_DECL_NSIOBSERVER
80 NS_DECL_NSITHREADOBSERVER
82 TabParent* CreateTab();
84 TestShellParent* CreateTestShell();
85 bool DestroyTestShell(TestShellParent* aTestShell);
87 void ReportChildAlreadyBlocked();
88 bool RequestRunToCompletion();
90 bool IsAlive();
92 protected:
93 virtual void ActorDestroy(ActorDestroyReason why);
95 private:
96 static ContentProcessParent* gSingleton;
98 // Hide the raw constructor methods since we don't want client code
99 // using them.
100 using PContentProcessParent::SendPIFrameEmbeddingConstructor;
101 using PContentProcessParent::SendPTestShellConstructor;
103 ContentProcessParent();
104 virtual ~ContentProcessParent();
106 virtual PIFrameEmbeddingParent* AllocPIFrameEmbedding();
107 virtual bool DeallocPIFrameEmbedding(PIFrameEmbeddingParent* frame);
109 virtual PTestShellParent* AllocPTestShell();
110 virtual bool DeallocPTestShell(PTestShellParent* shell);
112 virtual PNeckoParent* AllocPNecko();
113 virtual bool DeallocPNecko(PNeckoParent* necko);
115 virtual bool RecvGetPrefType(const nsCString& prefName,
116 PRInt32* retValue, nsresult* rv);
118 virtual bool RecvGetBoolPref(const nsCString& prefName,
119 PRBool* retValue, nsresult* rv);
121 virtual bool RecvGetIntPref(const nsCString& prefName,
122 PRInt32* retValue, nsresult* rv);
124 virtual bool RecvGetCharPref(const nsCString& prefName,
125 nsCString* retValue, nsresult* rv);
127 virtual bool RecvGetPrefLocalizedString(const nsCString& prefName,
128 nsString* retValue, nsresult* rv);
130 virtual bool RecvPrefHasUserValue(const nsCString& prefName,
131 PRBool* retValue, nsresult* rv);
133 virtual bool RecvPrefIsLocked(const nsCString& prefName,
134 PRBool* retValue, nsresult* rv);
136 virtual bool RecvGetChildList(const nsCString& domain,
137 nsTArray<nsCString>* list, nsresult* rv);
139 void EnsurePrefService();
141 mozilla::Monitor mMonitor;
143 GeckoChildProcessHost* mSubprocess;
145 int mRunToCompletionDepth;
146 bool mShouldCallUnblockChild;
147 nsCOMPtr<nsIThreadObserver> mOldObserver;
149 bool mIsAlive;
150 nsCOMPtr<nsIPrefBranch> mPrefService;
153 } // namespace dom
154 } // namespace mozilla
156 #endif