Skip to content

Commit

Permalink
Added some stub for executing embedLiteCoreInitTest
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeshkova committed Nov 25, 2014
1 parent 367d2af commit c45a192
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 10 deletions.
18 changes: 12 additions & 6 deletions embedding/embedlite/EmbedLiteApp.cpp
Expand Up @@ -139,6 +139,7 @@ EmbedLiteApp::StartChild(EmbedLiteApp* aApp)
} else if (aApp->mEmbedType == EMBED_PROCESS) {
aApp->mSubProcess = new EmbedLiteSubProcess();
aApp->mSubProcess->StartEmbedProcess();
aApp->mAppParent = aApp->mSubProcess->AppParent();
}
}

Expand Down Expand Up @@ -307,12 +308,17 @@ EmbedLiteApp::Shutdown()
NS_ASSERTION(mState == DESTROYING, "Wrong timing");

if (mIsAsyncLoop) {
if (mSubThread) {
mSubThread->Stop();
mSubThread = NULL;
} else if (mListener) {
NS_ABORT_IF_FALSE(mListener->StopChildThread(),
"StopChildThread must be implemented when ExecuteChildThread defined");
if (mEmbedType == EMBED_THREAD) {
if (mSubThread) {
mSubThread->Stop();
mSubThread = NULL;
} else if (mListener) {
NS_ABORT_IF_FALSE(mListener->StopChildThread(),
"StopChildThread must be implemented when ExecuteChildThread defined");
}
} else if (mEmbedType == EMBED_PROCESS) {
mSubProcess->StopEmbedProcess();
mSubProcess = nullptr;
}
}

Expand Down
1 change: 1 addition & 0 deletions embedding/embedlite/EmbedLiteApp.h
Expand Up @@ -168,6 +168,7 @@ class EmbedLiteApp

friend class EmbedLiteAppThreadParent;
friend class EmbedLiteViewThreadParent;
friend class EmbedLiteAppProcessParent;
friend class EmbedLiteCompositorParent;
friend class EmbedLitePuppetWidget;

Expand Down
Expand Up @@ -112,6 +112,7 @@ bool
EmbedLiteAppProcessChild::RecvPreDestroy()
{
LOGT();
SendReadyToShutdown();
return true;
}

Expand Down
Expand Up @@ -28,6 +28,7 @@ namespace mozilla {
namespace embedlite {

EmbedLiteAppProcessParent::EmbedLiteAppProcessParent()
: mApp(EmbedLiteApp::GetInstance())
{
LOGT();
MOZ_COUNT_CTOR(EmbedLiteAppProcessParent);
Expand Down Expand Up @@ -87,14 +88,16 @@ bool
EmbedLiteAppProcessParent::RecvInitialized()
{
LOGT();
mApp->Initialized();
return true;
}

bool
EmbedLiteAppProcessParent::RecvReadyToShutdown()
{
LOGT();
return false;
mApp->ChildReadyToDestroy();
return true;
}

bool
Expand Down
3 changes: 2 additions & 1 deletion embedding/embedlite/embedprocess/EmbedLiteAppProcessParent.h
Expand Up @@ -54,7 +54,8 @@ class EmbedLiteAppProcessParent : public PEmbedLiteAppParent
private:
virtual ~EmbedLiteAppProcessParent();

private:
EmbedLiteApp* mApp;

DISALLOW_EVIL_CONSTRUCTORS(EmbedLiteAppProcessParent);
};

Expand Down
5 changes: 5 additions & 0 deletions embedding/embedlite/embedprocess/EmbedLiteSubProcess.cpp
Expand Up @@ -82,5 +82,10 @@ void EmbedLiteSubProcess::StartEmbedProcess()
mAppParent->Open(GetChannel(), GetOwnedChildProcessHandle());
}

void EmbedLiteSubProcess::StopEmbedProcess()
{
LOGT();
}

} // namespace embedlite
} // namespace mozilla
5 changes: 4 additions & 1 deletion embedding/embedlite/embedprocess/EmbedLiteSubProcess.h
Expand Up @@ -9,13 +9,13 @@
#define mozilla_ipc_EmbedLiteSubProcess_h

#include "mozilla/ipc/GeckoChildProcessHost.h"
#include "EmbedLiteAppProcessParent.h"
#include "nsISupportsImpl.h"
#include "nsAutoPtr.h"

namespace mozilla {
namespace embedlite {

class EmbedLiteAppProcessParent;
// Copied from browser_process_impl.cc, modified slightly.
class EmbedLiteSubProcess : public mozilla::ipc::GeckoChildProcessHost
{
Expand All @@ -24,6 +24,9 @@ class EmbedLiteSubProcess : public mozilla::ipc::GeckoChildProcessHost
explicit EmbedLiteSubProcess();

void StartEmbedProcess();
void StopEmbedProcess();

EmbedLiteAppProcessParent* AppParent() { return mAppParent.get(); }

private:
virtual ~EmbedLiteSubProcess();
Expand Down
2 changes: 1 addition & 1 deletion embedding/embedlite/tests/embedLiteCoreInitTest.cpp
Expand Up @@ -46,7 +46,7 @@ int main(int argc, char** argv)
MyListener* listener = new MyListener(mapp);
mapp->SetListener(listener);
MessagePumpQt* mQtPump = new MessagePumpQt(mapp);
bool res = mapp->StartWithCustomPump(EmbedLiteApp::EMBED_THREAD, mQtPump->EmbedLoop());
bool res = mapp->StartWithCustomPump(EmbedLiteApp::EMBED_PROCESS, mQtPump->EmbedLoop());
printf("XUL Symbols loaded: init res:%i\n", res);
app.exec();
delete mQtPump;
Expand Down

0 comments on commit c45a192

Please sign in to comment.