If a windows related event does not com from at-spi, We can reuse existing information.
Each operation can remove at least 200ms up to 500ms.
Usually, repeated data is requested in one window(app), so in the actual test it can improve great performance.
Change-Id: I25d6b3a1f06548f05a03fce517dfa0b37e6bccb6
*/
virtual void setXMLsync(bool sync) = 0;
+ /**
+ * @brief Gets the window related event has been emitted or not for window info cache
+ *
+ * @return true if window related event emitted, else false
+ *
+ * @since_tizen 8.0
+ */
+ virtual bool getWindowEventEmitted() = 0;
+
public:
/**
* @brief Gets active application vector.
*/
virtual void setXMLsync(bool sync) override;
+ /**
+ * @copydoc @AccessibleWatcher::getWindowEventEmitted()
+ */
+ virtual bool getWindowEventEmitted() override;
+
public:
/**
* @brief Listen atspi events.
static std::chrono::system_clock::time_point mStartTime;
static IdleEventState isIdle;
static int mRenderCount;
+ static bool isWindowEventEmitted;
};
}
void setXMLsync(bool sync);
+ bool getWindowEventEmitted();
public:
/**
* @brief TBD
*/
Size2D<int> mScreenSize;
static std::mutex CaptureMutex;
+ static std::vector<std::shared_ptr<AccessibleNode>> mCachedNode;
};
}
IdleEventState AtspiAccessibleWatcher::isIdle = IdleEventState::IDLE_LISTEN_READY;
static const unsigned int WAIT_FOR_IDLE_MILLI_SEC = 1000; // 1sec
int AtspiAccessibleWatcher::mRenderCount = 10;
+bool AtspiAccessibleWatcher::isWindowEventEmitted = false;
static bool iShowingNode(AtspiAccessible *node)
{
{
return;
}
+
+ if (!strncmp(event->type, "w", 1))
+ isWindowEventEmitted = true;
+
char *name = NULL, *pkg = NULL;
AtspiAccessibleWatcher *instance = (AtspiAccessibleWatcher *)watcher;
name = AtspiWrapper::Atspi_accessible_get_name(event->source, NULL);
}
}
}
+
+bool AtspiAccessibleWatcher::getWindowEventEmitted()
+{
+ bool ret = isWindowEventEmitted;
+ isWindowEventEmitted = false;
+
+ return ret;
+}
void MockAccessibleWatcher::setXMLsync(bool sync)
{
}
+
+bool MockAccessibleWatcher::getWindowEventEmitted()
+{
+ return true;
+}
std::mutex TizenDeviceImpl::CaptureMutex = std::mutex{};
static GDBusConnection *system_conn;
+std::vector<std::shared_ptr<AccessibleNode>> TizenDeviceImpl::mCachedNode;
TizenDeviceImpl::TizenDeviceImpl()
: mFakeTouchHandle{0}, mFakeKeyboardHandle{0}, mFakeWheelHandle{0}, tStart{}, isTimerStarted{false}, mTouchSeq{}
std::vector<std::shared_ptr<AccessibleNode>> TizenDeviceImpl::getWindowRoot() const
{
- LOGI("Request window info");
+ if (!AccessibleWatcher::getInstance()->getWindowEventEmitted() && mCachedNode.size() > 0)
+ {
+ for (auto &win : mCachedNode)
+ LOGI("Cache hit pkg: (%s)", win->getPkg().c_str());
+ return mCachedNode;
+ }
std::vector<std::shared_ptr<TizenWindow>> mTizenWindows{};
getTizenWindowInfo(mTizenWindows);
pidToAppNode.erase(tWin->getPid());
}
+ mCachedNode = ret;
+
return ret;
}