Inject $native into WebWorker contexts

This is just to make sure it works. Will inject the remaining extensions
when they are converted to from v8 extensions to context bindings.
This commit is contained in:
Corey Johnson & Nathan Sobo 2013-01-23 12:55:59 -07:00 committed by Kevin Sawicki
parent faaaaec846
commit 47420c2e01
2 changed files with 36 additions and 1 deletions

View File

@ -16,7 +16,18 @@ class AtomCefRenderProcessHandler : public CefRenderProcessHandler {
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
CefProcessId source_process, CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) OVERRIDE; CefRefPtr<CefProcessMessage> message) OVERRIDE;
virtual void OnWorkerContextCreated(int worker_id,
const CefString& url,
CefRefPtr<CefV8Context> context) OVERRIDE;
virtual void OnWorkerContextReleased(int worker_id,
const CefString& url,
CefRefPtr<CefV8Context> context) OVERRIDE;
virtual void OnWorkerUncaughtException(int worker_id,
const CefString& url,
CefRefPtr<CefV8Context> context,
CefRefPtr<CefV8Exception> exception,
CefRefPtr<CefV8StackTrace> stackTrace) OVERRIDE;
void Reload(CefRefPtr<CefBrowser> browser); void Reload(CefRefPtr<CefBrowser> browser);
void Shutdown(CefRefPtr<CefBrowser> browser); void Shutdown(CefRefPtr<CefBrowser> browser);
bool CallMessageReceivedHandler(CefRefPtr<CefV8Context> context, CefRefPtr<CefProcessMessage> message); bool CallMessageReceivedHandler(CefRefPtr<CefV8Context> context, CefRefPtr<CefProcessMessage> message);

View File

@ -29,6 +29,30 @@ void AtomCefRenderProcessHandler::OnContextReleased(CefRefPtr<CefBrowser> browse
[PathWatcher removePathWatcherForContext:context]; [PathWatcher removePathWatcherForContext:context];
} }
void AtomCefRenderProcessHandler::OnWorkerContextCreated(int worker_id,
const CefString& url,
CefRefPtr<CefV8Context> context) {
v8_extensions::Native::CreateContextBinding(context);
}
void AtomCefRenderProcessHandler::OnWorkerContextReleased(int worker_id,
const CefString& url,
CefRefPtr<CefV8Context> context) {
NSLog(@"Web worker context released");
}
void AtomCefRenderProcessHandler::OnWorkerUncaughtException(int worker_id,
const CefString& url,
CefRefPtr<CefV8Context> context,
CefRefPtr<CefV8Exception> exception,
CefRefPtr<CefV8StackTrace> stackTrace) {
std::string message = exception->GetMessage().ToString();
NSLog(@"Exception throw in worker thread %s", message.c_str());
}
bool AtomCefRenderProcessHandler::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, bool AtomCefRenderProcessHandler::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
CefProcessId source_process, CefProcessId source_process,
CefRefPtr<CefProcessMessage> message) { CefRefPtr<CefProcessMessage> message) {