mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-03 12:37:36 +01:00
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:
parent
08fcdfc9d1
commit
fe80635c69
@ -122,6 +122,14 @@ void CefDoMessageLoopWork();
|
||||
/*--cef()--*/
|
||||
void CefRunMessageLoop();
|
||||
|
||||
///
|
||||
// Quit the CEF message loop that was started by calling CefRunMessageLoop().
|
||||
// This function should only be called on the main application thread and only
|
||||
// if CefRunMessageLoop() was used.
|
||||
///
|
||||
/*--cef()--*/
|
||||
void CefQuitMessageLoop();
|
||||
|
||||
///
|
||||
// Register a new V8 extension with the specified JavaScript extension code and
|
||||
// handler. Functions implemented by the handler are prototyped using the
|
||||
|
@ -84,6 +84,13 @@ CEF_EXPORT void cef_do_message_loop_work();
|
||||
///
|
||||
CEF_EXPORT void cef_run_message_loop();
|
||||
|
||||
///
|
||||
// Quit the CEF message loop that was started by calling cef_run_message_loop().
|
||||
// This function should only be called on the main application thread and only
|
||||
// if cef_run_message_loop() was used.
|
||||
///
|
||||
CEF_EXPORT void cef_quit_message_loop();
|
||||
|
||||
///
|
||||
// Register a new V8 extension with the specified JavaScript extension code and
|
||||
// handler. Functions implemented by the handler are prototyped using the
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -166,6 +166,15 @@ CEF_EXPORT void cef_run_message_loop()
|
||||
}
|
||||
|
||||
|
||||
CEF_EXPORT void cef_quit_message_loop()
|
||||
{
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
CefQuitMessageLoop();
|
||||
}
|
||||
|
||||
|
||||
CEF_EXPORT int cef_register_extension(const cef_string_t* extension_name,
|
||||
const cef_string_t* javascript_code, struct _cef_v8handler_t* handler)
|
||||
{
|
||||
|
@ -168,6 +168,15 @@ CEF_GLOBAL void CefRunMessageLoop()
|
||||
}
|
||||
|
||||
|
||||
CEF_GLOBAL void CefQuitMessageLoop()
|
||||
{
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_quit_message_loop();
|
||||
}
|
||||
|
||||
|
||||
CEF_GLOBAL bool CefRegisterExtension(const CefString& extension_name,
|
||||
const CefString& javascript_code, CefRefPtr<CefV8Handler> handler)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user