Add CefQuitMessageLoop function (issue #443).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@412 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-12-08 13:25:26 +00:00
parent 08fcdfc9d1
commit fe80635c69
7 changed files with 59 additions and 1 deletions

View File

@@ -421,6 +421,23 @@ void CefRunMessageLoop()
_Context->process()->RunMessageLoop();
}
void CefQuitMessageLoop()
{
// Verify that the context is in a valid state.
if (!CONTEXT_STATE_VALID()) {
NOTREACHED() << "context not valid";
return;
}
// Must always be called on the same thread as Initialize.
if(!_Context->process()->CalledOnValidThread()) {
NOTREACHED() << "called on invalid thread";
return;
}
_Context->process()->QuitMessageLoop();
}
bool CefRegisterPlugin(const CefPluginInfo& plugin_info)
{
// Verify that the context is in a valid state.

View File

@@ -97,6 +97,11 @@ void CefProcess::RunMessageLoop() {
ui_message_loop_->RunMessageLoop();
}
void CefProcess::QuitMessageLoop() {
DCHECK(CalledOnValidThread() && ui_message_loop_.get() != NULL);
ui_message_loop_->Quit();
}
void CefProcess::CreateUIThread() {
DCHECK(!created_ui_thread_ && ui_thread_.get() == NULL);
created_ui_thread_ = true;

View File

@@ -60,9 +60,12 @@ class CefProcess : public base::NonThreadSafe {
// RunMessageLoop() was called you do not need to call this method.
void DoMessageLoopIteration();
// Run the UI message loop for the on the current thread.
// Run the UI message loop on the current thread.
void RunMessageLoop();
// Quit the UI message loop on the current thread.
void QuitMessageLoop();
// Returns the thread that we perform I/O coordination on (network requests,
// communication with renderers, etc.
// NOTE: You should ONLY use this to pass to IPC or other objects which must