Skip to content

Commit

Permalink
Switch EmbedLiteViewImplIface into idl format
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeshkova committed Jun 23, 2014
1 parent ce830b5 commit 7a55d94
Show file tree
Hide file tree
Showing 8 changed files with 208 additions and 166 deletions.
1 change: 1 addition & 0 deletions dom/camera/CameraPreferences.cpp
Expand Up @@ -8,6 +8,7 @@
#include "mozilla/Monitor.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/Preferences.h"
#include "mozilla/ArrayUtils.h"

using namespace mozilla;

Expand Down
15 changes: 9 additions & 6 deletions embedding/embedlite/EmbedLiteView.cpp
Expand Up @@ -65,12 +65,12 @@ EmbedLiteView::GetListener() const
}

void
EmbedLiteView::SetImpl(EmbedLiteViewImplIface* aViewImpl)
EmbedLiteView::SetImpl(EmbedLiteViewIface* aViewImpl)
{
mViewImpl = aViewImpl;
}

EmbedLiteViewImplIface*
EmbedLiteViewIface*
EmbedLiteView::GetImpl()
{
return mViewImpl;
Expand Down Expand Up @@ -190,14 +190,14 @@ EmbedLiteView::RenderToImage(unsigned char* aData, int imgW, int imgH, int strid
{
LOGF("data:%p, sz[%i,%i], stride:%i, depth:%i", aData, imgW, imgH, stride, depth);
NS_ENSURE_TRUE(mViewImpl, false);
return mViewImpl->RenderToImage(aData, imgW, imgH, stride, depth);
return NS_SUCCEEDED(mViewImpl->RenderToImage(aData, imgW, imgH, stride, depth));
}

bool
EmbedLiteView::RenderGL()
{
NS_ENSURE_TRUE(mViewImpl, false);
return mViewImpl->RenderGL();
return NS_SUCCEEDED(mViewImpl->RenderGL());
}

char*
Expand Down Expand Up @@ -401,7 +401,10 @@ EmbedLiteView::PinchEnd(int x, int y, float scale)
uint32_t
EmbedLiteView::GetUniqueID()
{
if (mViewImpl && mViewImpl->GetUniqueID() != mUniqueID) {
NS_ENSURE_TRUE(mViewImpl, 0);
uint32_t id;
mViewImpl->GetUniqueID(&id);
if (id != mUniqueID) {
NS_ERROR("Something went wrong");
}
return mUniqueID;
Expand All @@ -411,7 +414,7 @@ bool
EmbedLiteView::GetPendingTexture(EmbedLiteRenderTarget* aContextWrapper, int* textureID, int* width, int* height, int* textureTarget)
{
NS_ENSURE_TRUE(mViewImpl, false);
return mViewImpl->GetPendingTexture(aContextWrapper, textureID, width, height, textureTarget);
return NS_SUCCEEDED(mViewImpl->GetPendingTexture(aContextWrapper, textureID, width, height, textureTarget));
}

} // namespace embedlite
Expand Down
9 changes: 5 additions & 4 deletions embedding/embedlite/EmbedLiteView.h
Expand Up @@ -12,10 +12,11 @@
#include "nsRect.h"
#include "InputData.h"

class EmbedLiteViewIface;

namespace mozilla {
namespace embedlite {

class EmbedLiteViewImplIface;
class EmbedLiteView;
class EmbedLiteRenderTarget;

Expand Down Expand Up @@ -152,12 +153,12 @@ class EmbedLiteView
private:
friend class EmbedLiteViewThreadParent;
friend class EmbedLiteCompositorParent;
void SetImpl(EmbedLiteViewImplIface*);
EmbedLiteViewImplIface* GetImpl();
void SetImpl(EmbedLiteViewIface*);
EmbedLiteViewIface* GetImpl();

EmbedLiteApp* mApp;
EmbedLiteViewListener* mListener;
EmbedLiteViewImplIface* mViewImpl;
EmbedLiteViewIface* mViewImpl;
uint32_t mUniqueID;
uint32_t mParent;
};
Expand Down
65 changes: 65 additions & 0 deletions embedding/embedlite/embedhelpers/EmbedLiteViewIface.idl
@@ -0,0 +1,65 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 "nsISupports.idl"

%{C++
#include "mozilla/gfx/Matrix.h"
#include "gfxRect.h"
#include "EmbedLiteRenderTarget.h"
#include "InputData.h"
%}

%{C++
template<class T> class nsTArray;
class nsString;
%}
[ref] native nsStringTArrayRef(nsTArray<nsString>);
[ref] native gfxMatrix(mozilla::gfx::Matrix);
[ref] native gfxRect(gfxRect);
[ref] native nsIntPoint(nsIntPoint);
[ref] native nsIntRect(nsIntRect);
[ref] native InputData(mozilla::InputData);
[ptr] native EmbedLiteRenderTarget(mozilla::embedlite::EmbedLiteRenderTarget);
[ptr] native buffer(unsigned char);

[scriptable, uuid(6d7750f8-e028-4445-a0cb-d9ce28fb03dd)]
interface EmbedLiteViewIface
{
void LoadURL(in string aName);
void GoBack();
void GoForward();
void StopLoad();
void Reload(in boolean aHardReload);
void LoadFrameScript(in string aURI);
void DoSendAsyncMessage([const] in wstring aMessageName,[const] in wstring aMessage);
void AddMessageListener(in string aMessageName);
void RemoveMessageListener(in string aMessageName);
void AddMessageListeners([const] in nsStringTArrayRef aNames);
void RemoveMessageListeners([const] in nsStringTArrayRef aNames);
void RenderToImage(in buffer aData, in int32_t aWidth, in int32_t aHeigth, in int32_t aStride, in int32_t aDepth);
void RenderGL();
void SetIsActive(in boolean isActive);
void SetIsFocused(in boolean isFocused);
void SuspendTimeouts();
void ResumeTimeouts();
void SetViewSize(in int32_t aWidth, in int32_t aHeight);
void SetGLViewPortSize(in int32_t aWidth, in int32_t aHeight);
void SetGLViewTransform(in gfxMatrix aMatrix);
void SetViewClipping([const] in gfxRect aClipRect);
void SetTransformation(in float aScale, in nsIntPoint aScrollOffset);
void ScheduleRender();
void ReceiveInputEvent([const] in InputData aEvent);
void TextEvent(in string aComposite, in string aPreEdit);
void SendKeyPress(in int32_t aDomKeyCode, in int32_t aModifiers, in int32_t aCharCode);
void SendKeyRelease(in int32_t aDomKeyCode, in int32_t aModifiers, in int32_t aCharCode);
void MousePress(in int32_t aX, in int32_t aY, in int32_t aTime, in uint32_t aButtons, in uint32_t aModifiers);
void MouseRelease(in int32_t aX, in int32_t aY, in int32_t aTime, in uint32_t aButtons, in uint32_t aModifiers);
void MouseMove(in int32_t aX, in int32_t aY, in int32_t aTime, in uint32_t aButtons, in uint32_t aModifiers);
void UpdateScrollController();
void ViewAPIDestroyed();
void GetUniqueID(out uint32_t aId);
void GetPendingTexture(in EmbedLiteRenderTarget aContextWrapper, out int32_t aTextureID, out int32_t aTextureTarget, out int32_t aWidth, out int32_t aHeight);
};
64 changes: 0 additions & 64 deletions embedding/embedlite/embedhelpers/EmbedLiteViewImplIface.h

This file was deleted.

0 comments on commit 7a55d94

Please sign in to comment.