summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--DEPS2
-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
-rw-r--r--webkit/glue/webview_delegate.h6
-rw-r--r--webkit/glue/webworker.h31
-rw-r--r--webkit/glue/webworker_impl.cc89
-rw-r--r--webkit/glue/webworker_impl.h52
-rw-r--r--webkit/glue/webworkerclient.h37
-rw-r--r--webkit/glue/webworkerclient_impl.cc73
-rw-r--r--webkit/glue/webworkerclient_impl.h61
-rwxr-xr-xwebkit/tools/test_shell/test_webview_delegate.cc2
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.h2
-rw-r--r--webkit/tools/test_shell/test_webworker_helper.cc4
-rw-r--r--webkit/tools/test_shell/test_webworker_helper.h9
-rw-r--r--webkit/tools/test_shell/test_worker/test_webworker.cc108
-rw-r--r--webkit/tools/test_shell/test_worker/test_webworker.h57
-rw-r--r--webkit/tools/test_shell/test_worker/test_worker_main.cc5
21 files changed, 336 insertions, 333 deletions
diff --git a/DEPS b/DEPS
index d4c9775..da57611 100644
--- a/DEPS
+++ b/DEPS
@@ -19,7 +19,7 @@ deps = {
"http://googletest.googlecode.com/svn/trunk@214",
"src/third_party/WebKit":
- "/trunk/deps/third_party/WebKit@14437",
+ "/trunk/deps/third_party/WebKit@14459",
"src/third_party/icu38":
"/trunk/deps/third_party/icu38@13472",
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);
};
diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h
index d62024f..d2065c5 100644
--- a/webkit/glue/webview_delegate.h
+++ b/webkit/glue/webview_delegate.h
@@ -39,6 +39,8 @@ class WebMediaPlayerDelegate;
namespace WebKit {
class WebDragData;
+class WebWorker;
+class WebWorkerClient;
struct WebPoint;
struct WebRect;
}
@@ -58,8 +60,6 @@ class WebRequest;
class WebResponse;
class WebView;
class WebWidget;
-class WebWorker;
-class WebWorkerClient;
enum NavigationGesture {
NavigationGestureUser, // User initiated navigation/load. This is not
@@ -125,7 +125,7 @@ class WebViewDelegate : virtual public WebWidgetDelegate {
}
// This method is called when the renderer creates a worker object.
- virtual WebWorker* CreateWebWorker(WebWorkerClient* client) {
+ virtual WebKit::WebWorker* CreateWebWorker(WebKit::WebWorkerClient* client) {
return NULL;
}
diff --git a/webkit/glue/webworker.h b/webkit/glue/webworker.h
deleted file mode 100644
index 302fa24..0000000
--- a/webkit/glue/webworker.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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 WEBKIT_GLUE_WEBWORKER_H_
-#define WEBKIT_GLUE_WEBWORKER_H_
-
-#include "base/string16.h"
-
-class GURL;
-class WebWorkerClient;
-
-// This is a version of the WebCore::WorkerContextProxy interface that uses
-// Chrome data types.
-class WebWorker {
- public:
- virtual ~WebWorker() { }
-
- // Creates a WebWorker object that wraps around the WebKit code that implements
- // web workers.
- static WebWorker* Create(WebWorkerClient* client);
-
- virtual void StartWorkerContext(const GURL& script_url,
- const string16& user_agent,
- const string16& source_code) = 0;
- virtual void TerminateWorkerContext() = 0;
- virtual void PostMessageToWorkerContext(const string16& message) = 0;
- virtual void WorkerObjectDestroyed() = 0;
-};
-
-#endif // #ifndef WEBKIT_GLUE_WEBWORKER_H_
diff --git a/webkit/glue/webworker_impl.cc b/webkit/glue/webworker_impl.cc
index 9fdf1fc..a8e461d 100644
--- a/webkit/glue/webworker_impl.cc
+++ b/webkit/glue/webworker_impl.cc
@@ -18,16 +18,25 @@
#include "base/logging.h"
#include "webkit/glue/glue_util.h"
-#include "webkit/glue/webworkerclient.h"
#include "webkit/glue/webworker_impl.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/WebWorkerClient.h"
+using WebKit::WebWorker;
+using WebKit::WebWorkerClient;
+using WebKit::WebString;
+using WebKit::WebURL;
#if ENABLE(WORKERS)
-WebWorker* WebWorker::Create(WebWorkerClient* client) {
+namespace WebKit {
+
+WebWorker* WebWorker::create(WebWorkerClient* client) {
return new WebWorkerImpl(client);
}
+}
// This function is called on the main thread to force to initialize some static
// values used in WebKit before any worker thread is started. This is because in
@@ -62,17 +71,19 @@ void WebWorkerImpl::PostMessageToWorkerContextTask(
static_cast<WebCore::WorkerContext*>(context);
worker_context->dispatchMessage(message);
- this_ptr->client_->ConfirmMessageFromWorkerObject(
+ this_ptr->client_->confirmMessageFromWorkerObject(
worker_context->hasPendingActivity());
}
-void WebWorkerImpl::StartWorkerContext(const GURL& script_url,
- const string16& user_agent,
- const string16& source_code) {
+// WebWorker -------------------------------------------------------------------
+
+void WebWorkerImpl::startWorkerContext(const WebURL& script_url,
+ const WebString& user_agent,
+ const WebString& source_code) {
worker_thread_ = WebCore::WorkerThread::create(
- webkit_glue::GURLToKURL(script_url),
- webkit_glue::String16ToString(user_agent),
- webkit_glue::String16ToString(source_code),
+ webkit_glue::WebURLToKURL(script_url),
+ webkit_glue::WebStringToString(user_agent),
+ webkit_glue::WebStringToString(source_code),
this);
// Worker initialization means a pending activity.
@@ -81,32 +92,34 @@ void WebWorkerImpl::StartWorkerContext(const GURL& script_url,
worker_thread_->start();
}
-void WebWorkerImpl::TerminateWorkerContext() {
+void WebWorkerImpl::terminateWorkerContext() {
worker_thread_->stop();
}
-void WebWorkerImpl::PostMessageToWorkerContext(const string16& message) {
+void WebWorkerImpl::postMessageToWorkerContext(const WebString& message) {
worker_thread_->runLoop().postTask(WebCore::createCallbackTask(
&PostMessageToWorkerContextTask,
this,
- webkit_glue::String16ToString(message)));
+ webkit_glue::WebStringToString(message)));
}
-void WebWorkerImpl::WorkerObjectDestroyed() {
+void WebWorkerImpl::workerObjectDestroyed() {
}
+// WorkerObjectProxy -----------------------------------------------------------
+
void WebWorkerImpl::postMessageToWorkerObject(const WebCore::String& message) {
- client_->PostMessageToWorkerObject(webkit_glue::StringToString16(message));
+ client_->postMessageToWorkerObject(webkit_glue::StringToWebString(message));
}
void WebWorkerImpl::postExceptionToWorkerObject(
- const WebCore::String& errorMessage,
- int lineNumber,
- const WebCore::String& sourceURL) {
- client_->PostExceptionToWorkerObject(
- webkit_glue::StringToString16(errorMessage),
- lineNumber,
- webkit_glue::StringToString16(sourceURL));
+ const WebCore::String& error_message,
+ int line_number,
+ const WebCore::String& source_url) {
+ client_->postExceptionToWorkerObject(
+ webkit_glue::StringToWebString(error_message),
+ line_number,
+ webkit_glue::StringToWebString(source_url));
}
void WebWorkerImpl::postConsoleMessageToWorkerObject(
@@ -114,27 +127,27 @@ void WebWorkerImpl::postConsoleMessageToWorkerObject(
WebCore::MessageSource source,
WebCore::MessageLevel level,
const WebCore::String& message,
- int lineNumber,
- const WebCore::String& sourceURL) {
- client_->PostConsoleMessageToWorkerObject(
- destination,
- source,
- level,
- webkit_glue::StringToString16(message),
- lineNumber,
- webkit_glue::StringToString16(sourceURL));
+ int line_number,
+ const WebCore::String& source_url) {
+ client_->postConsoleMessageToWorkerObject(
+ static_cast<int>(destination),
+ static_cast<int>(source),
+ static_cast<int>(level),
+ webkit_glue::StringToWebString(message),
+ line_number,
+ webkit_glue::StringToWebString(source_url));
}
-void WebWorkerImpl::confirmMessageFromWorkerObject(bool hasPendingActivity) {
- client_->ConfirmMessageFromWorkerObject(hasPendingActivity);
+void WebWorkerImpl::confirmMessageFromWorkerObject(bool has_pending_activity) {
+ client_->confirmMessageFromWorkerObject(has_pending_activity);
}
-void WebWorkerImpl::reportPendingActivity(bool hasPendingActivity) {
- client_->ReportPendingActivity(hasPendingActivity);
+void WebWorkerImpl::reportPendingActivity(bool has_pending_activity) {
+ client_->reportPendingActivity(has_pending_activity);
}
void WebWorkerImpl::workerContextDestroyed() {
- client_->WorkerContextDestroyed();
+ client_->workerContextDestroyed();
// The lifetime of this proxy is controlled by the worker context.
delete this;
@@ -142,8 +155,12 @@ void WebWorkerImpl::workerContextDestroyed() {
#else
-WebWorker* WebWorker::Create(WebWorkerClient* client) {
+namespace WebKit {
+
+WebWorker* WebWorker::create(WebWorkerClient* client) {
return NULL;
}
+}
+
#endif
diff --git a/webkit/glue/webworker_impl.h b/webkit/glue/webworker_impl.h
index 4af1f64..8ae78c6 100644
--- a/webkit/glue/webworker_impl.h
+++ b/webkit/glue/webworker_impl.h
@@ -5,7 +5,7 @@
#ifndef WEBKIT_GLUE_WEBWORKER_IMPL_H_
#define WEBKIT_GLUE_WEBWORKER_IMPL_H_
-#include "webkit/glue/webworker.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebWorker.h"
#if ENABLE(WORKERS)
@@ -26,33 +26,35 @@ class WorkerThread;
// WebCore::WorkerObjectProxy, this class will conver to Chrome data types first
// and then call the supplied WebWorkerClient.
class WebWorkerImpl: public WebCore::WorkerObjectProxy,
- public WebWorker {
+ public WebKit::WebWorker {
public:
- WebWorkerImpl(WebWorkerClient* client);
+ explicit WebWorkerImpl(WebKit::WebWorkerClient* client);
virtual ~WebWorkerImpl();
- // WebCore::WorkerObjectProxy implementation.
- void postMessageToWorkerObject(const WebCore::String& message);
- void postExceptionToWorkerObject(const WebCore::String& errorMessage,
- int lineNumber,
- const WebCore::String& sourceURL);
- void postConsoleMessageToWorkerObject(WebCore::MessageDestination destination,
- WebCore::MessageSource source,
- WebCore::MessageLevel level,
- const WebCore::String& message,
- int lineNumber,
- const WebCore::String& sourceURL);
- void confirmMessageFromWorkerObject(bool hasPendingActivity);
- void reportPendingActivity(bool hasPendingActivity);
- void workerContextDestroyed();
+ // WebCore::WorkerObjectProxy methods:
+ virtual void postMessageToWorkerObject(const WebCore::String& message);
+ virtual void postExceptionToWorkerObject(
+ const WebCore::String& error_message,
+ int line_number,
+ const WebCore::String& source_url);
+ virtual void postConsoleMessageToWorkerObject(
+ WebCore::MessageDestination destination,
+ WebCore::MessageSource source,
+ WebCore::MessageLevel level,
+ const WebCore::String& message,
+ int line_number,
+ const WebCore::String& source_url);
+ virtual void confirmMessageFromWorkerObject(bool has_pending_activity);
+ virtual void reportPendingActivity(bool has_pending_activity);
+ virtual void workerContextDestroyed();
- // WebWorker implementation.
- void StartWorkerContext(const GURL& script_url,
- const string16& user_agent,
- const string16& source_code);
- void TerminateWorkerContext();
- void PostMessageToWorkerContext(const string16& message);
- void WorkerObjectDestroyed();
+ // 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);
+ virtual void workerObjectDestroyed();
private:
static void PostMessageToWorkerContextTask(
@@ -60,7 +62,7 @@ class WebWorkerImpl: public WebCore::WorkerObjectProxy,
WebWorkerImpl* this_ptr,
const WebCore::String& message);
- WebWorkerClient* client_;
+ WebKit::WebWorkerClient* client_;
WTF::RefPtr<WebCore::WorkerThread> worker_thread_;
DISALLOW_COPY_AND_ASSIGN(WebWorkerImpl);
diff --git a/webkit/glue/webworkerclient.h b/webkit/glue/webworkerclient.h
deleted file mode 100644
index 7938aa1..0000000
--- a/webkit/glue/webworkerclient.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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 WEBKIT_GLUE_WEBWORKERCLIENT_H_
-#define WEBKIT_GLUE_WEBWORKERCLIENT_H_
-
-#include "base/string16.h"
-
-// This is a version of the WebCore::WorkerObjectProxy interface that uses
-// Chrome data types.
-class WebWorkerClient {
- public:
- virtual ~WebWorkerClient() { }
-
- // These functions are called on the worker thread.
- virtual void PostMessageToWorkerObject(const string16& message) = 0;
- virtual void PostExceptionToWorkerObject(
- const string16& error_message,
- int line_number,
- const string16& source_url) = 0;
- // destination, source, and level are the int values of the corresponding
- // WebKit enums. This avoids duplicating the enums and having to stay up to
- // date.
- virtual void PostConsoleMessageToWorkerObject(
- int destination,
- int source,
- int level,
- const string16& message,
- int line_number,
- const string16& source_url) = 0;
- virtual void ConfirmMessageFromWorkerObject(bool has_pending_activity) = 0;
- virtual void ReportPendingActivity(bool has_pending_activity) = 0;
- virtual void WorkerContextDestroyed() = 0;
-};
-
-#endif // #ifndef WEBKIT_GLUE_WEBWORKERCLIENT_H_
diff --git a/webkit/glue/webworkerclient_impl.cc b/webkit/glue/webworkerclient_impl.cc
index 68cd330..add7eeb 100644
--- a/webkit/glue/webworkerclient_impl.cc
+++ b/webkit/glue/webworkerclient_impl.cc
@@ -23,8 +23,15 @@
#include "webkit/glue/webframe_impl.h"
#include "webkit/glue/webview_delegate.h"
#include "webkit/glue/webview_impl.h"
-#include "webkit/glue/webworker.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebWorker.h"
+using WebKit::WebConsoleMessage;
+using WebKit::WebScriptSource;
+using WebKit::WebString;
+using WebKit::WebWorker;
+using WebKit::WebWorkerClient;
// When WebKit creates a WorkerContextProxy object, we check if we're in the
// renderer or worker process. If the latter, then we just use
@@ -71,16 +78,17 @@ void WebWorkerClientImpl::set_webworker(WebWorker* webworker) {
}
void WebWorkerClientImpl::startWorkerContext(
- const WebCore::KURL& scriptURL,
- const WebCore::String& userAgent,
- const WebCore::String& sourceCode) {
+ const WebCore::KURL& script_url,
+ const WebCore::String& user_agent,
+ const WebCore::String& source_code) {
// Worker.terminate() could be called from JS before the context is started.
if (asked_to_terminate_)
return;
- webworker_->StartWorkerContext(webkit_glue::KURLToGURL(scriptURL),
- webkit_glue::StringToString16(userAgent),
- webkit_glue::StringToString16(sourceCode));
+ webworker_->startWorkerContext(
+ webkit_glue::KURLToWebURL(script_url),
+ webkit_glue::StringToWebString(user_agent),
+ webkit_glue::StringToWebString(source_code));
}
void WebWorkerClientImpl::terminateWorkerContext() {
@@ -88,7 +96,7 @@ void WebWorkerClientImpl::terminateWorkerContext() {
return;
asked_to_terminate_ = true;
- webworker_->TerminateWorkerContext();
+ webworker_->terminateWorkerContext();
}
void WebWorkerClientImpl::postMessageToWorkerContext(
@@ -98,8 +106,8 @@ void WebWorkerClientImpl::postMessageToWorkerContext(
return;
++unconfirmed_message_count_;
- webworker_->PostMessageToWorkerContext(
- webkit_glue::StringToString16(message));
+ webworker_->postMessageToWorkerContext(
+ webkit_glue::StringToWebString(message));
}
bool WebWorkerClientImpl::hasPendingActivity() const {
@@ -108,51 +116,52 @@ bool WebWorkerClientImpl::hasPendingActivity() const {
}
void WebWorkerClientImpl::workerObjectDestroyed() {
- webworker_->WorkerObjectDestroyed();
+ webworker_->workerObjectDestroyed();
// The lifetime of this proxy is controlled by the worker.
delete this;
}
-void WebWorkerClientImpl::PostMessageToWorkerObject(const string16& message) {
- worker_->dispatchMessage(webkit_glue::String16ToString(message));
+void WebWorkerClientImpl::postMessageToWorkerObject(const WebString& message) {
+ worker_->dispatchMessage(webkit_glue::WebStringToString(message));
}
-void WebWorkerClientImpl::PostExceptionToWorkerObject(
- const string16& error_message,
+void WebWorkerClientImpl::postExceptionToWorkerObject(
+ const WebString& error_message,
int line_number,
- const string16& source_url) {
+ const WebString& source_url) {
script_execution_context_->reportException(
- webkit_glue::String16ToString(error_message),
+ webkit_glue::WebStringToString(error_message),
line_number,
- webkit_glue::String16ToString(source_url));
+ webkit_glue::WebStringToString(source_url));
}
-void WebWorkerClientImpl::PostConsoleMessageToWorkerObject(
- int destination,
- int source,
- int level,
- const string16& message,
+void WebWorkerClientImpl::postConsoleMessageToWorkerObject(
+ int destination_id,
+ int source_id,
+ int message_level,
+ const WebString& message,
int line_number,
- const string16& source_url) {
+ const WebString& source_url) {
script_execution_context_->addMessage(
- static_cast<WebCore::MessageDestination>(destination),
- static_cast<WebCore::MessageSource>(source),
- static_cast<WebCore::MessageLevel>(level),
- webkit_glue::String16ToString(message),
+ static_cast<WebCore::MessageDestination>(destination_id),
+ static_cast<WebCore::MessageSource>(source_id),
+ static_cast<WebCore::MessageLevel>(message_level),
+ webkit_glue::WebStringToString(message),
line_number,
- webkit_glue::String16ToString(source_url));
+ webkit_glue::WebStringToString(source_url));
}
-void WebWorkerClientImpl::ConfirmMessageFromWorkerObject(bool has_pending_activity) {
+void WebWorkerClientImpl::confirmMessageFromWorkerObject(
+ bool has_pending_activity) {
--unconfirmed_message_count_;
}
-void WebWorkerClientImpl::ReportPendingActivity(bool has_pending_activity) {
+void WebWorkerClientImpl::reportPendingActivity(bool has_pending_activity) {
worker_context_had_pending_activity_ = has_pending_activity;
}
-void WebWorkerClientImpl::WorkerContextDestroyed() {
+void WebWorkerClientImpl::workerContextDestroyed() {
}
#endif
diff --git a/webkit/glue/webworkerclient_impl.h b/webkit/glue/webworkerclient_impl.h
index 5a8a4cd..847b341 100644
--- a/webkit/glue/webworkerclient_impl.h
+++ b/webkit/glue/webworkerclient_impl.h
@@ -7,51 +7,54 @@
#if ENABLE(WORKERS)
-#include "webkit/glue/webworkerclient.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebWorkerClient.h"
#include "WorkerContextProxy.h"
#include <wtf/RefPtr.h>
-class WebWorker;
-
namespace WebCore {
class ScriptExecutionContext;
-};
+}
+namespace WebKit {
+class WebWorker;
+}
// The purpose of this class is to provide a WorkerContextProxy
// implementation that we can give to WebKit. Internally, it converts the
// data types to Chrome compatible ones so that renderer code can use it over
// IPC.
class WebWorkerClientImpl : public WebCore::WorkerContextProxy,
- public WebWorkerClient {
+ public WebKit::WebWorkerClient {
public:
WebWorkerClientImpl(WebCore::Worker* worker);
- void set_webworker(WebWorker* webworker);
+ void set_webworker(WebKit::WebWorker* webworker);
- // WebCore::WorkerContextProxy implementation
- void startWorkerContext(const WebCore::KURL& scriptURL,
- const WebCore::String& userAgent,
- const WebCore::String& sourceCode);
- void terminateWorkerContext();
- void postMessageToWorkerContext(const WebCore::String& message);
- bool hasPendingActivity() const;
- void workerObjectDestroyed();
+ // WebCore::WorkerContextProxy methods:
+ virtual void startWorkerContext(const WebCore::KURL& script_url,
+ const WebCore::String& user_agent,
+ const WebCore::String& source_code);
+ virtual void terminateWorkerContext();
+ virtual void postMessageToWorkerContext(const WebCore::String& message);
+ virtual bool hasPendingActivity() const;
+ virtual void workerObjectDestroyed();
- // WebWorkerClient implementation.
- void PostMessageToWorkerObject(const string16& message);
- void PostExceptionToWorkerObject(const string16& error_message,
- int line_number,
- const string16& source_url);
- void PostConsoleMessageToWorkerObject(int destination,
- int source,
- int level,
- const string16& message,
- int line_number,
- const string16& source_url);
- void ConfirmMessageFromWorkerObject(bool has_pending_activity);
- void ReportPendingActivity(bool has_pending_activity);
- void WorkerContextDestroyed();
+ // WebWorkerClient methods:
+ virtual void postMessageToWorkerObject(const WebKit::WebString& message);
+ 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_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 workerContextDestroyed();
private:
virtual ~WebWorkerClientImpl();
@@ -60,7 +63,7 @@ class WebWorkerClientImpl : public WebCore::WorkerContextProxy,
WTF::RefPtr<WebCore::ScriptExecutionContext> script_execution_context_;
WebCore::Worker* worker_;
- WebWorker* webworker_;
+ WebKit::WebWorker* webworker_;
bool asked_to_terminate_;
uint32 unconfirmed_message_count_;
bool worker_context_had_pending_activity_;
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index a49f513..aeae028 100755
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -47,6 +47,8 @@ using WebKit::WebRect;
using WebKit::WebScreenInfo;
using WebKit::WebSize;
using WebKit::WebString;
+using WebKit::WebWorker;
+using WebKit::WebWorkerClient;
namespace {
diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h
index c828ff8..8826752 100644
--- a/webkit/tools/test_shell/test_webview_delegate.h
+++ b/webkit/tools/test_shell/test_webview_delegate.h
@@ -85,7 +85,7 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>,
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 void OpenURL(WebView* webview,
const GURL& url,
const GURL& referrer,
diff --git a/webkit/tools/test_shell/test_webworker_helper.cc b/webkit/tools/test_shell/test_webworker_helper.cc
index e565632..6cf309c 100644
--- a/webkit/tools/test_shell/test_webworker_helper.cc
+++ b/webkit/tools/test_shell/test_webworker_helper.cc
@@ -19,7 +19,9 @@
#include "base/file_util.h"
#include "base/path_service.h"
#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
-#include "webkit/glue/webworkerclient.h"
+
+using WebKit::WebWorker;
+using WebKit::WebWorkerClient;
WebWorker* TestWebWorkerHelper::CreateWebWorker(WebWorkerClient* client) {
TestWebWorkerHelper* loader = new TestWebWorkerHelper();
diff --git a/webkit/tools/test_shell/test_webworker_helper.h b/webkit/tools/test_shell/test_webworker_helper.h
index 6012c95..6770678 100644
--- a/webkit/tools/test_shell/test_webworker_helper.h
+++ b/webkit/tools/test_shell/test_webworker_helper.h
@@ -16,17 +16,20 @@
#include <wtf/MainThread.h>
class TestWebWorkerHelper;
+
+namespace WebKit {
class WebWorker;
class WebWorkerClient;
+}
// Function to call in test_worker DLL.
-typedef WebWorker* (API_CALL *CreateWebWorkerFunc)(
- WebWorkerClient* webworker_client,
+typedef WebKit::WebWorker* (API_CALL *CreateWebWorkerFunc)(
+ WebKit::WebWorkerClient* webworker_client,
TestWebWorkerHelper* webworker_helper);;
class TestWebWorkerHelper {
public:
- static WebWorker* CreateWebWorker(WebWorkerClient* client);
+ static WebKit::WebWorker* CreateWebWorker(WebKit::WebWorkerClient* client);
TestWebWorkerHelper();
~TestWebWorkerHelper();
diff --git a/webkit/tools/test_shell/test_worker/test_webworker.cc b/webkit/tools/test_shell/test_worker/test_webworker.cc
index 0be6977..6b073b5 100644
--- a/webkit/tools/test_shell/test_worker/test_webworker.cc
+++ b/webkit/tools/test_shell/test_worker/test_webworker.cc
@@ -11,10 +11,29 @@
#include "base/compiler_specific.h"
#include "base/task.h"
#undef LOG
-#include "webkit/glue/webworkerclient.h"
#include "webkit/glue/webworker_impl.h"
#include "webkit/tools/test_shell/test_webworker_helper.h"
+using WebKit::WebString;
+using WebKit::WebURL;
+using WebKit::WebWorker;
+using WebKit::WebWorkerClient;
+
+// We use this class to pass a WebString between threads. This works by
+// copying to a string16 which is itself safe to pass between threads.
+// TODO(jam): Remove this once all worker callbacks happen on the main thread.
+class ThreadSafeWebString {
+ public:
+ explicit ThreadSafeWebString(const WebString& str)
+ : str_(str) {
+ }
+ operator WebString() const {
+ return str_;
+ }
+ private:
+ string16 str_;
+};
+
TestWebWorker::TestWebWorker(WebWorkerClient* client,
TestWebWorkerHelper* webworker_helper)
: webworkerclient_delegate_(client),
@@ -29,125 +48,124 @@ TestWebWorker::~TestWebWorker() {
webworker_helper_->Unload();
}
-void TestWebWorker::StartWorkerContext(const GURL& script_url,
- const string16& user_agent,
- const string16& source_code) {
+void TestWebWorker::startWorkerContext(const WebURL& script_url,
+ const WebString& user_agent,
+ const WebString& source_code) {
webworker_impl_ = new WebWorkerImpl(this);
- webworker_impl_->StartWorkerContext(script_url,
- user_agent,
- source_code);
+ webworker_impl_->startWorkerContext(script_url, user_agent, source_code);
for (size_t i = 0; i < queued_messages_.size(); ++i)
- webworker_impl_->PostMessageToWorkerContext(queued_messages_[i]);
+ webworker_impl_->postMessageToWorkerContext(queued_messages_[i]);
queued_messages_.clear();
}
-void TestWebWorker::TerminateWorkerContext() {
+void TestWebWorker::terminateWorkerContext() {
if (webworker_impl_)
- webworker_impl_->TerminateWorkerContext();
+ webworker_impl_->terminateWorkerContext();
}
-void TestWebWorker::PostMessageToWorkerContext(const string16& message) {
+void TestWebWorker::postMessageToWorkerContext(const WebString& message) {
if (webworker_impl_)
- webworker_impl_->PostMessageToWorkerContext(message);
+ webworker_impl_->postMessageToWorkerContext(message);
else
queued_messages_.push_back(message);
}
-void TestWebWorker::WorkerObjectDestroyed() {
+void TestWebWorker::workerObjectDestroyed() {
if (webworker_impl_)
- webworker_impl_->WorkerObjectDestroyed();
+ webworker_impl_->workerObjectDestroyed();
webworkerclient_delegate_ = NULL;
Release(); // Releases the reference held for worker object.
}
-void TestWebWorker::PostMessageToWorkerObject(const string16& message) {
+void TestWebWorker::postMessageToWorkerObject(const WebString& message) {
if (webworker_helper_->IsMainThread()) {
if (webworkerclient_delegate_)
- webworkerclient_delegate_->PostMessageToWorkerObject(message);
+ webworkerclient_delegate_->postMessageToWorkerObject(message);
} else {
webworker_helper_->DispatchToMainThread(
InvokeMainThreadMethod, NewRunnableMethod(
- this, &TestWebWorker::PostMessageToWorkerObject, message));
+ this, &TestWebWorker::postMessageToWorkerObject,
+ ThreadSafeWebString(message)));
}
}
-void TestWebWorker::PostExceptionToWorkerObject(const string16& error_message,
+void TestWebWorker::postExceptionToWorkerObject(const WebString& error_message,
int line_number,
- const string16& source_url) {
+ const WebString& source_url) {
if (webworker_helper_->IsMainThread()) {
if (webworkerclient_delegate_)
- webworkerclient_delegate_->PostExceptionToWorkerObject(error_message,
+ webworkerclient_delegate_->postExceptionToWorkerObject(error_message,
line_number,
source_url);
} else {
webworker_helper_->DispatchToMainThread(
InvokeMainThreadMethod, NewRunnableMethod(
- this, &TestWebWorker::PostExceptionToWorkerObject,
- error_message, line_number, source_url));
+ this, &TestWebWorker::postExceptionToWorkerObject,
+ ThreadSafeWebString(error_message), line_number,
+ ThreadSafeWebString(source_url)));
}
}
-void TestWebWorker::PostConsoleMessageToWorkerObject(
- int destination,
- int source,
- int level,
- const string16& message,
+void TestWebWorker::postConsoleMessageToWorkerObject(
+ int destination_id,
+ int source_id,
+ int message_level,
+ const WebString& message,
int line_number,
- const string16& source_url) {
+ const WebString& source_url) {
if (webworker_helper_->IsMainThread()) {
if (webworkerclient_delegate_)
- webworkerclient_delegate_->PostConsoleMessageToWorkerObject(destination,
- source,
- level,
- message,
- line_number,
- source_url);
+ webworkerclient_delegate_->postConsoleMessageToWorkerObject(
+ destination_id, source_id, message_level, message, line_number,
+ source_url);
} else {
webworker_helper_->DispatchToMainThread(
InvokeMainThreadMethod, NewRunnableMethod(
- this, &TestWebWorker::PostConsoleMessageToWorkerObject,
- destination, source, level, message, line_number, source_url));
+ this, &TestWebWorker::postConsoleMessageToWorkerObject,
+ destination_id, source_id, message_level,
+ ThreadSafeWebString(message), line_number,
+ ThreadSafeWebString(source_url)));
}
}
-void TestWebWorker::ConfirmMessageFromWorkerObject(bool has_pending_activity) {
+void TestWebWorker::confirmMessageFromWorkerObject(bool has_pending_activity) {
if (webworker_helper_->IsMainThread()) {
if (webworkerclient_delegate_)
- webworkerclient_delegate_->ConfirmMessageFromWorkerObject(
+ webworkerclient_delegate_->confirmMessageFromWorkerObject(
has_pending_activity);
} else {
webworker_helper_->DispatchToMainThread(
InvokeMainThreadMethod, NewRunnableMethod(
- this, &TestWebWorker::ConfirmMessageFromWorkerObject,
+ this, &TestWebWorker::confirmMessageFromWorkerObject,
has_pending_activity));
}
}
-void TestWebWorker::ReportPendingActivity(bool has_pending_activity) {
+void TestWebWorker::reportPendingActivity(bool has_pending_activity) {
if (webworker_helper_->IsMainThread()) {
if (webworkerclient_delegate_)
- webworkerclient_delegate_->ReportPendingActivity(has_pending_activity);
+ webworkerclient_delegate_->reportPendingActivity(has_pending_activity);
} else {
webworker_helper_->DispatchToMainThread(
InvokeMainThreadMethod, NewRunnableMethod(
- this, &TestWebWorker::ReportPendingActivity,
+ this, &TestWebWorker::reportPendingActivity,
has_pending_activity));
}
}
-void TestWebWorker::WorkerContextDestroyed() {
+void TestWebWorker::workerContextDestroyed() {
if (webworker_helper_->IsMainThread()) {
if (webworkerclient_delegate_)
- webworkerclient_delegate_->WorkerContextDestroyed();
+ webworkerclient_delegate_->workerContextDestroyed();
Release(); // Releases the reference held for worker context object.
} else {
webworker_impl_ = NULL;
webworker_helper_->DispatchToMainThread(
InvokeMainThreadMethod, NewRunnableMethod(
- this, &TestWebWorker::WorkerContextDestroyed));
+ this, &TestWebWorker::workerContextDestroyed));
}
}
diff --git a/webkit/tools/test_shell/test_worker/test_webworker.h b/webkit/tools/test_shell/test_worker/test_webworker.h
index aa192e7..c3f3ddc 100644
--- a/webkit/tools/test_shell/test_worker/test_webworker.h
+++ b/webkit/tools/test_shell/test_worker/test_webworker.h
@@ -11,42 +11,43 @@
#include "base/basictypes.h"
#include "base/ref_counted.h"
-#include "webkit/glue/webworker.h"
-#include "webkit/glue/webworkerclient.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebWorker.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebWorkerClient.h"
class GURL;
class TestWebWorkerHelper;
-class TestWebWorker : public WebWorker,
- public WebWorkerClient,
+class TestWebWorker : public WebKit::WebWorker,
+ public WebKit::WebWorkerClient,
public base::RefCounted<TestWebWorker> {
public:
TestWebWorker(WebWorkerClient* client, TestWebWorkerHelper* webworker_helper);
- // WebWorker implementation.
- 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();
+ // 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&);
+ virtual void workerObjectDestroyed();
- // WebWorkerClient implementation.
- virtual void PostMessageToWorkerObject(const string16& message);
- virtual void PostExceptionToWorkerObject(
- const string16& error_message,
+ // WebWorkerClient methods:
+ virtual void postMessageToWorkerObject(const WebKit::WebString& message);
+ virtual void postExceptionToWorkerObject(
+ const WebKit::WebString& error_message,
int line_number,
- const string16& source_url);
- virtual void PostConsoleMessageToWorkerObject(
- int destination,
- int source,
- int level,
- const string16& message,
+ const WebKit::WebString& source_url);
+ virtual void postConsoleMessageToWorkerObject(
+ int destination_id,
+ int source_id,
+ int message_level,
+ const WebKit::WebString& message,
int line_number,
- const string16& source_url);
- virtual void ConfirmMessageFromWorkerObject(bool has_pending_activity);
- virtual void ReportPendingActivity(bool has_pending_activity);
- virtual void WorkerContextDestroyed();
+ const WebKit::WebString& source_url);
+ virtual void confirmMessageFromWorkerObject(bool has_pending_activity);
+ virtual void reportPendingActivity(bool has_pending_activity);
+ virtual void workerContextDestroyed();
private:
friend class base::RefCounted<TestWebWorker>;
@@ -54,10 +55,10 @@ class TestWebWorker : public WebWorker,
static void InvokeMainThreadMethod(void* param);
- WebWorkerClient* webworkerclient_delegate_;
- WebWorker* webworker_impl_;
+ WebKit::WebWorkerClient* webworkerclient_delegate_;
+ WebKit::WebWorker* webworker_impl_;
TestWebWorkerHelper* webworker_helper_;
- std::vector<string16> queued_messages_;
+ std::vector<WebKit::WebString> queued_messages_;
DISALLOW_COPY_AND_ASSIGN(TestWebWorker);
};
diff --git a/webkit/tools/test_shell/test_worker/test_worker_main.cc b/webkit/tools/test_shell/test_worker/test_worker_main.cc
index 7fe6b61..6695a11 100644
--- a/webkit/tools/test_shell/test_worker/test_worker_main.cc
+++ b/webkit/tools/test_shell/test_worker/test_worker_main.cc
@@ -15,12 +15,13 @@
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "webkit/glue/resource_loader_bridge.h"
#include "webkit/glue/webkit_glue.h"
-#include "webkit/glue/webworker.h"
#include "webkit/glue/webkitclient_impl.h"
-#include "webkit/glue/webworkerclient.h"
#include "webkit/tools/test_shell/test_webworker_helper.h"
#include "webkit/tools/test_shell/test_worker/test_webworker.h"
+using WebKit::WebWorker;
+using WebKit::WebWorkerClient;
+
// Create a global AtExitManager so that our code can use code from base that
// uses Singletons, for example. We don't care about static constructors here.
static base::AtExitManager global_at_exit_manager;