summaryrefslogtreecommitdiffstats
path: root/WebCore/workers/SharedWorker.cpp
diff options
context:
space:
mode:
authorLeon Clarke <leonclarke@google.com>2010-07-15 12:03:35 +0100
committerLeon Clarke <leonclarke@google.com>2010-07-20 16:57:23 +0100
commite458d70a0d18538346f41b503114c9ebe6b2ce12 (patch)
tree86f1637deca2c524432a822e5fcedd4bef221091 /WebCore/workers/SharedWorker.cpp
parentf43eabc081f7ce6af24b9df4953498a3cd6ca24d (diff)
downloadexternal_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.zip
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.gz
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.bz2
Merge WebKit at r63173 : Initial merge by git.
Change-Id: Ife5af0c7c6261fbbc8ae6bc08c390efa9ef10b44
Diffstat (limited to 'WebCore/workers/SharedWorker.cpp')
-rw-r--r--WebCore/workers/SharedWorker.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/WebCore/workers/SharedWorker.cpp b/WebCore/workers/SharedWorker.cpp
index cd856ff..b25b28e 100644
--- a/WebCore/workers/SharedWorker.cpp
+++ b/WebCore/workers/SharedWorker.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -42,22 +43,32 @@
namespace WebCore {
-SharedWorker::SharedWorker(const String& url, const String& name, ScriptExecutionContext* context, ExceptionCode& ec)
+inline SharedWorker::SharedWorker(ScriptExecutionContext* context)
: AbstractWorker(context)
{
- RefPtr<MessageChannel> channel = MessageChannel::create(scriptExecutionContext());
- m_port = channel->port1();
+}
+
+PassRefPtr<SharedWorker> SharedWorker::create(const String& url, const String& name, ScriptExecutionContext* context, ExceptionCode& ec)
+{
+ RefPtr<SharedWorker> worker = adoptRef(new SharedWorker(context));
+
+ RefPtr<MessageChannel> channel = MessageChannel::create(context);
+ worker->m_port = channel->port1();
OwnPtr<MessagePortChannel> remotePort = channel->port2()->disentangle(ec);
- ASSERT(!ec);
+ ASSERT(remotePort);
+
+ KURL scriptURL = worker->resolveURL(url, ec);
+ if (scriptURL.isEmpty())
+ return 0;
+
+ SharedWorkerRepository::connect(worker.get(), remotePort.release(), scriptURL, name, ec);
- KURL scriptUrl = resolveURL(url, ec);
- if (ec)
- return;
- SharedWorkerRepository::connect(this, remotePort.release(), scriptUrl, name, ec);
#if ENABLE(INSPECTOR)
- if (InspectorController* inspector = scriptExecutionContext()->inspectorController())
- inspector->didCreateWorker(asID(), scriptUrl.string(), true);
+ if (InspectorController* inspector = context->inspectorController())
+ inspector->didCreateWorker(worker->asID(), scriptURL.string(), true);
#endif
+
+ return worker.release();
}
SharedWorker::~SharedWorker()