Let me first explain this shortly, if the following is too long to read:
When I am currently in the renderer thread, how can I call something that is not meant for the renderer thread ( resulting in the window becoming white and not doing anything )?
I am experimenting with the cefglue demo project. I am using the gtk sharp project ( and the demo project that is used by all the different demo projects that vary on the gui toolkit ).
I spend quite some time to understand the architecture of chromium/the demo project.
For testing purpose I want to move the window to a different location ( or top left for starters ). This can be done with Move(0, 0). I added a static reference to itself in MainViewImpl. So I can access it anywhere with MainViewImpl.instance.
If I call this in the render process, the browser window will become white and nothing will happen.
PostTask can be used to call something on another thread, right?
Another option is to send messages to another thread, right?
I tried using PostTask but it didn't work. The only thing where it is actually executed ( but resulting in the browser window becoming white... ) is the renderer thread: CefThreadId.Renderer.
I tried a static method as a parameter but also with lambda expression ( so I can create a function on the fly ) like this:
- Code: Select all
DemoApp.PostTask(CefThreadId.UI, () => { MainViewImpl.instance.Move(0, 0); });
Another question: The gtk stuff is not running on a cef thread, right? CefTaskRunner.GetForCurrentThread() returns an empty reference in the constructor of MainViewImpl.cs. How can I run things on this (main) thread? With my own loop and a Queue<Action> maybe? So I add something to the queue in the renderer and the main thread sees that the queue isn't empty, so it dequeues the element and invokes it.