Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial version of EmbedLite process backend
- Loading branch information
Showing
7 changed files
with
274 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
embedding/embedlite/embedprocess/EmbedLiteAppProcessParent.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "EmbedLog.h" | ||
#include "EmbedLiteAppProcessParent.h" | ||
#include "EmbedLiteApp.h" | ||
#include "mozilla/unused.h" | ||
|
||
using namespace base; | ||
using namespace mozilla::ipc; | ||
|
||
namespace mozilla { | ||
namespace embedlite { | ||
|
||
EmbedLiteAppProcessParent::EmbedLiteAppProcessParent() | ||
{ | ||
LOGT(); | ||
MOZ_COUNT_CTOR(EmbedLiteAppProcessParent); | ||
} | ||
|
||
EmbedLiteAppProcessParent::~EmbedLiteAppProcessParent() | ||
{ | ||
LOGT(); | ||
MOZ_COUNT_DTOR(EmbedLiteAppProcessParent); | ||
} | ||
|
||
bool | ||
EmbedLiteAppProcessParent::RecvInitialized() | ||
{ | ||
return false; | ||
} | ||
|
||
bool | ||
EmbedLiteAppProcessParent::RecvReadyToShutdown() | ||
{ | ||
return false; | ||
} | ||
|
||
bool | ||
EmbedLiteAppProcessParent::RecvCreateWindow( | ||
const uint32_t& parentId, | ||
const nsCString& uri, | ||
const uint32_t& chromeFlags, | ||
const uint32_t& contextFlags, | ||
uint32_t* createdID, | ||
bool* cancel) | ||
{ | ||
return false; | ||
} | ||
|
||
bool | ||
EmbedLiteAppProcessParent::RecvObserve( | ||
const nsCString& topic, | ||
const nsString& data) | ||
{ | ||
return false; | ||
} | ||
|
||
PEmbedLiteViewParent* | ||
EmbedLiteAppProcessParent::AllocPEmbedLiteViewParent( | ||
const uint32_t& id, | ||
const uint32_t& parentId) | ||
{ | ||
return 0; | ||
} | ||
|
||
bool | ||
EmbedLiteAppProcessParent::DeallocPEmbedLiteViewParent(PEmbedLiteViewParent* aActor) | ||
{ | ||
return false; | ||
} | ||
|
||
void | ||
EmbedLiteAppProcessParent::ActorDestroy(ActorDestroyReason aWhy) | ||
{ | ||
} | ||
|
||
} // namespace embedlite | ||
} // namespace mozilla | ||
|
62 changes: 62 additions & 0 deletions
62
embedding/embedlite/embedprocess/EmbedLiteAppProcessParent.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef MOZ_APP_EMBED_PROCESS_PARENT_H | ||
#define MOZ_APP_EMBED_PROCESS_PARENT_H | ||
|
||
#include "mozilla/embedlite/PEmbedLiteAppParent.h" | ||
|
||
namespace mozilla { | ||
namespace embedlite { | ||
|
||
class EmbedLiteAppProcessParent : public PEmbedLiteAppParent | ||
{ | ||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(EmbedLiteAppProcessParent) | ||
public: | ||
EmbedLiteAppProcessParent(); | ||
|
||
protected: | ||
virtual bool | ||
RecvInitialized(); | ||
|
||
virtual bool | ||
RecvReadyToShutdown(); | ||
|
||
virtual bool | ||
RecvCreateWindow( | ||
const uint32_t& parentId, | ||
const nsCString& uri, | ||
const uint32_t& chromeFlags, | ||
const uint32_t& contextFlags, | ||
uint32_t* createdID, | ||
bool* cancel); | ||
|
||
virtual bool | ||
RecvObserve( | ||
const nsCString& topic, | ||
const nsString& data); | ||
|
||
virtual PEmbedLiteViewParent* | ||
AllocPEmbedLiteViewParent( | ||
const uint32_t& id, | ||
const uint32_t& parentId); | ||
|
||
virtual bool | ||
DeallocPEmbedLiteViewParent(PEmbedLiteViewParent* aActor); | ||
|
||
virtual void | ||
ActorDestroy(ActorDestroyReason aWhy); | ||
|
||
private: | ||
virtual ~EmbedLiteAppProcessParent(); | ||
|
||
private: | ||
DISALLOW_EVIL_CONSTRUCTORS(EmbedLiteAppProcessParent); | ||
}; | ||
|
||
} // namespace embedlite | ||
} // namespace mozilla | ||
|
||
#endif // MOZ_APP_EMBED_PROCESS_PARENT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- | ||
* vim: sw=2 ts=8 et : | ||
*/ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "EmbedLog.h" | ||
|
||
#include "nsXPCOMPrivate.h" | ||
#include "EmbedLiteSubProcess.h" | ||
#include "GeckoLoader.h" | ||
#include "EmbedLiteApp.h" | ||
#include "GeckoProfiler.h" | ||
#include "EmbedLiteAppProcessParent.h" | ||
#include "mozilla/ipc/BrowserProcessSubThread.h" | ||
#include "nsThreadManager.h" | ||
#include "nsAutoPtr.h" | ||
#include "base/command_line.h" | ||
#include "nsDirectoryService.h" | ||
#include "nsDirectoryServiceDefs.h" | ||
|
||
using namespace mozilla::ipc; | ||
using namespace mozilla::dom; | ||
using namespace mozilla::layers; | ||
static BrowserProcessSubThread* sIOThread; | ||
|
||
namespace mozilla { | ||
namespace embedlite { | ||
|
||
// | ||
// EmbedLiteSubProcess | ||
// | ||
|
||
EmbedLiteSubProcess::EmbedLiteSubProcess() | ||
: GeckoChildProcessHost(GeckoProcessType_Content) | ||
{ | ||
LOGT(); | ||
} | ||
|
||
EmbedLiteSubProcess::~EmbedLiteSubProcess() | ||
{ | ||
LOGT(); | ||
} | ||
|
||
void EmbedLiteSubProcess::StartEmbedProcess() | ||
{ | ||
LOGT(); | ||
if (!BrowserProcessSubThread::GetMessageLoop(BrowserProcessSubThread::IO)) { | ||
UniquePtr<BrowserProcessSubThread> ioThread(new BrowserProcessSubThread(BrowserProcessSubThread::IO)); | ||
if (!ioThread.get()) { | ||
return; | ||
} | ||
|
||
base::Thread::Options options; | ||
options.message_loop_type = MessageLoop::TYPE_IO; | ||
if (!ioThread->StartWithOptions(options)) { | ||
return; | ||
} | ||
sIOThread = ioThread.release(); | ||
} | ||
|
||
// Establish the main thread here. | ||
if (NS_FAILED(nsThreadManager::get()->Init())) { | ||
NS_ERROR("Could not initialize thread manager"); | ||
return; | ||
} | ||
NS_SetMainThread(); | ||
mAppParent = new EmbedLiteAppProcessParent(); | ||
|
||
// set gGREBinPath | ||
gGREBinPath = ToNewUnicode(nsDependentCString(getenv("GRE_HOME"))); | ||
|
||
if (!CommandLine::IsInitialized()) { | ||
CommandLine::Init(0, nullptr); | ||
} | ||
|
||
LaunchAndWaitForProcessHandle(); | ||
mAppParent->Open(GetChannel(), GetOwnedChildProcessHandle()); | ||
} | ||
|
||
} // namespace embedlite | ||
} // namespace mozilla |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- | ||
* vim: sw=2 ts=8 et : | ||
*/ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef mozilla_ipc_EmbedLiteSubProcess_h | ||
#define mozilla_ipc_EmbedLiteSubProcess_h | ||
|
||
#include "mozilla/ipc/GeckoChildProcessHost.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 | ||
{ | ||
public: | ||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(EmbedLiteSubProcess) | ||
explicit EmbedLiteSubProcess(); | ||
|
||
void StartEmbedProcess(); | ||
|
||
private: | ||
virtual ~EmbedLiteSubProcess(); | ||
RefPtr<EmbedLiteAppProcessParent> mAppParent; | ||
}; | ||
|
||
} // namespace embedlite | ||
} // namespace mozilla | ||
|
||
#endif // mozilla_embedlite_EmbedLiteSubProcess_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters