mirror of https://github.com/vitalif/phantomjs
Create FileSystem instance only when needed.
parent
2b83a52251
commit
4fb37aa0cc
|
@ -48,6 +48,7 @@ Phantom::Phantom(QObject *parent)
|
|||
, m_terminated(false)
|
||||
, m_returnValue(0)
|
||||
, m_netAccessMan(0)
|
||||
, m_filesystem(0)
|
||||
{
|
||||
// second argument: script name
|
||||
QStringList args = QApplication::arguments();
|
||||
|
@ -200,7 +201,10 @@ QObject *Phantom::createWebPage()
|
|||
|
||||
QObject *Phantom::createFilesystem()
|
||||
{
|
||||
return &m_filesystem;
|
||||
if (!m_filesystem)
|
||||
m_filesystem = new FileSystem(this);
|
||||
|
||||
return m_filesystem;
|
||||
}
|
||||
|
||||
bool Phantom::injectJs(const QString &jsFilePath) {
|
||||
|
|
|
@ -87,7 +87,7 @@ private:
|
|||
QString m_script;
|
||||
NetworkAccessManager *m_netAccessMan;
|
||||
QVariantMap m_defaultPageSettings;
|
||||
FileSystem m_filesystem;
|
||||
FileSystem *m_filesystem;
|
||||
QList<QPointer<WebPage> > m_pages;
|
||||
Config m_config;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue