Chromium Embedded Framework (CEF)  131.2.1+ge081753+chromium-131.0.6778.13
CefThread Class Referenceabstract

A simple thread abstraction that establishes a message loop on a new thread. More...

#include "include/cef_thread.h"

Inheritance diagram for CefThread:
CefBaseRefCounted

Public Member Functions

virtual CefRefPtr< CefTaskRunnerGetTaskRunner ()=0
 Returns the CefTaskRunner that will execute code on this thread's message loop. More...
 
virtual cef_platform_thread_id_t GetPlatformThreadId ()=0
 Returns the platform thread ID. More...
 
virtual void Stop ()=0
 Stop and join the thread. More...
 
virtual bool IsRunning ()=0
 Returns true if the thread is currently running. More...
 
- Public Member Functions inherited from CefBaseRefCounted
virtual void AddRef () const =0
 Called to increment the reference count for the object. More...
 
virtual bool Release () const =0
 Called to decrement the reference count for the object. More...
 
virtual bool HasOneRef () const =0
 Returns true if the reference count is 1. More...
 
virtual bool HasAtLeastOneRef () const =0
 Returns true if the reference count is at least 1. More...
 

Static Public Member Functions

static CefRefPtr< CefThreadCreateThread (const CefString &display_name, cef_thread_priority_t priority, cef_message_loop_type_t message_loop_type, bool stoppable, cef_com_init_mode_t com_init_mode)
 Create and start a new thread. More...
 
static CefRefPtr< CefThreadCreateThread (const CefString &display_name)
 Create and start a new thread with default/recommended values. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CefBaseRefCounted
virtual ~CefBaseRefCounted ()
 

Detailed Description

A simple thread abstraction that establishes a message loop on a new thread.

The consumer uses CefTaskRunner to execute code on the thread's message loop. The thread is terminated when the CefThread object is destroyed or Stop() is called. All pending tasks queued on the thread's message loop will run to completion before the thread is terminated. CreateThread() can be called on any valid CEF thread in either the browser or render process. This class should only be used for tasks that require a dedicated thread. In most cases you can post tasks to an existing CEF thread instead of creating a new one; see cef_task.h for details.

Member Function Documentation

◆ CreateThread() [1/2]

static CefRefPtr<CefThread> CefThread::CreateThread ( const CefString display_name)
inlinestatic

Create and start a new thread with default/recommended values.

|display_name| is the name that will be used to identify the thread.

◆ CreateThread() [2/2]

static CefRefPtr<CefThread> CefThread::CreateThread ( const CefString display_name,
cef_thread_priority_t  priority,
cef_message_loop_type_t  message_loop_type,
bool  stoppable,
cef_com_init_mode_t  com_init_mode 
)
static

Create and start a new thread.

This method does not block waiting for the thread to run initialization. |display_name| is the name that will be used to identify the thread. |priority| is the thread execution priority. |message_loop_type| indicates the set of asynchronous events that the thread can process. If |stoppable| is true the thread will stopped and joined on destruction or when Stop() is called; otherwise, the thread cannot be stopped and will be leaked on shutdown. On Windows the |com_init_mode| value specifies how COM will be initialized for the thread. If |com_init_mode| is set to COM_INIT_MODE_STA then |message_loop_type| must be set to ML_TYPE_UI.

◆ GetPlatformThreadId()

virtual cef_platform_thread_id_t CefThread::GetPlatformThreadId ( )
pure virtual

Returns the platform thread ID.

It will return the same value after Stop() is called. This method is safe to call from any thread.

◆ GetTaskRunner()

virtual CefRefPtr<CefTaskRunner> CefThread::GetTaskRunner ( )
pure virtual

Returns the CefTaskRunner that will execute code on this thread's message loop.

This method is safe to call from any thread.

◆ IsRunning()

virtual bool CefThread::IsRunning ( )
pure virtual

Returns true if the thread is currently running.

This method must be called from the same thread that called CreateThread().

◆ Stop()

virtual void CefThread::Stop ( )
pure virtual

Stop and join the thread.

This method must be called from the same thread that called CreateThread(). Do not call this method if CreateThread() was called with a |stoppable| value of false.


The documentation for this class was generated from the following file: