Support custom V8 bindings on WebWorker threads (issue #451).

- Add CefRenderProcessHandler callbacks for WebWorker context creation, release and uncaught exceptions.
- Add CefTaskRunner class that supports posting of tasks to standard threads and WebWorker threads.
- Organize V8 internal state information on a per-thread/per-Isolate basis.
- Add webkit_451.patch that provides the WebKit implementation.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@972 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2013-01-03 17:24:24 +00:00
parent f30fbb3d48
commit afe3cb1d67
44 changed files with 2434 additions and 406 deletions

View File

@ -47,7 +47,8 @@ extern "C" {
///
// Structure used to implement render process callbacks. The functions of this
// structure will always be called on the render process main thread.
// structure will be called on the render process main thread (TID_RENDERER)
// unless otherwise indicated.
///
typedef struct _cef_render_process_handler_t {
///
@ -101,7 +102,10 @@ typedef struct _cef_render_process_handler_t {
///
// Called immediately after the V8 context for a frame has been created. To
// retrieve the JavaScript 'window' object use the
// cef_v8context_t::get_global() function.
// cef_v8context_t::get_global() function. V8 handles can only be accessed
// from the thread on which they are created. A task runner for posting tasks
// on the associated thread can be retrieved via the
// cef_v8context_t::get_task_runner() function.
///
void (CEF_CALLBACK *on_context_created)(
struct _cef_render_process_handler_t* self,
@ -118,8 +122,8 @@ typedef struct _cef_render_process_handler_t {
struct _cef_v8context_t* context);
///
// Called for global uncaught exceptions. Execution of this callback is
// disabled by default. To enable set
// Called for global uncaught exceptions in a frame. Execution of this
// callback is disabled by default. To enable set
// CefSettings.uncaught_exception_stack_size > 0.
///
void (CEF_CALLBACK *on_uncaught_exception)(
@ -128,6 +132,39 @@ typedef struct _cef_render_process_handler_t {
struct _cef_v8context_t* context, struct _cef_v8exception_t* exception,
struct _cef_v8stack_trace_t* stackTrace);
///
// Called on the WebWorker thread immediately after the V8 context for a new
// WebWorker has been created. To retrieve the JavaScript 'self' object use
// the cef_v8context_t::get_global() function. V8 handles can only be accessed
// from the thread on which they are created. A task runner for posting tasks
// on the associated thread can be retrieved via the
// cef_v8context_t::get_task_runner() function.
///
void (CEF_CALLBACK *on_worker_context_created)(
struct _cef_render_process_handler_t* self, int worker_id,
const cef_string_t* url, struct _cef_v8context_t* context);
///
// Called on the WebWorker thread immediately before the V8 context for a
// WebWorker is released. No references to the context should be kept after
// this function is called. Any tasks posted or pending on the WebWorker
// thread after this function is called may not be executed.
///
void (CEF_CALLBACK *on_worker_context_released)(
struct _cef_render_process_handler_t* self, int worker_id,
const cef_string_t* url, struct _cef_v8context_t* context);
///
// Called on the WebWorker thread for global uncaught exceptions in a
// WebWorker. Execution of this callback is disabled by default. To enable set
// CefSettings.uncaught_exception_stack_size > 0.
///
void (CEF_CALLBACK *on_worker_uncaught_exception)(
struct _cef_render_process_handler_t* self, int worker_id,
const cef_string_t* url, struct _cef_v8context_t* context,
struct _cef_v8exception_t* exception,
struct _cef_v8stack_trace_t* stackTrace);
///
// Called when a new node in the the browser gets focus. The |node| value may
// be NULL if no specific node has gained focus. The node object passed to