cefclient: Use an abstraction for message loop functionality (Run/Quit/PostTask) instead of implementing the same logic multiple times in platform-specific files (issue #1500).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1982 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2015-01-22 17:55:55 +00:00
parent 4bf08b70d6
commit 249ad7f6e4
12 changed files with 586 additions and 86 deletions

View File

@@ -25,6 +25,7 @@
#include "cefclient/cefclient_osr_widget_gtk.h"
#include "cefclient/client_handler.h"
#include "cefclient/client_switches.h"
#include "cefclient/main_message_loop_std.h"
#include "cefclient/scheme_test.h"
#include "cefclient/string_util.h"
@@ -453,6 +454,10 @@ int main(int argc, char* argv[]) {
XSetErrorHandler(XErrorHandlerImpl);
XSetIOErrorHandler(XIOErrorHandlerImpl);
// Create the main message loop object.
scoped_ptr<client::MainMessageLoop> message_loop(
new client::MainMessageLoopStd);
// Initialize CEF.
CefInitialize(main_args, settings, app.get(), NULL);
@@ -582,11 +587,16 @@ int main(int argc, char* argv[]) {
signal(SIGINT, TerminationSignalHandler);
signal(SIGTERM, TerminationSignalHandler);
CefRunMessageLoop();
// Run the message loop. This will block until Quit() is called.
int result = message_loop->Run();
// Shut down CEF.
CefShutdown();
return 0;
// Release the |message_loop| object.
message_loop.reset();
return result;
}
// Global functions
@@ -596,5 +606,5 @@ std::string AppGetWorkingDirectory() {
}
void AppQuitMessageLoop() {
CefQuitMessageLoop();
client::MainMessageLoop::Get()->Quit();
}