From: Timo Lotterbach Date: Wed, 10 Oct 2012 14:39:12 +0000 (-0700) Subject: LayerManagerService: added creator pid to every graphical object X-Git-Tag: ivi-layer-management_version_0_9_9_rc~73 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=67a56edfdba0c61967cfc4977e40635ce82cb0c0;p=profile%2Fivi%2Flayer-management.git LayerManagerService: added creator pid to every graphical object --- diff --git a/LayerManagerCommands/src/LayerCreateCommand.cpp b/LayerManagerCommands/src/LayerCreateCommand.cpp index f7b5b0d..587aeaf 100644 --- a/LayerManagerCommands/src/LayerCreateCommand.cpp +++ b/LayerManagerCommands/src/LayerCreateCommand.cpp @@ -26,7 +26,7 @@ ExecutionResult LayerCreateCommand::execute(ICommandExecutor* executor) Scene& scene = *(executor->getScene()); ExecutionResult result = ExecutionFailed; - Layer *layer = scene.createLayer(*m_idReturn); + Layer *layer = scene.createLayer(*m_idReturn, getSenderPid()); if (layer) { *m_idReturn = layer->getID(); diff --git a/LayerManagerCommands/src/LayergroupCreateCommand.cpp b/LayerManagerCommands/src/LayergroupCreateCommand.cpp index bf06915..01bf79d 100644 --- a/LayerManagerCommands/src/LayergroupCreateCommand.cpp +++ b/LayerManagerCommands/src/LayergroupCreateCommand.cpp @@ -26,7 +26,7 @@ ExecutionResult LayergroupCreateCommand::execute(ICommandExecutor* executor) Scene& scene = *(executor->getScene()); ExecutionResult result = ExecutionFailed; - LayerGroup *layergroup = scene.createLayerGroup(*m_idReturn); + LayerGroup *layergroup = scene.createLayerGroup(*m_idReturn, getSenderPid()); if (layergroup) { diff --git a/LayerManagerCommands/src/SurfaceCreateCommand.cpp b/LayerManagerCommands/src/SurfaceCreateCommand.cpp index 705af4b..3eb44a0 100644 --- a/LayerManagerCommands/src/SurfaceCreateCommand.cpp +++ b/LayerManagerCommands/src/SurfaceCreateCommand.cpp @@ -26,7 +26,7 @@ ExecutionResult SurfaceCreateCommand::execute(ICommandExecutor* executor) Scene& scene = *(executor->getScene()); ExecutionResult result = ExecutionFailed; - Surface* surface = scene.createSurface(*m_idReturn); + Surface* surface = scene.createSurface(*m_idReturn, getSenderPid()); if (surface) { diff --git a/LayerManagerCommands/src/SurfacegroupCreateCommand.cpp b/LayerManagerCommands/src/SurfacegroupCreateCommand.cpp index a54f1b1..6939e48 100644 --- a/LayerManagerCommands/src/SurfacegroupCreateCommand.cpp +++ b/LayerManagerCommands/src/SurfacegroupCreateCommand.cpp @@ -26,7 +26,7 @@ ExecutionResult SurfacegroupCreateCommand::execute(ICommandExecutor* executor) Scene& scene = *(executor->getScene()); ExecutionResult result = ExecutionFailed; - SurfaceGroup *surfacegroup = scene.createSurfaceGroup(*m_idReturn); + SurfaceGroup *surfacegroup = scene.createSurfaceGroup(*m_idReturn, getSenderPid()); if (surfacegroup) { diff --git a/LayerManagerPlugins/Communicators/GenericCommunicator/test/DBUSCommunicatorTest.cpp b/LayerManagerPlugins/Communicators/GenericCommunicator/test/DBUSCommunicatorTest.cpp index 42ce92d..43b86c7 100644 --- a/LayerManagerPlugins/Communicators/GenericCommunicator/test/DBUSCommunicatorTest.cpp +++ b/LayerManagerPlugins/Communicators/GenericCommunicator/test/DBUSCommunicatorTest.cpp @@ -206,7 +206,7 @@ TEST_F(DBUSCommunicatorTest, listSurfacesOfSurfacegroup) { DefaultValue::Set((Scene*) &this->layerlist); // Sets the default return value for type Bar. DefaultValue >::Set(defaultlist); - DefaultValue::Set(new SurfaceGroup()); + DefaultValue::Set(new SurfaceGroup(0)); EXPECT_CALL(this->layerlist, getSurfaceGroup(Eq(84567u) )).Times(1); ASSERT_NE(-1, system((DBUSCOMMAND + std::string("ListSurfacesOfSurfacegroup uint32:84567")).c_str())); @@ -218,7 +218,7 @@ TEST_F(DBUSCommunicatorTest, listlayersOflayergroup) { // Sets the default return value for type Bar. DefaultValue::Set((Scene*) &this->layerlist); DefaultValue >::Set(defaultlist); - DefaultValue::Set(new LayerGroup()); + DefaultValue::Set(new LayerGroup(0)); EXPECT_CALL(this->layerlist, getLayerGroup(Eq(345u) )).Times(1); ASSERT_NE(-1, system((DBUSCOMMAND + std::string("ListLayersOfLayergroup uint32:345")).c_str())); @@ -228,7 +228,7 @@ TEST_F(DBUSCommunicatorTest, listlayersOflayergroup) { TEST_F(DBUSCommunicatorTest, listSurfaceoflayer) { Scene scene; - DefaultValue::Set(scene.createLayer(234)); + DefaultValue::Set(scene.createLayer(234, 0)); DefaultValue::Set((Scene*) &layerlist); EXPECT_CALL(this->layerlist, getLayer(Eq(234u) )).Times(1); ASSERT_NE(-1, system((DBUSCOMMAND + std::string("ListSurfaceofLayer uint32:234")).c_str())); @@ -239,7 +239,7 @@ TEST_F(DBUSCommunicatorTest, getPropertiesOfSurface) { Scene scene; unsigned int newID = 0; DefaultValue::Set((Scene*) &layerlist); - DefaultValue::Set(scene.createSurface(newID)); + DefaultValue::Set(scene.createSurface(newID, 0)); EXPECT_CALL(this->layerlist, getSurface(Eq(876u) )).Times(1); ASSERT_NE(-1, system((DBUSCOMMAND + std::string("GetPropertiesOfSurface uint32:876")).c_str())); } @@ -247,7 +247,7 @@ TEST_F(DBUSCommunicatorTest, getPropertiesOfSurface) { TEST_F(DBUSCommunicatorTest, getPropertiesOflayer) { Scene scene; - DefaultValue::Set(scene.createLayer(0)); + DefaultValue::Set(scene.createLayer(0, 0)); DefaultValue::Set((Scene*) &layerlist); EXPECT_CALL(this->layerlist, getLayer(Eq(876u) )).Times(1); ASSERT_NE(-1, system((DBUSCOMMAND + std::string("GetPropertiesOfLayer uint32:876")).c_str())); diff --git a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp index d54cf59..69538e3 100644 --- a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp +++ b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp @@ -805,7 +805,7 @@ init_complete: gettimeofday(&tv0, NULL); if (this->debugMode) { - defaultLayer = this->m_pScene->createLayer(0); + defaultLayer = this->m_pScene->createLayer(0, 0); defaultLayer->setOpacity(1.0); defaultLayer->setDestinationRegion(Rectangle(0,0,this->resolutionWidth,this->resolutionHeight)); defaultLayer->setSourceRegion(Rectangle(0,0,this->resolutionWidth,this->resolutionHeight)); @@ -834,7 +834,7 @@ init_complete: if (this->debugMode) { LOG_DEBUG("X11WindowSystem", "CreateNotify Event"); - Surface* s = this->m_pScene->createSurface(0); + Surface* s = this->m_pScene->createSurface(0, 0); s->setOpacity(1.0); this->NewWindow(s, event.xcreatewindow.window); defaultLayer->addSurface(s); diff --git a/LayerManagerService/include/GraphicalGroup.h b/LayerManagerService/include/GraphicalGroup.h index a808116..7231582 100644 --- a/LayerManagerService/include/GraphicalGroup.h +++ b/LayerManagerService/include/GraphicalGroup.h @@ -33,14 +33,14 @@ template class GraphicalGroup : public GraphicalObject { public: - GraphicalGroup() - : GraphicalObject(thetype, 1.0, true) + GraphicalGroup(int creatorPid) + : GraphicalObject(thetype, 1.0, true, creatorPid) { list = std::list(); } - GraphicalGroup(int externalId) - : GraphicalObject(externalId, thetype, 1.0, true) + GraphicalGroup(int externalId, int creatorPid) + : GraphicalObject(externalId, thetype, 1.0, true, creatorPid) { list = std::list(); } diff --git a/LayerManagerService/include/GraphicalObject.h b/LayerManagerService/include/GraphicalObject.h index e033726..2440ed9 100644 --- a/LayerManagerService/include/GraphicalObject.h +++ b/LayerManagerService/include/GraphicalObject.h @@ -33,9 +33,9 @@ class GraphicalObject { public: - GraphicalObject(ObjectType type, double opacity, bool visibility); + GraphicalObject(ObjectType type, double opacity, bool visibility, int creatorPid); - GraphicalObject(int externalId,ObjectType type, double opacity, bool visibility); + GraphicalObject(int externalId, ObjectType type, double opacity, bool visibility, int creatorPid); virtual ~GraphicalObject() {} @@ -128,8 +128,16 @@ public: */ void removeNotification(t_ilm_client_handle client); + /** + * @brief get list of client that registered to a notification for this object + */ ApplicationReferenceList& getNotificationClients(); + /** + * @brief get process id of process that created this object + */ + int getCreatorPid(); + public: static const unsigned int INVALID_ID; @@ -153,9 +161,10 @@ protected: private: static unsigned int nextGraphicId[TypeMax]; + int createdByPid; }; -inline GraphicalObject::GraphicalObject(ObjectType type, double opacity, bool visibility) +inline GraphicalObject::GraphicalObject(ObjectType type, double opacity, bool visibility, int creatorPid) : type(type) , renderPropertyChanged(false) , damaged(false) @@ -167,11 +176,12 @@ inline GraphicalObject::GraphicalObject(ObjectType type, double opacity, bool vi , chromaKeyGreen(0) , chromaKeyBlue(0) , graphicInternalId(nextGraphicId[type]++) +, createdByPid(creatorPid) { graphicExternalId = graphicInternalId; } -inline GraphicalObject::GraphicalObject(int externalId, ObjectType type, double opacity, bool visibility) +inline GraphicalObject::GraphicalObject(int externalId, ObjectType type, double opacity, bool visibility, int creatorPid) : type(type) , renderPropertyChanged(false) , damaged(false) @@ -184,6 +194,7 @@ inline GraphicalObject::GraphicalObject(int externalId, ObjectType type, double , chromaKeyBlue(0) , graphicInternalId(nextGraphicId[type]++) , graphicExternalId(externalId) +, createdByPid(creatorPid) { } diff --git a/LayerManagerService/include/GraphicalSurface.h b/LayerManagerService/include/GraphicalSurface.h index 83e1b50..e4e8257 100644 --- a/LayerManagerService/include/GraphicalSurface.h +++ b/LayerManagerService/include/GraphicalSurface.h @@ -31,9 +31,9 @@ class GraphicalSurface : public GraphicalObject { public: - GraphicalSurface(ObjectType type); + GraphicalSurface(ObjectType type, int creatorPid); - GraphicalSurface(int externalId,ObjectType type); + GraphicalSurface(int externalId, ObjectType type, int creatorPid); virtual ~GraphicalSurface() {} @@ -107,12 +107,11 @@ private: OrientationType m_orientation; // Rotation of the graphical content Rectangle m_sourceViewport; Rectangle m_destinationViewport; - }; -inline GraphicalSurface::GraphicalSurface(ObjectType type) -: GraphicalObject(type, 1.0, false) +inline GraphicalSurface::GraphicalSurface(ObjectType type, int creatorPid) +: GraphicalObject(type, 1.0, false, creatorPid) , OriginalSourceWidth(0) , OriginalSourceHeight(0) , m_orientation(Zero) @@ -121,8 +120,8 @@ inline GraphicalSurface::GraphicalSurface(ObjectType type) { } -inline GraphicalSurface::GraphicalSurface(int externalId,ObjectType type) -: GraphicalObject(externalId,type,1.0,false) +inline GraphicalSurface::GraphicalSurface(int externalId, ObjectType type, int creatorPid) +: GraphicalObject(externalId, type, 1.0, false, creatorPid) , OriginalSourceWidth(0) , OriginalSourceHeight(0) , m_orientation(Zero) diff --git a/LayerManagerService/include/IApplicationReference.h b/LayerManagerService/include/IApplicationReference.h index 005eab1..cf7ce1b 100644 --- a/LayerManagerService/include/IApplicationReference.h +++ b/LayerManagerService/include/IApplicationReference.h @@ -22,6 +22,8 @@ #define _IAPPLICATION_REFERENCE_H_ #include #include +#include + /** * Abstract Base Class for all Application References */ @@ -32,28 +34,29 @@ public: * Constructor: Contructs a Object with the provided Application id and SerialId * */ - IApplicationReference(char* applicationUid, unsigned int processId); - virtual ~IApplicationReference() {} + IApplicationReference(char* processName, unsigned int processId); + ~IApplicationReference(); - virtual char* getApplicationUid(); - static long generateApplicationHash(char* applicationUid); - virtual long getApplicationHash(); - virtual unsigned int getProcessId(); + const char* getProcessName(); + unsigned int getProcessId(); protected: - char* m_applicationUid; + char* m_processName; unsigned int m_processId; }; -inline IApplicationReference::IApplicationReference(char* applicationUid, unsigned int processId) -: m_applicationUid(applicationUid) +inline IApplicationReference::IApplicationReference(char* processName, unsigned int processId) +: m_processName(strdup(processName)) , m_processId(processId) { } -inline char* IApplicationReference::getApplicationUid() +inline IApplicationReference::~IApplicationReference() { - return m_applicationUid; + if (m_processName) + { + free(m_processName); + } } inline unsigned int IApplicationReference::getProcessId() @@ -61,15 +64,9 @@ inline unsigned int IApplicationReference::getProcessId() return m_processId; } -inline long IApplicationReference::getApplicationHash() -{ - return generateApplicationHash(m_applicationUid); -} -inline long IApplicationReference::generateApplicationHash(char* applicationUid) +inline const char* IApplicationReference::getProcessName() { - std::locale loc; - const std::collate& colHash = std::use_facet >(loc); - long result = colHash.hash(applicationUid,applicationUid+strlen(applicationUid)); - return result; + return m_processName; } + #endif /* _IAPPLICATION_REFERENCE_H_ */ diff --git a/LayerManagerService/include/ICommandExecutor.h b/LayerManagerService/include/ICommandExecutor.h index 10353b0..f18ac42 100644 --- a/LayerManagerService/include/ICommandExecutor.h +++ b/LayerManagerService/include/ICommandExecutor.h @@ -184,13 +184,27 @@ public: virtual void removeApplicationReference(t_ilm_client_handle client) = 0; /** - * \brief get pid of a connected applications + * \brief get pid of a connected application * \ingroup ServiceAPI * \param[in] client client handle to get process id for */ virtual t_ilm_uint getSenderPid(t_ilm_client_handle client) = 0; /** + * \brief get name of a connected application + * \ingroup ServiceAPI + * \param[in] client client handle to get process name for + */ + virtual const char* getSenderName(t_ilm_client_handle client) = 0; + + /** + * \brief get name of a connected application + * \ingroup ServiceAPI + * \param[in] pid process id to get process name for + */ + virtual const char* getSenderName(unsigned int pid) = 0; + + /** * \brief get capabilities of layer type * \ingroup ServiceAPI * \param[in] layertype layer type diff --git a/LayerManagerService/include/IScene.h b/LayerManagerService/include/IScene.h index cffcbd8..5296b60 100644 --- a/LayerManagerService/include/IScene.h +++ b/LayerManagerService/include/IScene.h @@ -54,7 +54,7 @@ public: * \param[in] id id of layer * \return pointer to layer */ - virtual Layer* createLayer(const uint id) = 0; + virtual Layer* createLayer(const uint id, int creatorPid) = 0; /** * \brief Creates a new surface within the scene. @@ -62,7 +62,7 @@ public: * \param[in] id id of surface * \return pointer to surface */ - virtual Surface* createSurface(const uint id) = 0; + virtual Surface* createSurface(const uint id, int creatorPid) = 0; /** * \brief Create a new layer group within the scene. @@ -70,7 +70,7 @@ public: * \param[in] id id of the layer group * \return pointer to layer group */ - virtual LayerGroup* createLayerGroup(const uint id) = 0; + virtual LayerGroup* createLayerGroup(const uint id, int creatorPid) = 0; /** * \brief Create a new surface group within the scene. @@ -78,7 +78,7 @@ public: * \param[in] id id of the new surface group * \return pointer to surface group */ - virtual SurfaceGroup* createSurfaceGroup(const uint id) = 0; + virtual SurfaceGroup* createSurfaceGroup(const uint id, int creatorPid) = 0; /** * \brief Remove a layer from the scene. diff --git a/LayerManagerService/include/Layer.h b/LayerManagerService/include/Layer.h index b311f52..813eb23 100644 --- a/LayerManagerService/include/Layer.h +++ b/LayerManagerService/include/Layer.h @@ -35,8 +35,8 @@ class Layer: public GraphicalSurface friend class Scene; public: - Layer(); - Layer(int id); + Layer(int creatorPid); + Layer(int id, int creatorPid); virtual ~Layer() {} @@ -56,15 +56,15 @@ private: uint m_capabilities; }; -inline Layer::Layer() -: GraphicalSurface(TypeLayer) +inline Layer::Layer(int creatorPid) +: GraphicalSurface(TypeLayer, creatorPid) , m_layerType(Software_2D) , m_capabilities(0) { } -inline Layer::Layer(int id) -: GraphicalSurface(id, TypeLayer) +inline Layer::Layer(int id, int creatorPid) +: GraphicalSurface(id, TypeLayer, creatorPid) , m_layerType(Software_2D) , m_capabilities(0) { diff --git a/LayerManagerService/include/Layermanager.h b/LayerManagerService/include/Layermanager.h index 562e864..ce36f46 100644 --- a/LayerManagerService/include/Layermanager.h +++ b/LayerManagerService/include/Layermanager.h @@ -24,6 +24,8 @@ #include "NotificationQueue.h" #include "Scene.h" +typedef std::map PidToProcessNameTable; + class ICommand; class IRenderer; class ICommunicator; @@ -56,6 +58,8 @@ public: virtual void addApplicationReference(t_ilm_client_handle client, IApplicationReference* reference); virtual void removeApplicationReference(t_ilm_client_handle client); virtual t_ilm_uint getSenderPid(t_ilm_client_handle client); + const char* getSenderName(t_ilm_client_handle client); + const char* getSenderName(unsigned int pid); virtual bool startManagement(const int width, const int height, const char* displayName); virtual bool stopManagement(); @@ -86,6 +90,7 @@ private: SceneProviderList* m_pSceneProviderList; NotificationQueue m_clientNotificationQueue; ApplicationReferenceMap* m_pApplicationReferenceMap; + PidToProcessNameTable m_pidToProcessNameTable; }; inline Scene* Layermanager::getScene(void) diff --git a/LayerManagerService/include/Scene.h b/LayerManagerService/include/Scene.h index 1229422..a0a960a 100644 --- a/LayerManagerService/include/Scene.h +++ b/LayerManagerService/include/Scene.h @@ -53,10 +53,10 @@ public: Scene(); virtual ~Scene(); - virtual Layer* createLayer(const uint id); - virtual Surface *createSurface(const uint id); - virtual LayerGroup *createLayerGroup(const uint id); - virtual SurfaceGroup *createSurfaceGroup(const uint id); + virtual Layer* createLayer(const uint id, int creatorPid); + virtual Surface *createSurface(const uint id, int creatorPid); + virtual LayerGroup *createLayerGroup(const uint id, int creatorPid); + virtual SurfaceGroup *createSurfaceGroup(const uint id, int creatorPid); virtual bool removeLayer(Layer* layer); virtual bool removeSurface(Surface* surface); diff --git a/LayerManagerService/include/Surface.h b/LayerManagerService/include/Surface.h index a2d92c9..5ccda0b 100644 --- a/LayerManagerService/include/Surface.h +++ b/LayerManagerService/include/Surface.h @@ -179,8 +179,8 @@ public: int updateCounter; int drawCounter; - Surface() - : GraphicalSurface(TypeSurface) + Surface(int creatorPid) + : GraphicalSurface(TypeSurface, creatorPid) , platform(NULL) , frameCounter(0) , updateCounter(0) @@ -197,8 +197,8 @@ public: pthread_mutex_init(&m_inputAcceptMutex, NULL); } - Surface(int id) - : GraphicalSurface(id, TypeSurface) + Surface(int id, int creatorPid) + : GraphicalSurface(id, TypeSurface, creatorPid) , platform(NULL) , frameCounter(0) , updateCounter(0) diff --git a/LayerManagerService/src/Layermanager.cpp b/LayerManagerService/src/Layermanager.cpp index 3ea7d25..13efcc5 100644 --- a/LayerManagerService/src/Layermanager.cpp +++ b/LayerManagerService/src/Layermanager.cpp @@ -26,6 +26,8 @@ #include "IRenderer.h" #include "ISceneProvider.h" +static const char* NO_SENDER_NAME = "unknown"; + Layermanager::Layermanager() { m_pScene = new Scene(); @@ -172,8 +174,10 @@ void Layermanager::addApplicationReference(t_ilm_client_handle client, IApplicat { if (client && reference) { - LOG_INFO("LayerManagerService", "Connect from application handle:" << client << ", pid:" << reference->getProcessId()); + m_pidToProcessNameTable[reference->getProcessId()] = reference->getProcessName(); (*m_pApplicationReferenceMap)[client]=reference; + unsigned int pid = getSenderPid(client); + LOG_INFO("LayerManagerService", "Connect from application " << getSenderName(client) << "(" << pid << ")"); } } @@ -181,8 +185,10 @@ void Layermanager::removeApplicationReference(t_ilm_client_handle client) { if (client) { - LOG_INFO("LayerManagerService", "Disconnect from application with handle:" << client << ", pid:" << getSenderPid(client)); + unsigned int pid = getSenderPid(client); + LOG_INFO("LayerManagerService", "Disconnect from application " << getSenderName(client) << "(" << pid << ")"); m_pApplicationReferenceMap->erase(client); + m_pidToProcessNameTable.erase(pid); } } @@ -197,6 +203,27 @@ t_ilm_uint Layermanager::getSenderPid(t_ilm_client_handle client) return result; } +const char* Layermanager::getSenderName(t_ilm_client_handle client) +{ + const char* result = NO_SENDER_NAME; + IApplicationReference* app = (*m_pApplicationReferenceMap)[client]; + if (app) + { + result = app->getProcessName(); + } + return result; +} + +const char* Layermanager::getSenderName(unsigned int pid) +{ + const char* result = m_pidToProcessNameTable[pid]; + if (!result) + { + result = NO_SENDER_NAME; + } + return result; +} + void Layermanager::addCommunicator(ICommunicator* communicator) { @@ -257,7 +284,9 @@ bool Layermanager::executeCommand(ICommand* commandToBeExecuted) signalRendererRedraw(); } - LOG_INFO("LayerManagerService", "executed: " << commandToBeExecuted->getString() + unsigned int commandPid = commandToBeExecuted->getSenderPid(); + LOG_INFO("LayerManagerService", "executed " << commandToBeExecuted->getString() + << " from " << getSenderName(commandPid) << "(" << commandPid << ")" << ((status == ExecutionSuccess || status == ExecutionSuccessRedraw) ? "+" : "-")); return (status == ExecutionSuccess || status == ExecutionSuccessRedraw); @@ -274,7 +303,9 @@ bool Layermanager::enqueueCommand(ICommand* commandToBeExecuted) sizeAfter = m_pScene->m_toBeCommittedList.size(); m_pScene->unlockScene(); - LOG_DEBUG("LayerManagerService", "enqueued: " << commandToBeExecuted->getString() + unsigned int commandPid = commandToBeExecuted->getSenderPid(); + LOG_DEBUG("LayerManagerService", "enqueued " << commandToBeExecuted->getString() + << " from " << getSenderName(commandPid) << "(" << commandPid << ")" << ((sizeAfter == sizeBefore + 1) ? "+" : "-")); // if queue size increased by 1, enqueue command was successful diff --git a/LayerManagerService/src/Scene.cpp b/LayerManagerService/src/Scene.cpp index a3cbf56..80f2edc 100644 --- a/LayerManagerService/src/Scene.cpp +++ b/LayerManagerService/src/Scene.cpp @@ -35,13 +35,13 @@ Scene::~Scene() pthread_mutex_destroy(&m_layerListMutex); } -Layer* Scene::createLayer(const uint layerId) +Layer* Scene::createLayer(const uint layerId, int creatorPid) { Layer* newLayer = NULL; if (layerId == GraphicalObject::INVALID_ID) { LOG_DEBUG("Scene", "createLayer: creating new layer"); - newLayer = new Layer(); + newLayer = new Layer(creatorPid); uint newLayerId = newLayer->getID(); m_layerMap[newLayerId] = newLayer; } @@ -50,7 +50,7 @@ Layer* Scene::createLayer(const uint layerId) if (0 == m_layerMap.count(layerId)) { LOG_DEBUG("Scene", "createLayer: unknown layer id provided; creating new layer"); - newLayer = new Layer(layerId); + newLayer = new Layer(layerId, creatorPid); uint newLayerId = newLayer->getID(); m_layerMap[newLayerId] = newLayer; } @@ -63,12 +63,12 @@ Layer* Scene::createLayer(const uint layerId) return newLayer; } -Surface* Scene::createSurface(const uint surfaceId) +Surface* Scene::createSurface(const uint surfaceId, int creatorPid) { Surface* newSurface = NULL; if (surfaceId == GraphicalObject::INVALID_ID) { - newSurface = new Surface(); + newSurface = new Surface(creatorPid); uint newSurfaceId = newSurface->getID(); m_surfaceMap[newSurfaceId] = newSurface; } @@ -76,7 +76,7 @@ Surface* Scene::createSurface(const uint surfaceId) { if (0 == m_surfaceMap.count(surfaceId)) { - newSurface = new Surface(surfaceId); + newSurface = new Surface(surfaceId, creatorPid); uint newSurfaceId = newSurface->getID(); m_surfaceMap[newSurfaceId] = newSurface; } @@ -89,12 +89,12 @@ Surface* Scene::createSurface(const uint surfaceId) return newSurface; } -SurfaceGroup* Scene::createSurfaceGroup(const uint surfaceGroupId) +SurfaceGroup* Scene::createSurfaceGroup(const uint surfaceGroupId, int creatorPid) { SurfaceGroup* newSurfaceGroup = NULL; if (surfaceGroupId == GraphicalObject::INVALID_ID) { - newSurfaceGroup = new SurfaceGroup(); + newSurfaceGroup = new SurfaceGroup(creatorPid); uint newSurfaceGroupId = newSurfaceGroup->getID(); m_surfaceGroupMap[newSurfaceGroupId] = newSurfaceGroup; } @@ -102,7 +102,7 @@ SurfaceGroup* Scene::createSurfaceGroup(const uint surfaceGroupId) { if (0 == m_surfaceGroupMap.count(surfaceGroupId)) { - newSurfaceGroup = new SurfaceGroup(surfaceGroupId); + newSurfaceGroup = new SurfaceGroup(surfaceGroupId, creatorPid); uint newSurfaceGroupId = newSurfaceGroup->getID(); m_surfaceGroupMap[newSurfaceGroupId] = newSurfaceGroup; } @@ -114,12 +114,12 @@ SurfaceGroup* Scene::createSurfaceGroup(const uint surfaceGroupId) return newSurfaceGroup; } -LayerGroup* Scene::createLayerGroup(const uint layerGroupId) +LayerGroup* Scene::createLayerGroup(const uint layerGroupId, int creatorPid) { LayerGroup* newLayerGroup = NULL; if (layerGroupId == GraphicalObject::INVALID_ID) { - newLayerGroup = new LayerGroup(); + newLayerGroup = new LayerGroup(creatorPid); uint newLayerGroupId = newLayerGroup->getID(); m_layerGroupMap[newLayerGroupId] = newLayerGroup; } @@ -127,7 +127,7 @@ LayerGroup* Scene::createLayerGroup(const uint layerGroupId) { if (0 == m_layerGroupMap.count(layerGroupId)) { - newLayerGroup = new LayerGroup(layerGroupId); + newLayerGroup = new LayerGroup(layerGroupId, creatorPid); uint newLayerGroupId = newLayerGroup->getID(); m_layerGroupMap[newLayerGroupId] = newLayerGroup; } diff --git a/LayerManagerService/tests/GraphicalGroupTest.cpp b/LayerManagerService/tests/GraphicalGroupTest.cpp index 1bd5769..1f96065 100644 --- a/LayerManagerService/tests/GraphicalGroupTest.cpp +++ b/LayerManagerService/tests/GraphicalGroupTest.cpp @@ -29,8 +29,8 @@ class GraphicalGroupTest : public ::testing::Test public: void SetUp() { - m_pLayerGroup = new GraphicalGroup(); - m_pSurfaceGroup = new GraphicalGroup(); + m_pLayerGroup = new GraphicalGroup(0); + m_pSurfaceGroup = new GraphicalGroup(0); ASSERT_TRUE(m_pLayerGroup); ASSERT_TRUE(m_pSurfaceGroup); } @@ -58,7 +58,7 @@ TEST_F(GraphicalGroupTest, defaultConstructor_Layer) GraphicalGroup* pLayerGroup = 0; /// create graphical group of type layer (= layer group) - pLayerGroup = new GraphicalGroup(); + pLayerGroup = new GraphicalGroup(0); /// make sure, layer group was created ASSERT_TRUE(pLayerGroup); @@ -78,7 +78,7 @@ TEST_F(GraphicalGroupTest, defaultConstructor_Surface) GraphicalGroup* pSurfaceGroup = 0; /// create graphical group of type surface (= surface group) - pSurfaceGroup = new GraphicalGroup(); + pSurfaceGroup = new GraphicalGroup(0); /// make sure, surface group was created ASSERT_TRUE(pSurfaceGroup); @@ -146,7 +146,7 @@ TEST_F(GraphicalGroupTest, specialConstructor_Surface) TEST_F(GraphicalGroupTest, setVisibility_Layer) { /// create 3 layers - Layer l1, l2, l3; + Layer l1(0), l2(0), l3(0); /// set 2 layers to visible, one to invisible l1.setVisibility(true); @@ -195,7 +195,7 @@ TEST_F(GraphicalGroupTest, setVisibility_Layer) TEST_F(GraphicalGroupTest, setVisibility_Surface) { /// create 3 surfaces - Surface l1, l2, l3; + Surface l1(0), l2(0), l3(0); /// set 2 surfaces to visible, one to invisible l1.setVisibility(true); @@ -244,7 +244,7 @@ TEST_F(GraphicalGroupTest, setVisibility_Surface) TEST_F(GraphicalGroupTest, setOpacity_Layer) { /// create 3 layers - Layer l1, l2, l3; + Layer l1(0), l2(0), l3(0); /// set different opacity for each of the 3 layers l1.setOpacity(0.3); @@ -285,7 +285,7 @@ TEST_F(GraphicalGroupTest, setOpacity_Layer) TEST_F(GraphicalGroupTest, setOpacity_Surface) { /// create 3 surfaces - Surface l1, l2, l3; + Surface l1(0), l2(0), l3(0); /// set different opacity for each of the 3 surfaces l1.setOpacity(0.3); @@ -329,7 +329,7 @@ TEST_F(GraphicalGroupTest, getList_Layer) EXPECT_EQ(0u, m_pLayerGroup->getList().size()); /// add 3 layers to graphical group - Layer l1, l2, l3; + Layer l1(0), l2(0), l3(0); m_pLayerGroup->addElement(&l1); m_pLayerGroup->addElement(&l2); m_pLayerGroup->addElement(&l3); @@ -357,7 +357,7 @@ TEST_F(GraphicalGroupTest, getList_Surface) EXPECT_EQ(0u, m_pSurfaceGroup->getList().size()); /// add 3 surfaces to graphical group - Surface l1, l2, l3; + Surface l1(0), l2(0), l3(0); m_pSurfaceGroup->addElement(&l1); m_pSurfaceGroup->addElement(&l2); m_pSurfaceGroup->addElement(&l3); @@ -385,14 +385,14 @@ TEST_F(GraphicalGroupTest, addElement_Layer) EXPECT_EQ(0u, m_pLayerGroup->getList().size()); /// add 1 layer to graphical group - Layer l1; + Layer l1(0); m_pLayerGroup->addElement(&l1); /// make sure, list not contains 1 element EXPECT_EQ(1u, m_pLayerGroup->getList().size()); /// add 2 layers to graphical group - Layer l2, l3; + Layer l2(0), l3(0); m_pLayerGroup->addElement(&l2); m_pLayerGroup->addElement(&l3); @@ -406,14 +406,14 @@ TEST_F(GraphicalGroupTest, addElement_Surface) EXPECT_EQ(0u, m_pSurfaceGroup->getList().size()); /// add 1 surface to graphical group - Surface l1; + Surface l1(0); m_pSurfaceGroup->addElement(&l1); /// make sure, list not contains 1 element EXPECT_EQ(1u, m_pSurfaceGroup->getList().size()); /// add 2 surfaces to graphical group - Surface l2, l3; + Surface l2(0), l3(0); m_pSurfaceGroup->addElement(&l2); m_pSurfaceGroup->addElement(&l3); @@ -427,7 +427,7 @@ TEST_F(GraphicalGroupTest, removeElement_Layer) EXPECT_EQ(0u, m_pLayerGroup->getList().size()); /// add 3 layers to graphical group - Layer l1, l2, l3; + Layer l1(0), l2(0), l3(0); m_pLayerGroup->addElement(&l1); m_pLayerGroup->addElement(&l2); m_pLayerGroup->addElement(&l3); @@ -455,7 +455,7 @@ TEST_F(GraphicalGroupTest, removeElement_Surface) EXPECT_EQ(0u, m_pSurfaceGroup->getList().size()); /// add 3 surfaces to graphical group - Surface l1, l2, l3; + Surface l1(0), l2(0), l3(0); m_pSurfaceGroup->addElement(&l1); m_pSurfaceGroup->addElement(&l2); m_pSurfaceGroup->addElement(&l3); diff --git a/LayerManagerService/tests/GraphicalObjectTest.cpp b/LayerManagerService/tests/GraphicalObjectTest.cpp index e1a29c0..c8cab49 100644 --- a/LayerManagerService/tests/GraphicalObjectTest.cpp +++ b/LayerManagerService/tests/GraphicalObjectTest.cpp @@ -27,8 +27,8 @@ class GraphicalObjectTest : public ::testing::Test public: void SetUp() { - m_pSurface = new GraphicalObject(TypeSurface, 1.0, true); - m_pLayer = new GraphicalObject(TypeLayer, 1.0, true); + m_pSurface = new GraphicalObject(TypeSurface, 1.0, true, 0); + m_pLayer = new GraphicalObject(TypeLayer, 1.0, true, 0); ASSERT_TRUE(m_pSurface); ASSERT_TRUE(m_pLayer); } @@ -57,7 +57,7 @@ TEST_F(GraphicalObjectTest, constructor_LayerWithoutId) unsigned int expectedVisibility = 1; /// Create graphical object of type layer without specific id - GraphicalObject layer(TypeLayer, expectedOpacity, expectedVisibility); + GraphicalObject layer(TypeLayer, expectedOpacity, expectedVisibility, 0); /// make sure, layer has a valid id assigned EXPECT_NE(GraphicalObject::INVALID_ID, layer.getID()); @@ -82,7 +82,7 @@ TEST_F(GraphicalObjectTest, constructor_SurfaceWithoutId) unsigned char chromaKeyBlue = 111; /// Create graphical object of type surface without specific id - GraphicalObject surface(TypeSurface, expectedOpacity, expectedVisibility); + GraphicalObject surface(TypeSurface, expectedOpacity, expectedVisibility, 0); /// make sure, surface has a valid id assigned EXPECT_NE(GraphicalObject::INVALID_ID, surface.getID()); @@ -117,7 +117,7 @@ TEST_F(GraphicalObjectTest, constructor_LayerWithId) unsigned char chromaKeyBlue = 111; /// Create graphical object of type layer without specific id - GraphicalObject layer(expectedId, TypeLayer, expectedOpacity, expectedVisibility); + GraphicalObject layer(expectedId, TypeLayer, expectedOpacity, expectedVisibility, 0); /// make sure, layer has a expected id assigned EXPECT_EQ(expectedId, layer.getID()); @@ -152,7 +152,7 @@ TEST_F(GraphicalObjectTest, constructor_SurfaceWithId) unsigned char chromaKeyBlue = 111; /// Create graphical object of type surface without specific id - GraphicalObject surface(expectedId, TypeSurface, expectedOpacity, expectedVisibility); + GraphicalObject surface(expectedId, TypeSurface, expectedOpacity, expectedVisibility, 0); /// make sure, surface has a expected id assigned EXPECT_EQ(expectedId, surface.getID()); @@ -297,7 +297,7 @@ TEST_F(GraphicalObjectTest, getID_Layer) EXPECT_NE(GraphicalObject::INVALID_ID, m_pLayer->getID()); /// create graphical object of type layer with expected id - GraphicalObject layer(expectedLayerId, TypeLayer, 1.0, 1); + GraphicalObject layer(expectedLayerId, TypeLayer, 1.0, 1, 0); /// make sure, graphical object has expected id EXPECT_EQ(expectedLayerId, layer.getID()); @@ -311,7 +311,7 @@ TEST_F(GraphicalObjectTest, getID_Surface) EXPECT_NE(GraphicalObject::INVALID_ID, m_pSurface->getID()); /// create graphical object of type surface with expected id - GraphicalObject surface(expectedSurfaceId, TypeSurface, 1.0, 1); + GraphicalObject surface(expectedSurfaceId, TypeSurface, 1.0, 1, 0); /// make sure, graphical object has expected id EXPECT_EQ(expectedSurfaceId, surface.getID()); diff --git a/LayerManagerService/tests/GraphicalSurfaceTest.cpp b/LayerManagerService/tests/GraphicalSurfaceTest.cpp index 2edd81a..e291101 100644 --- a/LayerManagerService/tests/GraphicalSurfaceTest.cpp +++ b/LayerManagerService/tests/GraphicalSurfaceTest.cpp @@ -26,7 +26,7 @@ class GraphicalSurfaceTest : public ::testing::Test public: void SetUp() { - m_pGraphicalSurface = new GraphicalSurface(TypeSurface); + m_pGraphicalSurface = new GraphicalSurface(TypeSurface, 0); ASSERT_TRUE(m_pGraphicalSurface); } diff --git a/LayerManagerService/tests/InputManagerTest.cpp b/LayerManagerService/tests/InputManagerTest.cpp index 42e0502..197caaa 100644 --- a/LayerManagerService/tests/InputManagerTest.cpp +++ b/LayerManagerService/tests/InputManagerTest.cpp @@ -100,7 +100,7 @@ static Layer* createComplexLayer_1(IScene *m_pScene) Layer* pLayer; Surface* pSurface; - pLayer = m_pScene->createLayer(CPLX_SCREEN_LAY1_ID); + pLayer = m_pScene->createLayer(CPLX_SCREEN_LAY1_ID, 0); pLayer->OriginalSourceWidth = CPLX_SCREEN_WIDTH; pLayer->OriginalSourceHeight = CPLX_SCREEN_HEIGHT; pLayer->setSourceRegion(Rectangle(0, 0, CPLX_SCREEN_WIDTH, CPLX_SCREEN_HEIGHT)); @@ -110,7 +110,7 @@ static Layer* createComplexLayer_1(IScene *m_pScene) /* Surface 10 : Background */ - pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY1_SURF_BACKGROUND_ID); + pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY1_SURF_BACKGROUND_ID, 0); pSurface->OriginalSourceWidth = CPLX_SCREEN_WIDTH; pSurface->OriginalSourceHeight = CPLX_SCREEN_HEIGHT; pSurface->setSourceRegion(Rectangle(0, 0, CPLX_SCREEN_WIDTH, CPLX_SCREEN_HEIGHT)); @@ -121,7 +121,7 @@ static Layer* createComplexLayer_1(IScene *m_pScene) pLayer->addSurface(pSurface); /* Surface 20 : Menubar */ - pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY1_SURF_MENUBAR_ID); + pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY1_SURF_MENUBAR_ID, 0); pSurface->OriginalSourceWidth = CPLX_SCREEN_LAY1_MENUBAR_WIDTH; pSurface->OriginalSourceHeight = CPLX_SCREEN_HEIGHT; pSurface->setSourceRegion(Rectangle(0, 0, CPLX_SCREEN_LAY1_MENUBAR_WIDTH, CPLX_SCREEN_HEIGHT)); @@ -132,7 +132,7 @@ static Layer* createComplexLayer_1(IScene *m_pScene) pLayer->addSurface(pSurface); /* Surface 20 : Status */ - pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY1_SURF_STATUSBAR_ID); + pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY1_SURF_STATUSBAR_ID, 0); pSurface->OriginalSourceWidth = CPLX_SCREEN_WIDTH; pSurface->OriginalSourceHeight = CPLX_SCREEN_HEIGHT; pSurface->setSourceRegion(Rectangle(0, 0, CPLX_SCREEN_WIDTH, CPLX_SCREEN_LAY1_STATUSBAR_HEIGHT)); @@ -206,7 +206,7 @@ static Layer* createComplexLayer_2(IScene *m_pScene) Layer* pLayer; Surface* pSurface; - pLayer = m_pScene->createLayer(CPLX_SCREEN_LAY2_ID); + pLayer = m_pScene->createLayer(CPLX_SCREEN_LAY2_ID, 0); pLayer->OriginalSourceWidth = CPLX_SCREEN_WIDTH; pLayer->OriginalSourceHeight = CPLX_SCREEN_HEIGHT; pLayer->setSourceRegion(Rectangle(0, 0, CPLX_SCREEN_WIDTH, CPLX_SCREEN_HEIGHT)); @@ -215,7 +215,7 @@ static Layer* createComplexLayer_2(IScene *m_pScene) pLayer->setVisibility(true); /* Surface 100 : Background */ - pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY2_SURF_BACKGROUND_ID); + pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY2_SURF_BACKGROUND_ID, 0); pSurface->OriginalSourceWidth = CPLX_SCREEN_WIDTH; pSurface->OriginalSourceHeight = CPLX_SCREEN_HEIGHT; pSurface->setSourceRegion(Rectangle(0, 0, CPLX_SCREEN_WIDTH, CPLX_SCREEN_HEIGHT)); @@ -226,7 +226,7 @@ static Layer* createComplexLayer_2(IScene *m_pScene) pLayer->addSurface(pSurface); /* Surface 200 : Content */ - pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY2_SURF_CONTENT_ID); + pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY2_SURF_CONTENT_ID, 0); pSurface->OriginalSourceWidth = CPLX_SCREEN_LAY2_CONTENT_WIDTH; pSurface->OriginalSourceHeight = CPLX_SCREEN_LAY2_CONTENT_HEIGHT; pSurface->setSourceRegion(Rectangle(0, 0, CPLX_SCREEN_LAY2_CONTENT_WIDTH, CPLX_SCREEN_LAY2_CONTENT_HEIGHT)); @@ -237,7 +237,7 @@ static Layer* createComplexLayer_2(IScene *m_pScene) pLayer->addSurface(pSurface); /* Surface 300 : Popup */ - pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY2_SURF_POPUP_ID); + pSurface = m_pScene->createSurface(CPLX_SCREEN_LAY2_SURF_POPUP_ID, 0); pSurface->OriginalSourceWidth = CPLX_SCREEN_LAY2_POPUP_WIDTH; pSurface->OriginalSourceHeight = CPLX_SCREEN_LAY2_POPUP_HEIGHT; pSurface->setSourceRegion(Rectangle(0, 0, CPLX_SCREEN_LAY2_POPUP_WIDTH, CPLX_SCREEN_LAY2_POPUP_HEIGHT)); @@ -682,7 +682,7 @@ TEST_F(InputManagerTest, PointerEvent_Coordinates_translation) layerTop = m_pScene->getLayer(CPLX_SCREEN_LAY2_ID); // Let's create a new surface & add it to the top layer - newSurf = m_pScene->createSurface(sid); + newSurf = m_pScene->createSurface(sid, 0); newSurf->OriginalSourceWidth = sw; newSurf->OriginalSourceHeight = sh; newSurf->setSourceRegion(Rectangle(0, 0, sw, sh)); @@ -745,7 +745,7 @@ TEST_F(InputManagerTest, PointerEvent_Coordinates_croping) layerTop = m_pScene->getLayer(CPLX_SCREEN_LAY2_ID); // Let's create a new surface & add it to the top layer - newSurf = m_pScene->createSurface(sid); + newSurf = m_pScene->createSurface(sid, 0); newSurf->OriginalSourceWidth = sw; newSurf->OriginalSourceHeight = sh; newSurf->setSourceRegion(Rectangle(0, 0, sw, sh)); @@ -803,7 +803,7 @@ TEST_F(InputManagerTest, PointerEvent_Coordinates_scaling) layerTop = m_pScene->getLayer(CPLX_SCREEN_LAY2_ID); // Let's create a new surface & add it to the top layer - newSurf = m_pScene->createSurface(sid); + newSurf = m_pScene->createSurface(sid, 0); newSurf->OriginalSourceWidth = sw; newSurf->OriginalSourceHeight = sh; newSurf->setSourceRegion(Rectangle(0, 0, sw, sh)); diff --git a/LayerManagerService/tests/LayerTest.cpp b/LayerManagerService/tests/LayerTest.cpp index e682215..8190d1a 100644 --- a/LayerManagerService/tests/LayerTest.cpp +++ b/LayerManagerService/tests/LayerTest.cpp @@ -26,7 +26,7 @@ class LayerTest : public ::testing::Test public: void SetUp() { - m_pLayer = new Layer(); + m_pLayer = new Layer(0); ASSERT_TRUE(m_pLayer); } @@ -44,7 +44,7 @@ public: TEST_F(LayerTest, defaultConstructor) { - Layer layer; + Layer layer(0); /// make sure, Layer was not added to any layer //EXPECT_EQ(INVALID_ID, Layer.getContainingLayerId()); @@ -231,7 +231,7 @@ TEST_F(LayerTest, addSurface_alreadyOnOtherLayer) { unsigned int expectedSurfaceId = 34; Surface surface(expectedSurfaceId); - Layer layer; + Layer layer(0); /// make sure, layer contains no surfaces SurfaceList& slist = m_pLayer->getAllSurfaces(); @@ -258,7 +258,7 @@ TEST_F(LayerTest, addSurface_alreadyOnOtherLayer) TEST_F(LayerTest, removeSurface) { - Surface s1, s2, s3; + Surface s1(0), s2(0), s3(0); /// make sure, layer contains no surfaces SurfaceList& slist = m_pLayer->getAllSurfaces(); @@ -300,7 +300,7 @@ TEST_F(LayerTest, removeSurface) TEST_F(LayerTest, getAllSurfaces) { - Surface s1, s2, s3, s4, s5; + Surface s1(0), s2(0), s3(0), s4(0), s5(0); /// make sure, getAllSurfaces returns empty list, if layer contains no surfaces SurfaceList& slist = m_pLayer->getAllSurfaces(); @@ -327,7 +327,7 @@ TEST_F(LayerTest, getAllSurfaces) TEST_F(LayerTest, removeAllSurfaces) { - Surface s1, s2, s3, s4, s5; + Surface s1(0), s2(0), s3(0), s4(0), s5(0); /// make sure, getAllSurfaces returns empty list, if layer contains no surfaces SurfaceList& slist = m_pLayer->getAllSurfaces(); diff --git a/LayerManagerService/tests/SceneTest.cpp b/LayerManagerService/tests/SceneTest.cpp index a7e3ccf..28dce86 100644 --- a/LayerManagerService/tests/SceneTest.cpp +++ b/LayerManagerService/tests/SceneTest.cpp @@ -56,7 +56,7 @@ TEST_F(SceneTest, createLayer) ASSERT_EQ((uint)0, size) << "Scene should contain 0 layers"; /// create layer with expected id - pLayer = m_pScene->createLayer(expected); + pLayer = m_pScene->createLayer(expected, 0); ASSERT_TRUE(pLayer) << "Layer was not created."; /// make sure layer has expected id @@ -82,7 +82,7 @@ TEST_F(SceneTest, createLayer_invalidId) ASSERT_EQ((uint)0, size) << "Scene should contain 0 layers"; /// create layer with invalid id - pLayer = m_pScene->createLayer(GraphicalObject::INVALID_ID); + pLayer = m_pScene->createLayer(GraphicalObject::INVALID_ID, 0); ASSERT_TRUE(pLayer) << "Layer was not created."; /// make sure new layer has valid id @@ -103,7 +103,7 @@ TEST_F(SceneTest, createLayer_twice) Layer* pLayer2; /// create Layer with id 55 - pLayer1 = m_pScene->createLayer(expected); + pLayer1 = m_pScene->createLayer(expected, 0); ASSERT_EQ(expected, pLayer1->getID()); /// make sure, scene contains one layer @@ -111,7 +111,7 @@ TEST_F(SceneTest, createLayer_twice) ASSERT_EQ((uint)1, size) << "Scene should contain 1 layer"; /// try to create existing layer 55, handle to existing layer should be returned - pLayer2 = m_pScene->createLayer(expected); + pLayer2 = m_pScene->createLayer(expected, 0); ASSERT_EQ(expected, pLayer2->getID()); /// make sure, scene still contains one layer @@ -137,7 +137,7 @@ TEST_F(SceneTest, createSurface) ASSERT_EQ((uint)0, size) << "Scene should contain 0 surfaces"; /// create surface with expected id - pSurface = m_pScene->createSurface(expected); + pSurface = m_pScene->createSurface(expected, 0); ASSERT_TRUE(pSurface) << "Surface was not created."; /// make sure surface has expected id @@ -162,7 +162,7 @@ TEST_F(SceneTest, createSurface_invalidId) ASSERT_EQ((uint)0, size) << "Scene should contain 0 surfaces"; /// create surface with invalid id - pSurface = m_pScene->createSurface(GraphicalObject::INVALID_ID); + pSurface = m_pScene->createSurface(GraphicalObject::INVALID_ID, 0); ASSERT_TRUE(pSurface) << "Surface was not created."; /// make sure new surface has valid id @@ -187,7 +187,7 @@ TEST_F(SceneTest, createSurface_twice) ASSERT_EQ((uint)0, size) << "Scene should contain 0 surfaces"; /// create surface with expected id - pSurface1 = m_pScene->createSurface(expected); + pSurface1 = m_pScene->createSurface(expected, 0); ASSERT_TRUE(pSurface1) << "Surface was not created."; /// make sure surface has expected id @@ -198,7 +198,7 @@ TEST_F(SceneTest, createSurface_twice) ASSERT_EQ((uint)1, size) << "Scene should contain 1 surface"; /// create surface with expected id again - pSurface2 = m_pScene->createSurface(expected); + pSurface2 = m_pScene->createSurface(expected, 0); ASSERT_TRUE(pSurface2) << "Surface was not created."; /// make sure surface has expected id again @@ -225,7 +225,7 @@ TEST_F(SceneTest, createLayerGroup) ASSERT_FALSE(pLayerGroup); /// create expected layer group - m_pScene->createLayerGroup(expectedId); + m_pScene->createLayerGroup(expectedId, 0); /// make sure, expected layer group does exist pLayerGroup = m_pScene->getLayerGroup(expectedId); @@ -245,14 +245,14 @@ TEST_F(SceneTest, createLayerGroup_twice) ASSERT_FALSE(pLayerGroup1); /// create expected layer group, get 1st handle to group - pLayerGroup1 = m_pScene->createLayerGroup(expectedLayerGroupId); + pLayerGroup1 = m_pScene->createLayerGroup(expectedLayerGroupId, 0); ASSERT_TRUE(pLayerGroup1); /// make sure, expected layer group does exist EXPECT_TRUE(pLayerGroup1); /// create expected layer group again, get 2nd handle to group - pLayerGroup2 = m_pScene->createLayerGroup(expectedLayerGroupId); + pLayerGroup2 = m_pScene->createLayerGroup(expectedLayerGroupId, 0); /// make sure, expected layer group does exist ASSERT_TRUE(pLayerGroup2); @@ -278,7 +278,7 @@ TEST_F(SceneTest, createSurfaceGroup) ASSERT_FALSE(pSurfaceGroup); /// create expected Surface group, get 1st handle to group - pSurfaceGroup = m_pScene->createSurfaceGroup(expectedSurfaceGroupId); + pSurfaceGroup = m_pScene->createSurfaceGroup(expectedSurfaceGroupId, 0); ASSERT_TRUE(pSurfaceGroup); /// make sure, expected Surface group does exist @@ -298,14 +298,14 @@ TEST_F(SceneTest, createSurfaceGroup_twice) ASSERT_FALSE(pSurfaceGroup1); /// create expected Surface group, get 1st handle to group - pSurfaceGroup1 = m_pScene->createSurfaceGroup(expectedSurfaceGroupId); + pSurfaceGroup1 = m_pScene->createSurfaceGroup(expectedSurfaceGroupId, 0); ASSERT_TRUE(pSurfaceGroup1); /// make sure, expected Surface group does exist EXPECT_TRUE(pSurfaceGroup1); /// create expected Surface group again, get 2nd handle to group - pSurfaceGroup2 = m_pScene->createSurfaceGroup(expectedSurfaceGroupId); + pSurfaceGroup2 = m_pScene->createSurfaceGroup(expectedSurfaceGroupId, 0); /// make sure, expected Surface group does exist ASSERT_TRUE(pSurfaceGroup2); @@ -327,7 +327,7 @@ TEST_F(SceneTest, removeLayer) Layer* pLayer; /// create layer - pLayer = m_pScene->createLayer(expectedLayerId); + pLayer = m_pScene->createLayer(expectedLayerId, 0); ASSERT_TRUE(pLayer); /// make sure, layer exists @@ -346,7 +346,7 @@ TEST_F(SceneTest, removeSurface) Surface* pSurface; /// create Surface - pSurface = m_pScene->createSurface(expectedSurfaceId); + pSurface = m_pScene->createSurface(expectedSurfaceId, 0); ASSERT_TRUE(pSurface); /// make sure, Surface exists @@ -368,7 +368,7 @@ TEST_F(SceneTest, getLayer) EXPECT_FALSE(m_pScene->getLayer(expectedLayerId)); /// create layer - pLayer = m_pScene->createLayer(expectedLayerId); + pLayer = m_pScene->createLayer(expectedLayerId, 0); ASSERT_TRUE(pLayer); /// get layer @@ -390,7 +390,7 @@ TEST_F(SceneTest, getSurface) EXPECT_FALSE(m_pScene->getSurface(expectedSurfaceId)); /// create Surface - pSurface = m_pScene->createSurface(expectedSurfaceId); + pSurface = m_pScene->createSurface(expectedSurfaceId, 0); ASSERT_TRUE(pSurface); /// get Surface @@ -412,7 +412,7 @@ TEST_F(SceneTest, getSurfaceGroup) EXPECT_FALSE(m_pScene->getSurfaceGroup(expectedSurfaceGroupId)); /// create SurfaceGroup - pSurfaceGroup = m_pScene->createSurfaceGroup(expectedSurfaceGroupId); + pSurfaceGroup = m_pScene->createSurfaceGroup(expectedSurfaceGroupId, 0); ASSERT_TRUE(pSurfaceGroup); /// get SurfaceGroup @@ -434,7 +434,7 @@ TEST_F(SceneTest, getLayerGroup) EXPECT_FALSE(m_pScene->getLayerGroup(expectedLayerGroupId)); /// create LayerGroup - pLayerGroup = m_pScene->createLayerGroup(expectedLayerGroupId); + pLayerGroup = m_pScene->createLayerGroup(expectedLayerGroupId, 0); ASSERT_TRUE(pLayerGroup); /// get LayerGroup @@ -461,10 +461,10 @@ TEST_F(SceneTest, getLayerIDs) ASSERT_EQ((uint)0, size); /// create 4 layers in scene - m_pScene->createLayer(layerId1); - m_pScene->createLayer(layerId2); - m_pScene->createLayer(layerId3); - m_pScene->createLayer(layerId4); + m_pScene->createLayer(layerId1, 0); + m_pScene->createLayer(layerId2, 0); + m_pScene->createLayer(layerId3, 0); + m_pScene->createLayer(layerId4, 0); /// make sure, scene contains these 4 layers m_pScene->getLayerIDs(&size, &array); @@ -494,10 +494,10 @@ TEST_F(SceneTest, getLayerIDsOfScreen) ASSERT_EQ((uint)0, size); /// create 4 layers in scene, but dont add them to render order - l1 = m_pScene->createLayer(layerId1); - l2 = m_pScene->createLayer(layerId2); - l3 = m_pScene->createLayer(layerId3); - l4 = m_pScene->createLayer(layerId4); + l1 = m_pScene->createLayer(layerId1, 0); + l2 = m_pScene->createLayer(layerId2, 0); + l3 = m_pScene->createLayer(layerId3, 0); + l4 = m_pScene->createLayer(layerId4, 0); /// make sure, scene contains these 4 layers m_pScene->getLayerIDs(&size, &array); @@ -550,10 +550,10 @@ TEST_F(SceneTest, getSurfaceIDs) ASSERT_EQ((uint)0, size); /// create 4 surfaces in scene - m_pScene->createSurface(surfaceId1); - m_pScene->createSurface(surfaceId2); - m_pScene->createSurface(surfaceId3); - m_pScene->createSurface(surfaceId4); + m_pScene->createSurface(surfaceId1, 0); + m_pScene->createSurface(surfaceId2, 0); + m_pScene->createSurface(surfaceId3, 0); + m_pScene->createSurface(surfaceId4, 0); /// make sure, scene contains these 4 surfaces m_pScene->getSurfaceIDs(&size, &array); @@ -578,10 +578,10 @@ TEST_F(SceneTest, getLayerGroupIDs) ASSERT_EQ((uint)0, size); /// create 4 layergroups in scene - m_pScene->createLayerGroup(layergroupId1); - m_pScene->createLayerGroup(layergroupId2); - m_pScene->createLayerGroup(layergroupId3); - m_pScene->createLayerGroup(layergroupId4); + m_pScene->createLayerGroup(layergroupId1, 0); + m_pScene->createLayerGroup(layergroupId2, 0); + m_pScene->createLayerGroup(layergroupId3, 0); + m_pScene->createLayerGroup(layergroupId4, 0); /// make sure, scene contains these 4 layergroups m_pScene->getLayerGroupIDs(&size, &array); @@ -606,10 +606,10 @@ TEST_F(SceneTest, getSurfaceGroupIDs) ASSERT_EQ((uint)0, size); /// create 4 surfacegroups in scene - m_pScene->createSurfaceGroup(surfacegroupId1); - m_pScene->createSurfaceGroup(surfacegroupId2); - m_pScene->createSurfaceGroup(surfacegroupId3); - m_pScene->createSurfaceGroup(surfacegroupId4); + m_pScene->createSurfaceGroup(surfacegroupId1, 0); + m_pScene->createSurfaceGroup(surfacegroupId2, 0); + m_pScene->createSurfaceGroup(surfacegroupId3, 0); + m_pScene->createSurfaceGroup(surfacegroupId4, 0); /// make sure, scene contains these 4 surfacegroups m_pScene->getSurfaceGroupIDs(&size, &array); @@ -645,7 +645,7 @@ TEST_F(SceneTest, removeSurfaceGroup) SurfaceGroup* pSurfaceGroup; /// create expected Surface group - pSurfaceGroup = m_pScene->createSurfaceGroup(expectedSurfaceGroupId); + pSurfaceGroup = m_pScene->createSurfaceGroup(expectedSurfaceGroupId, 0); ASSERT_TRUE(pSurfaceGroup); /// make sure, expected Surface group does exist @@ -666,7 +666,7 @@ TEST_F(SceneTest, removeLayerGroup) LayerGroup* pLayerGroup; /// create expected Layer group - pLayerGroup = m_pScene->createLayerGroup(expectedLayerGroupId); + pLayerGroup = m_pScene->createLayerGroup(expectedLayerGroupId, 0); ASSERT_TRUE(pLayerGroup); /// make sure, expected Layer group does exist @@ -694,9 +694,9 @@ TEST_F(SceneTest, getAllSurfaces) ASSERT_EQ((uint)0, m_pScene->getAllSurfaces().size()); /// add 3 surfaces to scene - s1 = m_pScene->createSurface(expectedId1); - s2 = m_pScene->createSurface(expectedId2); - s3 = m_pScene->createSurface(expectedId3); + s1 = m_pScene->createSurface(expectedId1, 0); + s2 = m_pScene->createSurface(expectedId2, 0); + s3 = m_pScene->createSurface(expectedId3, 0); /// get all surfaces const SurfaceMap& smap1 = m_pScene->getAllSurfaces(); @@ -726,7 +726,7 @@ TEST_F(SceneTest, isLayerInCurrentRenderOrder) Layer* l1; /// create layer in scene, but dont add it to render order - l1 = m_pScene->createLayer(layerId1); + l1 = m_pScene->createLayer(layerId1, 0); /// make sure, scene contains the new layers m_pScene->getLayerIDs(&size, &array); diff --git a/LayerManagerService/tests/SurfaceTest.cpp b/LayerManagerService/tests/SurfaceTest.cpp index 488b152..c3f3f5b 100644 --- a/LayerManagerService/tests/SurfaceTest.cpp +++ b/LayerManagerService/tests/SurfaceTest.cpp @@ -27,7 +27,7 @@ class SurfaceTest : public ::testing::Test public: void SetUp() { - m_pSurface = new Surface(); + m_pSurface = new Surface(0); ASSERT_TRUE(m_pSurface); } @@ -45,7 +45,7 @@ public: TEST_F(SurfaceTest, defaultConstructor) { - Surface surface; + Surface surface(0); /// make sure, surface was not added to any layer EXPECT_EQ(GraphicalObject::INVALID_ID, surface.getContainingLayerId());