Skip to content

Commit

Permalink
Added basic implementation for ViewProcess, not real, just view proto…
Browse files Browse the repository at this point in the history
…col activation
  • Loading branch information
tmeshkova committed Nov 26, 2014
1 parent 03b133f commit 2ddfb7d
Show file tree
Hide file tree
Showing 16 changed files with 957 additions and 23 deletions.
3 changes: 2 additions & 1 deletion embedding/embedlite/EmbedLiteApp.cpp
Expand Up @@ -406,7 +406,8 @@ EmbedLiteApp::CreateView(uint32_t aParent)
NS_ASSERTION(mState == INITIALIZED, "The app must be up and runnning by now");
mViewCreateID++;

EmbedLiteViewThreadParent* viewParent = static_cast<EmbedLiteViewThreadParent*>(mAppParent->SendPEmbedLiteViewConstructor(mViewCreateID, aParent));

PEmbedLiteViewParent* viewParent = static_cast<PEmbedLiteViewParent*>(mAppParent->SendPEmbedLiteViewConstructor(mViewCreateID, aParent));
EmbedLiteView* view = new EmbedLiteView(this, viewParent, mViewCreateID);
mViews[mViewCreateID] = view;
return view;
Expand Down
6 changes: 3 additions & 3 deletions embedding/embedlite/EmbedLiteView.cpp
Expand Up @@ -24,15 +24,15 @@ namespace embedlite {
class FakeListener : public EmbedLiteViewListener {};
static FakeListener sFakeListener;

EmbedLiteView::EmbedLiteView(EmbedLiteApp* aApp, EmbedLiteViewThreadParent* aViewImpl, uint32_t aViewId)
EmbedLiteView::EmbedLiteView(EmbedLiteApp* aApp, PEmbedLiteViewParent* aViewImpl, uint32_t aViewId)
: mApp(aApp)
, mListener(NULL)
, mViewImpl(aViewImpl)
, mViewImpl(dynamic_cast<EmbedLiteViewIface*>(aViewImpl))
, mViewParent(aViewImpl)
, mUniqueID(aViewId)
{
LOGT();
aViewImpl->mView = this;
dynamic_cast<EmbedLiteViewIface*>(aViewImpl)->SetEmbedAPIView(this);
}

EmbedLiteView::~EmbedLiteView()
Expand Down
2 changes: 1 addition & 1 deletion embedding/embedlite/EmbedLiteView.h
Expand Up @@ -69,7 +69,7 @@ class EmbedLiteApp;
class EmbedLiteView
{
public:
EmbedLiteView(EmbedLiteApp* aApp, EmbedLiteViewThreadParent* aViewImpl, uint32_t aViewId);
EmbedLiteView(EmbedLiteApp* aApp, PEmbedLiteViewParent* aViewImpl, uint32_t aViewId);
virtual ~EmbedLiteView();

// Listener setup, call this with null pointer if listener destroyed before EmbedLiteView
Expand Down
3 changes: 3 additions & 0 deletions embedding/embedlite/embedhelpers/EmbedLiteViewIface.idl
Expand Up @@ -9,6 +9,7 @@
#include "mozilla/gfx/Matrix.h"
#include "gfxRect.h"
#include "InputData.h"
#include "EmbedLiteView.h"
%}

%{C++
Expand All @@ -23,6 +24,7 @@ class nsString;
[ref] native InputData(mozilla::InputData);
[ptr] native PlatformImage(void);
[ptr] native buffer(unsigned char);
[ptr] native EmbedLiteView(mozilla::embedlite::EmbedLiteView);

[scriptable, uuid(6d7750f8-e028-4445-a0cb-d9ce28fb03dd)]
interface EmbedLiteViewIface
Expand All @@ -43,4 +45,5 @@ interface EmbedLiteViewIface
void GetPlatformImage(out PlatformImage aImage, out int32_t aWidth, out int32_t aHeight);
void SuspendRendering();
void ResumeRendering();
void SetEmbedAPIView(in EmbedLiteView aView);
};
Expand Up @@ -19,6 +19,7 @@
#include "nsServiceManagerUtils.h"
#include "nsIConsoleService.h"
#include "nsDebugImpl.h"
#include "EmbedLiteViewProcessChild.h"

using namespace base;
using namespace mozilla::ipc;
Expand Down Expand Up @@ -113,13 +114,17 @@ PEmbedLiteViewChild*
EmbedLiteAppProcessChild::AllocPEmbedLiteViewChild(const uint32_t& id, const uint32_t& parentId)
{
LOGT("id:%u, parentId:%u", id, parentId);
return nullptr;
EmbedLiteViewProcessChild* view = new EmbedLiteViewProcessChild(id, parentId);
view->AddRef();
return view;
}

bool
EmbedLiteAppProcessChild::DeallocPEmbedLiteViewChild(PEmbedLiteViewChild* actor)
{
LOGT();
EmbedLiteViewProcessChild* p = static_cast<EmbedLiteViewProcessChild*>(actor);
p->Release();
return true;
}

Expand Down
10 changes: 8 additions & 2 deletions embedding/embedlite/embedprocess/EmbedLiteAppProcessParent.cpp
Expand Up @@ -31,6 +31,8 @@
#include "nsDirectoryService.h"
#include "nsDirectoryServiceDefs.h"

#include "EmbedLiteViewProcessParent.h"

static BrowserProcessSubThread* sIOThread;

using namespace mozilla::dom;
Expand Down Expand Up @@ -193,14 +195,18 @@ PEmbedLiteViewParent*
EmbedLiteAppProcessParent::AllocPEmbedLiteViewParent(const uint32_t& id, const uint32_t& parentId)
{
LOGT();
return 0;
EmbedLiteViewProcessParent* p = new EmbedLiteViewProcessParent(id, parentId);
p->AddRef();
return p;
}

bool
EmbedLiteAppProcessParent::DeallocPEmbedLiteViewParent(PEmbedLiteViewParent* aActor)
{
LOGT();
return false;
EmbedLiteViewProcessParent* p = static_cast<EmbedLiteViewProcessParent*>(aActor);
p->Release();
return true;
}

namespace {
Expand Down
276 changes: 276 additions & 0 deletions embedding/embedlite/embedprocess/EmbedLiteViewProcessChild.cpp
@@ -0,0 +1,276 @@
#include "EmbedLiteViewProcessChild.h"

#include "EmbedLog.h"

namespace mozilla {
namespace embedlite {

MOZ_IMPLICIT EmbedLiteViewProcessChild::EmbedLiteViewProcessChild(const uint32_t& id, const uint32_t& parentId)
{
LOGT();
MOZ_COUNT_CTOR(EmbedLiteViewProcessChild);
mInitWindowTask = NewRunnableMethod(this,
&EmbedLiteViewProcessChild::InitGeckoWindow, parentId);
MessageLoop::current()->PostTask(FROM_HERE, mInitWindowTask);
}

MOZ_IMPLICIT EmbedLiteViewProcessChild::~EmbedLiteViewProcessChild()
{
LOGT();
MOZ_COUNT_DTOR(EmbedLiteViewProcessChild);
}

void
EmbedLiteViewProcessChild::InitGeckoWindow(const uint32_t& parentId)
{
LOGT("parentID: %u", parentId);
if (mInitWindowTask) {
mInitWindowTask->Cancel();
}
mInitWindowTask = nullptr;

// TODO initialize Gecko browser

unused << SendInitialized();
}

bool
EmbedLiteViewProcessChild::RecvLoadURL(const nsString& url)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvGoBack()
{ LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvGoForward()
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvStopLoad()
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvReload(const bool& hardReload)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvLoadFrameScript(const nsString& uri)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvSetViewSize(const gfxSize& aSize)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvSetGLViewSize(const gfxSize& aSize)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvSetIsActive(const bool& aIsActive)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvSetIsFocused(const bool& aIsFocused)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvSuspendTimeouts()
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvResumeTimeouts()
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvAsyncScrollDOMEvent(
const gfxRect& contentRect,
const gfxSize& scrollSize)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvUpdateFrame(const FrameMetrics& frame)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvHandleDoubleTap(const nsIntPoint& point)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvHandleSingleTap(const nsIntPoint& point)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvHandleLongTap(
const nsIntPoint& point,
const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvAcknowledgeScrollUpdate(
const ViewID& aScrollId,
const uint32_t& aScrollGeneration)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvHandleTextEvent(
const nsString& commit,
const nsString& preEdit)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvHandleKeyPressEvent(
const int& domKeyCode,
const int& gmodifiers,
const int& charCode)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvHandleKeyReleaseEvent(
const int& domKeyCode,
const int& gmodifiers,
const int& charCode)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvMouseEvent(
const nsString& aType,
const float& aX,
const float& aY,
const int32_t& aButton,
const int32_t& aClickCount,
const int32_t& aModifiers,
const bool& aIgnoreRootScrollFrame)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvInputDataTouchEvent(
const ScrollableLayerGuid& aGuid,
const MultiTouchInput& event,
const uint64_t& aInputBlockId)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvInputDataTouchMoveEvent(
const ScrollableLayerGuid& aGuid,
const MultiTouchInput& event,
const uint64_t& aInputBlockId)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvAddMessageListener(const nsCString& name)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvRemoveMessageListener(const nsCString& name)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvAddMessageListeners(const nsTArray<nsString>& messageNames)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvRemoveMessageListeners(const nsTArray<nsString>& messageNames)
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvDestroy()
{
LOGT();
return false;
}

bool
EmbedLiteViewProcessChild::RecvAsyncMessage(const nsString& aMessage,
const nsString& aData)
{
LOGT();
return false;
}

} // namespace embedlite
} // namespace mozilla

0 comments on commit 2ddfb7d

Please sign in to comment.