mirror of https://github.com/vitalif/phantomjs
Implement WebPage's release() function in pure C++.
parent
6e4137f16c
commit
6fe972d0a8
|
@ -86,10 +86,6 @@ window.WebPage = function () {
|
|||
this._appendScriptElement(scriptUrl);
|
||||
};
|
||||
|
||||
page.release = function () {
|
||||
phantom._release(page);
|
||||
};
|
||||
|
||||
return page;
|
||||
};
|
||||
|
||||
|
|
|
@ -292,11 +292,6 @@ void Phantom::exit(int code)
|
|||
QApplication::instance()->exit(code);
|
||||
}
|
||||
|
||||
void Phantom::_release(QObject *page) {
|
||||
m_pages.removeOne((WebPage*)page);
|
||||
delete page;
|
||||
}
|
||||
|
||||
// private slots:
|
||||
void Phantom::printConsoleMessage(const QString &message, int lineNumber, const QString &source)
|
||||
{
|
||||
|
|
|
@ -73,7 +73,6 @@ public slots:
|
|||
QObject *createWebPage();
|
||||
bool injectJs(const QString &jsFilePath);
|
||||
void exit(int code = 0);
|
||||
void _release(QObject *page);
|
||||
|
||||
private slots:
|
||||
void printConsoleMessage(const QString &msg, int lineNumber, const QString &source);
|
||||
|
@ -89,7 +88,7 @@ private:
|
|||
NetworkAccessManager *m_netAccessMan;
|
||||
QVariantMap m_defaultPageSettings;
|
||||
FileSystem m_filesystem;
|
||||
QList<WebPage*> m_pages;
|
||||
QList<QPointer<WebPage> > m_pages;
|
||||
};
|
||||
|
||||
#endif // PHANTOM_H
|
||||
|
|
|
@ -317,6 +317,11 @@ void WebPage::openUrl(const QString &address, const QVariant &op, const QVariant
|
|||
m_mainFrame->load(QNetworkRequest(QUrl(address)), networkOp, body);
|
||||
}
|
||||
|
||||
void WebPage::release()
|
||||
{
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
bool WebPage::render(const QString &fileName)
|
||||
{
|
||||
if (m_mainFrame->contentsSize().isEmpty())
|
||||
|
|
|
@ -74,6 +74,8 @@ public:
|
|||
|
||||
public slots:
|
||||
void openUrl(const QString &address, const QVariant &op, const QVariantMap &settings);
|
||||
void release();
|
||||
|
||||
QVariant evaluate(const QString &code);
|
||||
bool render(const QString &fileName);
|
||||
bool injectJs(const QString &jsFilePath);
|
||||
|
|
Loading…
Reference in New Issue