Results 1 to 20 of 21

Thread: window freeze

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2013
    Posts
    65
    Thanks
    4
    Thanked 3 Times in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: window freeze

    Thanks again for your quick response.

    Quote Originally Posted by wysota View Post
    You can do anything you want if you implement it. There are several IPC methods available in computer world. If you teach both programs to use them then you can pass information between different programs.
    I had read about IPC, but I'm having trouble reimplement createWindow.

    An example of this is that I also tried Qfuture::run", however when passing the QWebpage for createWindow he hangs anyway. I believe I have to reimplement createWindow with Qfuture.

    How could I reimplement createWindow (or QWebPage, QWebFrame, etc.) with functions like Thread (To do something like the thread) ?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: window freeze

    I have no idea what you are trying to do. Why do you wish to reimplement createWindow()?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2013
    Posts
    65
    Thanks
    4
    Thanked 3 Times in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: window freeze

    Thanks for the help and the quick response.

    I have no idea what you are trying to do. Why do you wish to reimplement createWindow()?
    Every time I click an anchor with target="_blank" (or run the window.open) the QWebPage performing QWebPage::createWindow.

    The QWebPage::createWindow need to get the new QWebPage who will receive the target="_blank" (or target="name").

    But to send to send a page that can freeze, it also ends up freezing the window PARENT and other windows created by QWebPage::createWindow.

    I need to isolate the QWebPage but without affecting the functionality of the targets, window.opener and parent.window.

    The only browser I've seen that works this way is the Google Chrome, if one tab has a Javascript that cause freezing, only the tab (or window) freezes, the other tabs work normally (the other tabs and windows do not freeze).
    Last edited by brcontainer; 17th May 2013 at 15:42. Reason: improved

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: window freeze

    createWindow() returns a QWebView and not QWebPage.

    Chrome does out-of-process handling of web pages thus if one page locks the whole process, other pages can continue because they have their own processes.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Apr 2013
    Posts
    65
    Thanks
    4
    Thanked 3 Times in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Question Re: window freeze

    Thanks again for the quick response.

    Quote Originally Posted by wysota View Post
    createWindow() returns a QWebView and not QWebPage.
    both QWebVieW as Qwebpage has createWindow ( http://qt-project.org/doc/qt-4.8/qwe...cted-functions )

    Example:
    Qt Code:
    1. class myWebPage : public QWebPage {
    2. protected:
    3. virtual QString userAgentForUrl(const QUrl & url) const {
    4. Q_UNUSED(url);
    5. return UA;
    6. }
    7.  
    8. QWebPage * createWindow(QWebPage::WebWindowType type) {
    9. return new QWebPage;
    10. }
    11. };
    To copy to clipboard, switch view to plain text mode 

    Quote Originally Posted by wysota View Post
    Chrome does out-of-process handling of web pages thus if one page locks the whole process, other pages can continue because they have their own processes.
    I know that, but I just used it as an example for you to understand. I wonder if it has something to do with Qt?

    Could you help me with this? Thanks
    Last edited by brcontainer; 17th May 2013 at 17:57.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: window freeze

    If you state your problem clearly then maybe someone can help. As I said, JavaScript alone will not freeze your browser as it is periodically interrupted so that the browser can process its events. When QtWebKit detects a long running script, it will pop up a window asking whether you want to abort the script or not.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Apr 2013
    Posts
    65
    Thanks
    4
    Thanked 3 Times in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Question Re: window freeze

    Quote Originally Posted by wysota View Post
    If you state your problem clearly then maybe someone can help. As I said, JavaScript alone will not freeze your browser as it is periodically interrupted so that the browser can process its events. When QtWebKit detects a long running script, it will pop up a window asking whether you want to abort the script or not.
    test my app (open-source QT5):
    http://www.mediafire.com/download.php?85zm06bvwv9lyow

    Note that clicking on anchor test Freeze all application windows freeze.

    I need the window open for anchor "test Freeze" freezes and that the other windows continue to work normally (without freezing).

    I wonder if you could help me?
    Thanks.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: window freeze

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Apr 2013
    Posts
    65
    Thanks
    4
    Thanked 3 Times in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Question Re: window freeze

    Quote Originally Posted by wysota View Post
    Hello @wysota
    I appreciate your attempt to help me, but it does have to do with my question.

    And I'm not the problem JavaScript engine, I just want to separate the "QWebView" into something like multi-processes (eg. QFuture, QThread, etc.).

    I'll try to be more simple and clear in the question:
    How to separate the QWebView (or QwebPage, QWebFrame, etc.) into something like multi-processes (eg. QFuture, QThread, etc.)?

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: window freeze

    Quote Originally Posted by brcontainer View Post
    And I'm not the problem JavaScript engine, I just want to separate the "QWebView" into something like multi-processes (eg. QFuture, QThread, etc.).
    QFuture and QThread have nothing to do with multi-processing. If you want multiprocessing then you need to implement a master process that will act as a container for all the pages and you need to implement the slave that will let itself be embedded into the master process. There is nothing in Qt that can help you with that directly. It is not something that you can do in 10 minutes. If you want, have a look at Chromium sources.

    Edit: here is something that might help you: http://blog.chromium.org/2008/09/mul...hitecture.html
    Last edited by wysota; 18th May 2013 at 15:20.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    Apr 2013
    Posts
    65
    Thanks
    4
    Thanked 3 Times in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: window freeze

    Quote Originally Posted by wysota View Post
    QFuture and QThread have nothing to do with multi-processing. If you want multiprocessing then you need to implement a master process that will act as a container for all the pages and you need to implement the slave that will let itself be embedded into the master process. There is nothing in Qt that can help you with that directly. It is not something that you can do in 10 minutes. If you want, have a look at Chromium sources.
    I could use QFuture with QWebPage::acceptNavigationRequest, the problem is that I want to do this with QWebPage::createWindow, but I do not know how to "rewrite" the QWebPage::createWindow to work with QFuture.

    See what I got:
    Qt Code:
    1. class myWebPage : public QWebPage
    2. {
    3. QWebPage *p;
    4. void Test(const QUrl & url){
    5. QWebView *p = new QWebView;
    6. p->show();
    7. p->setUrl(url);
    8. }
    9.  
    10. bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type) {
    11. QUrl url = request.url();
    12. if(parentFrame==false){
    13. firstFrame = frame;
    14. parentFrame = true;
    15. } else {
    16. if(frame != firstFrame){
    17. QtConcurrent::run(this,&myWebPage::Teste,url);
    18. }
    19. }
    20. return QWebPage::acceptNavigationRequest(frame,request,type);
    21. }
    22. };
    To copy to clipboard, switch view to plain text mode 

    This code works with target="" but does not work with window.open, so I need to understand how to rewrite the QWebPage::createWindow

    Could you help me with this?

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: window freeze

    Quote Originally Posted by brcontainer View Post
    I could use QFuture with QWebPage::acceptNavigationRequest, the problem is that I want to do this with QWebPage::createWindow, but I do not know how to "rewrite" the QWebPage::createWindow to work with QFuture.
    It won't work because all GUI-related work has to be done in the same thread. Thus QWebPage and its related QWebView have to live in the same thread and QWebView and all the other webviews have to live in the same thread. Thus all pages and all views have to live in the same thread. Hence freezing one will freeze them all. Multiprocessing is the only possible solution here and as I already said this can't be done by reimplementing one or two virtual methods here and there.

    I'm afraid fixing the bug I mentioned and which you said did not relate to your problem is your only possible solution now short of reimplementing Chromium
    Last edited by wysota; 18th May 2013 at 22:01.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QSerialDevice cause GUI to freeze
    By dkoryagin in forum Qt Programming
    Replies: 2
    Last Post: 26th September 2010, 17:13
  2. window refresh freeze
    By jhowland in forum Qt Programming
    Replies: 1
    Last Post: 22nd February 2010, 07:58
  3. Thread,GUI Freeze
    By darshan in forum Qt Programming
    Replies: 2
    Last Post: 25th February 2009, 20:17
  4. Qt4.2.2: Application freeze
    By arunvv in forum Newbie
    Replies: 1
    Last Post: 9th September 2008, 21:16
  5. QThread , GUI freeze
    By cs_raja in forum Qt Programming
    Replies: 4
    Last Post: 19th November 2006, 10:47

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.