summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webworkerclient_impl.cc
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-30 23:20:46 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-30 23:20:46 +0000
commit2da8d317072968241f986ffed0be477900831889 (patch)
tree761eedfabaaba837480c3604c0cfcf10e8d7d07c /webkit/glue/webworkerclient_impl.cc
parentb9a0b1b39c5bcf551178cab7a2aa5f24d5afc929 (diff)
downloadchromium_src-2da8d317072968241f986ffed0be477900831889.zip
chromium_src-2da8d317072968241f986ffed0be477900831889.tar.gz
chromium_src-2da8d317072968241f986ffed0be477900831889.tar.bz2
Reland changes to enable worker layout tests. Compared to last review (http://codereview.chromium.org/50045), the following changes are made:
1) Add chrome/test/worker/DEPS to address checkdeps error. 2) Change test_expectations.txt to skip some worker layout tests. 3) Add test_worker.vcproj to webkit.sln so that test_worker.dll can be built for WebKit build. Review URL: http://codereview.chromium.org/56074 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12822 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webworkerclient_impl.cc')
-rw-r--r--webkit/glue/webworkerclient_impl.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/webkit/glue/webworkerclient_impl.cc b/webkit/glue/webworkerclient_impl.cc
index 11ccfca..68cd330 100644
--- a/webkit/glue/webworkerclient_impl.cc
+++ b/webkit/glue/webworkerclient_impl.cc
@@ -67,13 +67,17 @@ WebWorkerClientImpl::~WebWorkerClientImpl() {
}
void WebWorkerClientImpl::set_webworker(WebWorker* webworker) {
- webworker_.reset(webworker);
+ webworker_ = webworker;
}
void WebWorkerClientImpl::startWorkerContext(
const WebCore::KURL& scriptURL,
const WebCore::String& userAgent,
const WebCore::String& sourceCode) {
+ // 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));
@@ -89,6 +93,10 @@ void WebWorkerClientImpl::terminateWorkerContext() {
void WebWorkerClientImpl::postMessageToWorkerContext(
const WebCore::String& message) {
+ // Worker.terminate() could be called from JS before the context is started.
+ if (asked_to_terminate_)
+ return;
+
++unconfirmed_message_count_;
webworker_->PostMessageToWorkerContext(
webkit_glue::StringToString16(message));