Add web worker stub implementation to avoid crash (issue #138).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@133 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
a86735b71e
commit
eaf976875f
1
cef.gyp
1
cef.gyp
|
@ -405,6 +405,7 @@
|
|||
'libcef/browser_resource_loader_bridge.h',
|
||||
'libcef/browser_socket_stream_bridge.cc',
|
||||
'libcef/browser_socket_stream_bridge.h',
|
||||
'libcef/browser_web_worker.h',
|
||||
'libcef/browser_webcookiejar_impl.cc',
|
||||
'libcef/browser_webcookiejar_impl.h',
|
||||
'libcef/browser_webblobregistry_impl.cc',
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef BROWSER_WEB_WORKER_H_
|
||||
#define BROWSER_WEB_WORKER_H_
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/ref_counted.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebMessagePortChannel.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebWorker.h"
|
||||
#include "third_party/WebKit/WebKit/chromium/public/WebWorkerClient.h"
|
||||
|
||||
namespace WebKit {
|
||||
class WebApplicationCacheHost;
|
||||
class WebApplicationCacheHostClient;
|
||||
class WebFrame;
|
||||
class WebNotificationPresenter;
|
||||
class WebString;
|
||||
class WebURL;
|
||||
}
|
||||
|
||||
// WebWorkers are not currently functional in CEF. This class effectively
|
||||
// stubs things out.
|
||||
class BrowserWebWorker : public WebKit::WebWorker,
|
||||
public WebKit::WebWorkerClient,
|
||||
public base::RefCounted<BrowserWebWorker> {
|
||||
public:
|
||||
BrowserWebWorker() {
|
||||
AddRef(); // Adds the reference held for worker object.
|
||||
AddRef(); // Adds the reference held for worker context object.
|
||||
}
|
||||
|
||||
// WebWorker methods:
|
||||
virtual void startWorkerContext(const WebKit::WebURL& script_url,
|
||||
const WebKit::WebString& user_agent,
|
||||
const WebKit::WebString& source_code) {
|
||||
}
|
||||
virtual void terminateWorkerContext() {
|
||||
}
|
||||
virtual void postMessageToWorkerContext(
|
||||
const WebKit::WebString& message,
|
||||
const WebKit::WebMessagePortChannelArray& channel) {
|
||||
}
|
||||
virtual void workerObjectDestroyed() {
|
||||
Release(); // Releases the reference held for worker object.
|
||||
}
|
||||
virtual void clientDestroyed() {
|
||||
}
|
||||
|
||||
// WebWorkerClient methods:
|
||||
virtual void postMessageToWorkerObject(
|
||||
const WebKit::WebString& message,
|
||||
const WebKit::WebMessagePortChannelArray& channel) {
|
||||
}
|
||||
virtual void postExceptionToWorkerObject(
|
||||
const WebKit::WebString& error_message,
|
||||
int line_number,
|
||||
const WebKit::WebString& source_url) {
|
||||
}
|
||||
virtual void postConsoleMessageToWorkerObject(
|
||||
int destination_id,
|
||||
int source_id,
|
||||
int message_type,
|
||||
int message_level,
|
||||
const WebKit::WebString& message,
|
||||
int line_number,
|
||||
const WebKit::WebString& source_url) {
|
||||
}
|
||||
virtual void confirmMessageFromWorkerObject(bool has_pending_activity) { }
|
||||
virtual void reportPendingActivity(bool has_pending_activity) { }
|
||||
virtual void workerContextClosed() { }
|
||||
virtual void workerContextDestroyed() {
|
||||
Release(); // Releases the reference held for worker context object.
|
||||
}
|
||||
virtual WebKit::WebWorker* createWorker(WebKit::WebWorkerClient* client) {
|
||||
return NULL;
|
||||
}
|
||||
virtual WebKit::WebNotificationPresenter* notificationPresenter() {
|
||||
return NULL;
|
||||
}
|
||||
virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
|
||||
WebKit::WebApplicationCacheHostClient*) {
|
||||
return NULL;
|
||||
}
|
||||
virtual bool allowDatabase(WebKit::WebFrame* frame,
|
||||
const WebKit::WebString& name,
|
||||
const WebKit::WebString& display_name,
|
||||
unsigned long estimated_size) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class base::RefCounted<BrowserWebWorker>;
|
||||
|
||||
~BrowserWebWorker() {}
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(BrowserWebWorker);
|
||||
};
|
||||
|
||||
#endif // BROWSER_WEB_WORKER_H_
|
|
@ -11,6 +11,7 @@
|
|||
#include "browser_appcache_system.h"
|
||||
#include "browser_impl.h"
|
||||
#include "browser_navigation_controller.h"
|
||||
#include "browser_web_worker.h"
|
||||
#include "cef_context.h"
|
||||
#include "request_impl.h"
|
||||
#include "v8_impl.h"
|
||||
|
@ -527,6 +528,11 @@ WebPlugin* BrowserWebViewDelegate::createPlugin(
|
|||
frame, params, info.path, actual_mime_type, AsWeakPtr());
|
||||
}
|
||||
|
||||
WebWorker* BrowserWebViewDelegate::createWorker(
|
||||
WebFrame* frame, WebWorkerClient* client) {
|
||||
return new BrowserWebWorker();
|
||||
}
|
||||
|
||||
WebMediaPlayer* BrowserWebViewDelegate::createMediaPlayer(
|
||||
WebFrame* frame, WebMediaPlayerClient* client) {
|
||||
media::MediaFilterCollection collection;
|
||||
|
|
|
@ -132,6 +132,8 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||
// WebKit::WebFrameClient
|
||||
virtual WebKit::WebPlugin* createPlugin(
|
||||
WebKit::WebFrame*, const WebKit::WebPluginParams&);
|
||||
virtual WebKit::WebWorker* createWorker(
|
||||
WebKit::WebFrame*, WebKit::WebWorkerClient*);
|
||||
virtual WebKit::WebMediaPlayer* createMediaPlayer(
|
||||
WebKit::WebFrame*, WebKit::WebMediaPlayerClient*);
|
||||
virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
|
||||
|
|
Loading…
Reference in New Issue