| Index: Source/core/dom/SimpleLifecycleContext.cpp
|
| diff --git a/Source/core/workers/WorkerLocation.cpp b/Source/core/dom/SimpleLifecycleContext.cpp
|
| similarity index 58%
|
| copy from Source/core/workers/WorkerLocation.cpp
|
| copy to Source/core/dom/SimpleLifecycleContext.cpp
|
| index 8cdcb4b31045a268658479c612fec4cdaac4a3f3..35d241fdd8c5b3d766b37a6f3106a14262c7e11c 100644
|
| --- a/Source/core/workers/WorkerLocation.cpp
|
| +++ b/Source/core/dom/SimpleLifecycleContext.cpp
|
| @@ -1,5 +1,5 @@
|
| /*
|
| - * Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
| + * Copyright (C) 2013 Google Inc. All Rights Reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions
|
| @@ -20,57 +20,45 @@
|
| * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
| * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| *
|
| */
|
|
|
| #include "config.h"
|
| +#include "core/dom/SimpleLifecycleContext.h"
|
|
|
| -#include "core/workers/WorkerLocation.h"
|
| -
|
| -#include <wtf/text/WTFString.h>
|
| +#include "core/dom/SimpleLifecycleNotifier.h"
|
|
|
| namespace WebCore {
|
|
|
| -String WorkerLocation::href() const
|
| -{
|
| - return m_url.string();
|
| -}
|
| -
|
| -String WorkerLocation::protocol() const
|
| +SimpleLifecycleContext::SimpleLifecycleContext()
|
| {
|
| - return m_url.protocol() + ":";
|
| }
|
|
|
| -String WorkerLocation::host() const
|
| +SimpleLifecycleContext::~SimpleLifecycleContext()
|
| {
|
| - return m_url.port() ? m_url.host() + ":" + String::number(m_url.port()) : m_url.host();
|
| }
|
|
|
| -String WorkerLocation::hostname() const
|
| +void SimpleLifecycleContext::wasObservedBy(SimpleLifecycleObserver* observer, SimpleLifecycleObserver::Type type)
|
| {
|
| - return m_url.host();
|
| + lifecycleNotifier()->addObserver(observer, type);
|
| }
|
|
|
| -String WorkerLocation::port() const
|
| +void SimpleLifecycleContext::wasUnobservedBy(SimpleLifecycleObserver* observer, SimpleLifecycleObserver::Type type)
|
| {
|
| - return m_url.port() ? String::number(m_url.port()) : "";
|
| + lifecycleNotifier()->removeObserver(observer, type);
|
| }
|
|
|
| -String WorkerLocation::pathname() const
|
| +SimpleLifecycleNotifier* SimpleLifecycleContext::lifecycleNotifier()
|
| {
|
| - return m_url.path().isEmpty() ? "/" : m_url.path();
|
| + if (!m_lifecycleNotifier)
|
| + m_lifecycleNotifier = const_cast<SimpleLifecycleContext*>(this)->createLifecycleNotifier();
|
| + return m_lifecycleNotifier.get();
|
| }
|
|
|
| -String WorkerLocation::search() const
|
| +PassOwnPtr<SimpleLifecycleNotifier> SimpleLifecycleContext::createLifecycleNotifier()
|
| {
|
| - return m_url.query().isEmpty() ? emptyString() : "?" + m_url.query();
|
| + return SimpleLifecycleNotifier::create(this);
|
| }
|
|
|
| -String WorkerLocation::hash() const
|
| -{
|
| - return m_url.fragmentIdentifier().isEmpty() ? emptyString() : "#" + m_url.fragmentIdentifier();
|
| -}
|
| -
|
| -
|
| } // namespace WebCore
|
|
|