summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-05 22:06:43 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-05 22:06:43 +0000
commitd9056166ac600fd4c261d81a9da1f5ba855e6bd8 (patch)
tree148e4e04c47a1c0b65dbd3f022040259e85acfb9 /chrome/renderer
parent1a616d92fc1bdafcceda50939e6a5b72f4885a98 (diff)
downloadchromium_src-d9056166ac600fd4c261d81a9da1f5ba855e6bd8.zip
chromium_src-d9056166ac600fd4c261d81a9da1f5ba855e6bd8.tar.gz
chromium_src-d9056166ac600fd4c261d81a9da1f5ba855e6bd8.tar.bz2
Hook up WebKit worker with Chromium.
Review URL: http://codereview.chromium.org/39147 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11046 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/webworker_proxy.cc10
-rw-r--r--chrome/renderer/webworker_proxy.h5
2 files changed, 13 insertions, 2 deletions
diff --git a/chrome/renderer/webworker_proxy.cc b/chrome/renderer/webworker_proxy.cc
index cf6477a..0da55f3 100644
--- a/chrome/renderer/webworker_proxy.cc
+++ b/chrome/renderer/webworker_proxy.cc
@@ -28,6 +28,12 @@ void WebWorkerProxy::StartWorkerContext(
RenderThread::current()->AddRoute(route_id_, this);
Send(new WorkerMsg_StartWorkerContext(
route_id_, script_url, user_agent, source_code));
+
+ for (size_t i = 0; i < queued_messages_.size(); ++i) {
+ queued_messages_[i]->set_routing_id(route_id_);
+ Send(queued_messages_[i]);
+ }
+ queued_messages_.clear();
}
void WebWorkerProxy::TerminateWorkerContext() {
@@ -50,8 +56,8 @@ void WebWorkerProxy::WorkerObjectDestroyed() {
bool WebWorkerProxy::Send(IPC::Message* message) {
if (route_id_ == MSG_ROUTING_NONE) {
- delete message;
- return false;
+ queued_messages_.push_back(message);
+ return true;
}
// For now we proxy all messages to the worker process through the browser.
diff --git a/chrome/renderer/webworker_proxy.h b/chrome/renderer/webworker_proxy.h
index 97a6bb3..e068e8e 100644
--- a/chrome/renderer/webworker_proxy.h
+++ b/chrome/renderer/webworker_proxy.h
@@ -5,6 +5,8 @@
#ifndef CHROME_RENDERER_WEBWORKER_PROXY_H_
#define CHROME_RENDERER_WEBWORKER_PROXY_H_
+#include <vector>
+
#include "base/basictypes.h"
#include "chrome/common/ipc_channel.h"
#include "webkit/glue/webworker.h"
@@ -49,6 +51,9 @@ class WebWorkerProxy : public WebWorker,
// messages.
WebWorkerClient* client_;
+ // Stores messages that were sent before the StartWorkerContext message.
+ std::vector<IPC::Message*> queued_messages_;
+
DISALLOW_COPY_AND_ASSIGN(WebWorkerProxy);
};