summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-24 20:22:43 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-24 20:22:43 +0000
commit27ba8536c70127d3367f4609cb0ee1e65944ae20 (patch)
treef004485d299b52c673acece6b0e5ca90f5273f3d /chrome
parent9c16251546f278a3b804dd2034f29234f6354a09 (diff)
downloadchromium_src-27ba8536c70127d3367f4609cb0ee1e65944ae20.zip
chromium_src-27ba8536c70127d3367f4609cb0ee1e65944ae20.tar.gz
chromium_src-27ba8536c70127d3367f4609cb0ee1e65944ae20.tar.bz2
Use WebWorker and WebWorkerClient from the WebKit API.
BUG=10995 R=jam Review URL: http://codereview.chromium.org/92144 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14461 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/renderer/render_view.cc2
-rw-r--r--chrome/renderer/render_view.h2
-rw-r--r--chrome/renderer/webworker_proxy.cc35
-rw-r--r--chrome/renderer/webworker_proxy.h22
-rw-r--r--chrome/worker/webworkerclient_proxy.cc38
-rw-r--r--chrome/worker/webworkerclient_proxy.h32
6 files changed, 72 insertions, 59 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index f8063d5..431deac 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -97,6 +97,8 @@ using WebKit::WebConsoleMessage;
using WebKit::WebDragData;
using WebKit::WebRect;
using WebKit::WebScriptSource;
+using WebKit::WebWorker;
+using WebKit::WebWorkerClient;
//-----------------------------------------------------------------------------
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 2bf2dee..3153ad2 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -245,7 +245,7 @@ class RenderView : public RenderWidget,
const std::string& mime_type,
const std::string& clsid,
std::string* actual_mime_type);
- virtual WebWorker* CreateWebWorker(WebWorkerClient* client);
+ virtual WebKit::WebWorker* CreateWebWorker(WebKit::WebWorkerClient* client);
virtual webkit_glue::WebMediaPlayerDelegate* CreateMediaPlayerDelegate();
virtual void OnMissingPluginStatus(WebPluginDelegate* delegate, int status);
virtual void OpenURL(WebView* webview, const GURL& url,
diff --git a/chrome/renderer/webworker_proxy.cc b/chrome/renderer/webworker_proxy.cc
index 43ff9f5..5e553a2 100644
--- a/chrome/renderer/webworker_proxy.cc
+++ b/chrome/renderer/webworker_proxy.cc
@@ -7,7 +7,12 @@
#include "chrome/common/render_messages.h"
#include "chrome/common/worker_messages.h"
#include "chrome/renderer/render_thread.h"
-#include "webkit/glue/webworkerclient.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebWorkerClient.h"
+
+using WebKit::WebString;
+using WebKit::WebURL;
+using WebKit::WebWorkerClient;
WebWorkerProxy::WebWorkerProxy(
WebWorkerClient* client,
@@ -20,10 +25,10 @@ WebWorkerProxy::WebWorkerProxy(
WebWorkerProxy::~WebWorkerProxy() {
}
-void WebWorkerProxy::StartWorkerContext(
- const GURL& script_url,
- const string16& user_agent,
- const string16& source_code) {
+void WebWorkerProxy::startWorkerContext(
+ const WebURL& script_url,
+ const WebString& user_agent,
+ const WebString& source_code) {
RenderThread::current()->Send(
new ViewHostMsg_CreateDedicatedWorker(
script_url, render_view_route_id_, &route_id_));
@@ -41,7 +46,7 @@ void WebWorkerProxy::StartWorkerContext(
queued_messages_.clear();
}
-void WebWorkerProxy::TerminateWorkerContext() {
+void WebWorkerProxy::terminateWorkerContext() {
if (route_id_ != MSG_ROUTING_NONE) {
Send(new WorkerMsg_TerminateWorkerContext(route_id_));
RenderThread::current()->RemoveRoute(route_id_);
@@ -49,12 +54,12 @@ void WebWorkerProxy::TerminateWorkerContext() {
}
}
-void WebWorkerProxy::PostMessageToWorkerContext(
- const string16& message) {
+void WebWorkerProxy::postMessageToWorkerContext(
+ const WebString& message) {
Send(new WorkerMsg_PostMessageToWorkerContext(route_id_, message));
}
-void WebWorkerProxy::WorkerObjectDestroyed() {
+void WebWorkerProxy::workerObjectDestroyed() {
client_ = NULL;
Send(new WorkerMsg_WorkerObjectDestroyed(route_id_));
}
@@ -80,21 +85,21 @@ void WebWorkerProxy::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(WebWorkerProxy, message)
IPC_MESSAGE_FORWARD(WorkerHostMsg_PostMessageToWorkerObject,
client_,
- WebWorkerClient::PostMessageToWorkerObject)
+ WebWorkerClient::postMessageToWorkerObject)
IPC_MESSAGE_FORWARD(WorkerHostMsg_PostExceptionToWorkerObject,
client_,
- WebWorkerClient::PostExceptionToWorkerObject)
+ WebWorkerClient::postExceptionToWorkerObject)
IPC_MESSAGE_FORWARD(WorkerHostMsg_PostConsoleMessageToWorkerObject,
client_,
- WebWorkerClient::PostConsoleMessageToWorkerObject)
+ WebWorkerClient::postConsoleMessageToWorkerObject)
IPC_MESSAGE_FORWARD(WorkerHostMsg_ConfirmMessageFromWorkerObject,
client_,
- WebWorkerClient::ConfirmMessageFromWorkerObject)
+ WebWorkerClient::confirmMessageFromWorkerObject)
IPC_MESSAGE_FORWARD(WorkerHostMsg_ReportPendingActivity,
client_,
- WebWorkerClient::ReportPendingActivity)
+ WebWorkerClient::reportPendingActivity)
IPC_MESSAGE_FORWARD(WorkerHostMsg_WorkerContextDestroyed,
client_,
- WebWorkerClient::WorkerContextDestroyed)
+ WebWorkerClient::workerContextDestroyed)
IPC_END_MESSAGE_MAP()
}
diff --git a/chrome/renderer/webworker_proxy.h b/chrome/renderer/webworker_proxy.h
index 94c199d..7bec251 100644
--- a/chrome/renderer/webworker_proxy.h
+++ b/chrome/renderer/webworker_proxy.h
@@ -9,7 +9,7 @@
#include "base/basictypes.h"
#include "chrome/common/ipc_channel.h"
-#include "webkit/glue/webworker.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebWorker.h"
class GURL;
class RenderView;
@@ -23,21 +23,19 @@ class Message;
// dispatched in the worker process by WebWorkerClientProxy. It also receives
// IPC messages from WebWorkerClientProxy which it converts to function calls to
// WebWorkerClient.
-class WebWorkerProxy : public WebWorker,
+class WebWorkerProxy : public WebKit::WebWorker,
public IPC::Channel::Listener {
public:
- WebWorkerProxy(WebWorkerClient* client, int render_view_route_id);
+ WebWorkerProxy(WebKit::WebWorkerClient* client, int render_view_route_id);
virtual ~WebWorkerProxy();
// WebWorker implementation.
- // These functions are called by WebKit (after the data types have been
- // converted by glue code).
- virtual void StartWorkerContext(const GURL& script_url,
- const string16& user_agent,
- const string16& source_code);
- virtual void TerminateWorkerContext();
- virtual void PostMessageToWorkerContext(const string16& message);
- virtual void WorkerObjectDestroyed();
+ 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);
+ virtual void workerObjectDestroyed();
// IPC::Channel::Listener implementation.
void OnMessageReceived(const IPC::Message& message);
@@ -53,7 +51,7 @@ class WebWorkerProxy : public WebWorker,
// Used to communicate to the WebCore::Worker object in response to IPC
// messages.
- WebWorkerClient* client_;
+ WebKit::WebWorkerClient* client_;
// Stores messages that were sent before the StartWorkerContext message.
std::vector<IPC::Message*> queued_messages_;
diff --git a/chrome/worker/webworkerclient_proxy.cc b/chrome/worker/webworkerclient_proxy.cc
index 33bcbc8..fa2bd39 100644
--- a/chrome/worker/webworkerclient_proxy.cc
+++ b/chrome/worker/webworkerclient_proxy.cc
@@ -8,13 +8,18 @@
#include "chrome/common/ipc_logging.h"
#include "chrome/common/worker_messages.h"
#include "chrome/worker/worker_thread.h"
-#include "webkit/glue/webworker.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebWorker.h"
+using WebKit::WebString;
+using WebKit::WebWorker;
+using WebKit::WebWorkerClient;
WebWorkerClientProxy::WebWorkerClientProxy(const GURL& url, int route_id)
: url_(url),
route_id_(route_id),
- ALLOW_THIS_IN_INITIALIZER_LIST(impl_(WebWorker::Create(this))) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(impl_(WebWorker::create(this))) {
AddRef();
WorkerThread::current()->AddRoute(route_id_, this);
ChildProcess::current()->AddRefProcess();
@@ -25,41 +30,42 @@ WebWorkerClientProxy::~WebWorkerClientProxy() {
ChildProcess::current()->ReleaseProcess();
}
-void WebWorkerClientProxy::PostMessageToWorkerObject(const string16& message) {
+void WebWorkerClientProxy::postMessageToWorkerObject(
+ const WebString& message) {
Send(new WorkerHostMsg_PostMessageToWorkerObject(route_id_, message));
}
-void WebWorkerClientProxy::PostExceptionToWorkerObject(
- const string16& error_message,
+void WebWorkerClientProxy::postExceptionToWorkerObject(
+ const WebString& error_message,
int line_number,
- const string16& source_url) {
+ const WebString& source_url) {
Send(new WorkerHostMsg_PostExceptionToWorkerObject(
route_id_, error_message, line_number, source_url));
}
-void WebWorkerClientProxy::PostConsoleMessageToWorkerObject(
+void WebWorkerClientProxy::postConsoleMessageToWorkerObject(
int destination,
int source,
int level,
- const string16& message,
+ const WebString& message,
int line_number,
- const string16& source_url) {
+ const WebString& source_url) {
Send(new WorkerHostMsg_PostConsoleMessageToWorkerObject(
route_id_, destination, source, level,message, line_number, source_url));
}
-void WebWorkerClientProxy::ConfirmMessageFromWorkerObject(
+void WebWorkerClientProxy::confirmMessageFromWorkerObject(
bool has_pending_activity) {
Send(new WorkerHostMsg_ConfirmMessageFromWorkerObject(
route_id_, has_pending_activity));
}
-void WebWorkerClientProxy::ReportPendingActivity(bool has_pending_activity) {
+void WebWorkerClientProxy::reportPendingActivity(bool has_pending_activity) {
Send(new WorkerHostMsg_ReportPendingActivity(
route_id_, has_pending_activity));
}
-void WebWorkerClientProxy::WorkerContextDestroyed() {
+void WebWorkerClientProxy::workerContextDestroyed() {
Send(new WorkerHostMsg_WorkerContextDestroyed(route_id_));
impl_ = NULL;
@@ -82,12 +88,12 @@ void WebWorkerClientProxy::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(WebWorkerClientProxy, message)
IPC_MESSAGE_FORWARD(WorkerMsg_StartWorkerContext, impl_,
- WebWorker::StartWorkerContext)
+ WebWorker::startWorkerContext)
IPC_MESSAGE_FORWARD(WorkerMsg_TerminateWorkerContext, impl_,
- WebWorker::TerminateWorkerContext)
+ WebWorker::terminateWorkerContext)
IPC_MESSAGE_FORWARD(WorkerMsg_PostMessageToWorkerContext, impl_,
- WebWorker::PostMessageToWorkerContext)
+ WebWorker::postMessageToWorkerContext)
IPC_MESSAGE_FORWARD(WorkerMsg_WorkerObjectDestroyed, impl_,
- WebWorker::WorkerObjectDestroyed)
+ WebWorker::workerObjectDestroyed)
IPC_END_MESSAGE_MAP()
}
diff --git a/chrome/worker/webworkerclient_proxy.h b/chrome/worker/webworkerclient_proxy.h
index 31ee56d..f650d58 100644
--- a/chrome/worker/webworkerclient_proxy.h
+++ b/chrome/worker/webworkerclient_proxy.h
@@ -9,40 +9,42 @@
#include "base/ref_counted.h"
#include "chrome/common/ipc_channel.h"
#include "googleurl/src/gurl.h"
-#include "webkit/glue/webworkerclient.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebWorkerClient.h"
+namespace WebKit {
class WebWorker;
+}
// This class receives IPCs from the renderer and calls the WebCore::Worker
// implementation (after the data types have been converted by glue code). It
// is also called by the worker code and converts these function calls into
// IPCs that are sent to the renderer, where they're converted back to function
// calls by WebWorkerProxy.
-class WebWorkerClientProxy : public WebWorkerClient,
+class WebWorkerClientProxy : public WebKit::WebWorkerClient,
public IPC::Channel::Listener,
public base::RefCounted<WebWorkerClientProxy> {
public:
- WebWorkerClientProxy (const GURL& url, int route_id);
+ WebWorkerClientProxy(const GURL& url, int route_id);
// WebWorkerClient implementation.
- void PostMessageToWorkerObject(const string16& message);
- void PostExceptionToWorkerObject(
- const string16& error_message,
+ virtual void postMessageToWorkerObject(const WebKit::WebString& message);
+ virtual void postExceptionToWorkerObject(
+ const WebKit::WebString& error_message,
int line_number,
- const string16& source_url);
- void PostConsoleMessageToWorkerObject(
+ const WebKit::WebString& source_url);
+ virtual void postConsoleMessageToWorkerObject(
int destination,
int source,
int level,
- const string16& message,
+ const WebKit::WebString& message,
int line_number,
- const string16& source_url);
- void ConfirmMessageFromWorkerObject(bool has_pending_activity);
- void ReportPendingActivity(bool has_pending_activity);
- void WorkerContextDestroyed();
+ const WebKit::WebString& source_url);
+ virtual void confirmMessageFromWorkerObject(bool has_pending_activity);
+ virtual void reportPendingActivity(bool has_pending_activity);
+ virtual void workerContextDestroyed();
// IPC::Channel::Listener implementation.
- void OnMessageReceived(const IPC::Message& message);
+ virtual void OnMessageReceived(const IPC::Message& message);
private:
friend class base::RefCounted<WebWorkerClientProxy>;
@@ -55,7 +57,7 @@ class WebWorkerClientProxy : public WebWorkerClient,
int route_id_;
- WebWorker* impl_;
+ WebKit::WebWorker* impl_;
DISALLOW_COPY_AND_ASSIGN(WebWorkerClientProxy);
};