Skip to content

Commit

Permalink
Remove threads: TID_DB, TID_CACHE, TID_PROCESS_LAUNCHER and add new (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
cztomczak committed May 25, 2018
1 parent 37fecd8 commit b1769a5
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 18 deletions.
9 changes: 5 additions & 4 deletions api/cefpython.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,12 @@ Post a task for execution on the thread associated with this task runner. Execut

List of threads in the Browser process:
* cef.TID_UI: The main thread in the browser. This will be the same as the main application thread if cefpython.Initialize() is called with a ApplicationSettings.multi_threaded_message_loop value of false. Do not perform blocking tasks on this thread. All tasks posted after CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown() are guaranteed to run. This thread will outlive all other CEF threads.
* cef.TID_DB: Used to interact with the database.
* cef.TID_FILE: Used for blocking tasks (e.g. file system access) where the user won't notice if the task takes an arbitrarily long time to complete. All tasks posted after CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown() are guaranteed to run.
* cef.TID_FILE (alias cef.TID_FILE_BACKGROUND): Used for blocking tasks (e.g. file system access) where the user won't notice if the task takes an arbitrarily long time to complete. All tasks posted after CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown() are guaranteed to run.
* cef.TID_FILE_USER_VISIBLE: Used for blocking tasks (e.g. file system access) that affect UI or responsiveness of future user interactions. Do not use if an immediate response to a user interaction is expected. All tasks posted after CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown() are guaranteed to run. Examples:
- Updating the UI to reflect progress on a long task.
- Loading data that might be shown in the UI after a future user
interaction.
* cef.TID_FILE_USER_BLOCKING: Used for blocking tasks (e.g. file system access) that affect UI immediately after a user interaction. All tasks posted after CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown() are guaranteed to run. Example: Generating data shown in the UI immediately after a click.
* cef.TID_PROCESS_LAUNCHER: Used to launch and terminate browser processes.
* cef.TID_CACHE: Used to handle slow HTTP cache operations.
* cef.TID_IO: Used to process IPC and network messages. Do not perform blocking tasks on this thread. All tasks posted after CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown() are guaranteed to run.

List of threads in the Renderer process:
Expand Down
10 changes: 10 additions & 0 deletions docs/Migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Table of contents:
* [v66+ RequestHandler.OnBeforeBrowse has a new param 'user_gesture'](#v66-requesthandleronbeforebrowse-has-a-new-param-user_gesture)
* [v66+ Window transparency changes](#v66-window-transparency-changes)
* [v66+ BrowserSettings.javascript_open_windows_disallowed option was removed](#v66-browsersettingsjavascript_open_windows_disallowed-option-was-removed)
* [v66+ Threads removed: TID_DB, TID_PROCESS_LAUNCHER, TID_CACHE](#v66-threads-removed-tid_db-tid_process_launcher-tid_cache)



Expand Down Expand Up @@ -351,3 +352,12 @@ only on Linux (got it working on Fedora with just a change in window setting).
The BrowserSettings.`javascript_open_windows_disallowed` option was removed
(setting it will do nothing).


## v66+ Threads removed: TID_DB, TID_PROCESS_LAUNCHER, TID_CACHE

These threads and their corresponding constants in the cefpython module
were removed: TID_DB, TID_PROCESS_LAUNCHER, TID_CACHE.

New threads were added, see cefpython.[PostTask](../api/cefpython.md#posttask)
description for a complete list of threads.

9 changes: 5 additions & 4 deletions src/cef_v59..v66_changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ internal/cef_types.h
- + cef_settings_t:
- + javascript_open_windows option removed (keep a dummy for BC)
- + update Migration Guide
- cef_thread_id_t:
- TID_DB removed (update Migration Guide)
- TID_PROCESS_LAUNCHER removed (update Migration Guide)
- TID_CACHE removed (update Migration Guide)
- + cef_thread_id_t:
- + TID_DB removed (update Migration Guide)
- + TID_PROCESS_LAUNCHER removed (update Migration Guide)
- + TID_CACHE removed (update Migration Guide)
- + Added threads: TID_FILE_BACKGROUND, TID_FILE_USER_VISIBLE


NEW FEATURES
Expand Down
5 changes: 2 additions & 3 deletions src/extern/cef/cef_types.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,10 @@ cdef extern from "include/internal/cef_types.h":

ctypedef enum cef_thread_id_t:
TID_UI,
TID_DB,
TID_FILE_BACKGROUND
TID_FILE,
TID_FILE_USER_VISIBLE
TID_FILE_USER_BLOCKING,
TID_PROCESS_LAUNCHER,
TID_CACHE,
TID_IO,
TID_RENDERER

Expand Down
4 changes: 2 additions & 2 deletions src/task.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def PostTask(int thread, object func, *args):

# Validate threadId.
if thread not in g_browserProcessThreads:
raise Exception("PoastTask failed: requires a browser process thread")
raise Exception("PostTask failed: requires a browser process thread")

# Validate func.
if not IsFunctionOrMethod(type(func)):
Expand All @@ -39,7 +39,7 @@ def PostDelayedTask(int thread, int delay_ms, object func, *args):

# Validate threadId.
if thread not in g_browserProcessThreads:
raise Exception("PoastTask failed: requires a browser process thread")
raise Exception("PostTask failed: requires a browser process thread")

# Validate func.
if not IsFunctionOrMethod(type(func)):
Expand Down
9 changes: 4 additions & 5 deletions src/utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,19 @@ include "cefpython.pyx"
cimport cef_types

TID_UI = cef_types.TID_UI
TID_DB = cef_types.TID_DB
TID_FILE_BACKGROUND = cef_types.TID_FILE_BACKGROUND
TID_FILE = cef_types.TID_FILE
TID_FILE_USER_VISIBLE = cef_types.TID_FILE_USER_VISIBLE
TID_FILE_USER_BLOCKING = cef_types.TID_FILE_USER_BLOCKING
TID_PROCESS_LAUNCHER = cef_types.TID_PROCESS_LAUNCHER
TID_CACHE = cef_types.TID_CACHE
TID_IO = cef_types.TID_IO
TID_RENDERER = cef_types.TID_RENDERER

g_browserProcessThreads = [
TID_UI,
TID_DB,
TID_FILE_BACKGROUND,
TID_FILE,
TID_FILE_USER_VISIBLE
TID_FILE_USER_BLOCKING,
TID_CACHE,
TID_IO,
]

Expand Down

0 comments on commit b1769a5

Please sign in to comment.