Chromium Code Reviews| Index: Source/modules/performance/WorkerContextPerformance.cpp |
| diff --git a/Source/modules/crypto/DOMWindowCrypto.cpp b/Source/modules/performance/WorkerContextPerformance.cpp |
| similarity index 60% |
| copy from Source/modules/crypto/DOMWindowCrypto.cpp |
| copy to Source/modules/performance/WorkerContextPerformance.cpp |
| index 237c298876451ce2a910a4969e8e153aaa23ff93..1296c555bcba8a6ed55b928e37d2f5f53384d458 100644 |
| --- a/Source/modules/crypto/DOMWindowCrypto.cpp |
| +++ b/Source/modules/performance/WorkerContextPerformance.cpp |
| @@ -29,50 +29,48 @@ |
| */ |
| #include "config.h" |
| -#include "modules/crypto/DOMWindowCrypto.h" |
| -#include "core/page/DOMWindow.h" |
| -#include "core/page/Frame.h" |
| -#include "modules/crypto/Crypto.h" |
| +#include "modules/performance/WorkerContextPerformance.h" |
| + |
| +#include "core/dom/ScriptExecutionContext.h" |
| +#include "core/workers/WorkerContext.h" |
| +#include "modules/performance/WorkerPerformance.h" |
| namespace WebCore { |
| -DOMWindowCrypto::DOMWindowCrypto(DOMWindow* window) |
| - : DOMWindowProperty(window->frame()) |
| +WorkerContextPerformance::WorkerContextPerformance() |
|
levin
2013/06/13 19:55:22
How is it deleted?
abarth-chromium
2013/06/13 20:18:19
class WorkerContextPerformance : public Supplement
levin
2013/06/13 22:19:08
I was looking for a destructor on Supplement and I
|
| { |
| } |
| -DOMWindowCrypto::~DOMWindowCrypto() |
| +WorkerContextPerformance::~WorkerContextPerformance() |
| { |
| } |
| -const char* DOMWindowCrypto::supplementName() |
| +const char* WorkerContextPerformance::supplementName() |
| { |
| - return "DOMWindowCrypto"; |
| + return "WorkerContextPerformance"; |
| } |
| -// static |
| -DOMWindowCrypto* DOMWindowCrypto::from(DOMWindow* window) |
| +WorkerContextPerformance* WorkerContextPerformance::from(ScriptExecutionContext* context) |
| { |
| - DOMWindowCrypto* supplement = static_cast<DOMWindowCrypto*>(Supplement<DOMWindow>::from(window, supplementName())); |
| + WorkerContextPerformance* supplement = static_cast<WorkerContextPerformance*>(Supplement<ScriptExecutionContext>::from(context, supplementName())); |
| if (!supplement) { |
| - supplement = new DOMWindowCrypto(window); |
| - provideTo(window, supplementName(), adoptPtr(supplement)); |
| + supplement = new WorkerContextPerformance(); |
| + provideTo(context, supplementName(), adoptPtr(supplement)); |
| } |
| return supplement; |
| } |
| -// static |
| -Crypto* DOMWindowCrypto::crypto(DOMWindow* window) |
| +WorkerPerformance* WorkerContextPerformance::performance(ScriptExecutionContext* context) |
| { |
| - return DOMWindowCrypto::from(window)->crypto(); |
| + return from(context)->getPerformance(context); |
| } |
| -Crypto* DOMWindowCrypto::crypto() const |
| +WorkerPerformance* WorkerContextPerformance::getPerformance(ScriptExecutionContext* context) |
| { |
| - if (!m_crypto && frame()) |
| - m_crypto = Crypto::create(); |
| - return m_crypto.get(); |
| + if (!m_performance) |
| + m_performance = WorkerPerformance::create(context); |
| + return m_performance.get(); |
| } |
| } // namespace WebCore |