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

@ -1,4 +1,4 @@
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
// Copyright (c) 2013 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@ -48,7 +48,8 @@
///
// Class used to implement render process callbacks. The methods of this class
// will always be called on the render process main thread.
// will be called on the render process main thread (TID_RENDERER) unless
// otherwise indicated.
///
/*--cef(source=client)--*/
class CefRenderProcessHandler : public virtual CefBase {
@ -99,7 +100,9 @@ class CefRenderProcessHandler : public virtual CefBase {
///
// Called immediately after the V8 context for a frame has been created. To
// retrieve the JavaScript 'window' object use the CefV8Context::GetGlobal()
// method.
// method. 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 CefV8Context::GetTaskRunner() method.
///
/*--cef()--*/
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
@ -116,8 +119,8 @@ class CefRenderProcessHandler : public virtual CefBase {
CefRefPtr<CefV8Context> 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.
///
/*--cef()--*/
@ -127,6 +130,43 @@ class CefRenderProcessHandler : public virtual CefBase {
CefRefPtr<CefV8Exception> exception,
CefRefPtr<CefV8StackTrace> 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 CefV8Context::GetGlobal() method. 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
// CefV8Context::GetTaskRunner() method.
///
/*--cef()--*/
virtual void OnWorkerContextCreated(int worker_id,
const CefString& url,
CefRefPtr<CefV8Context> 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 method is called. Any tasks posted or pending on the WebWorker
// thread after this method is called may not be executed.
///
/*--cef()--*/
virtual void OnWorkerContextReleased(int worker_id,
const CefString& url,
CefRefPtr<CefV8Context> 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.
///
/*--cef()--*/
virtual void OnWorkerUncaughtException(
int worker_id,
const CefString& url,
CefRefPtr<CefV8Context> context,
CefRefPtr<CefV8Exception> exception,
CefRefPtr<CefV8StackTrace> stackTrace) {}
///
// Called when a new node in the the browser gets focus. The |node| value may
// be empty if no specific node has gained focus. The node object passed to