Index: Source/modules/performance/WorkerContextPerformance.cpp |
diff --git a/Source/modules/donottrack/NavigatorDoNotTrack.cpp b/Source/modules/performance/WorkerContextPerformance.cpp |
similarity index 57% |
copy from Source/modules/donottrack/NavigatorDoNotTrack.cpp |
copy to Source/modules/performance/WorkerContextPerformance.cpp |
index 5fee3b5536ae29b0637a6b4b389cf8727490f158..6f517376daea87a14302d50ace3aa71f05da3562 100644 |
--- a/Source/modules/donottrack/NavigatorDoNotTrack.cpp |
+++ b/Source/modules/performance/WorkerContextPerformance.cpp |
@@ -29,48 +29,52 @@ |
*/ |
#include "config.h" |
-#include "modules/donottrack/NavigatorDoNotTrack.h" |
-#include "core/loader/FrameLoader.h" |
-#include "core/loader/FrameLoaderClient.h" |
-#include "core/page/Frame.h" |
-#include "core/page/Navigator.h" |
-#include "wtf/PassOwnPtr.h" |
+#include "modules/performance/WorkerContextPerformance.h" |
+ |
+#include "core/dom/ScriptExecutionContext.h" |
+#include "core/workers/WorkerContext.h" |
+#include "modules/performance/WorkerPerformance.h" |
namespace WebCore { |
-NavigatorDoNotTrack::NavigatorDoNotTrack(Frame* frame) |
- : DOMWindowProperty(frame) |
+WorkerContextPerformance::WorkerContextPerformance(ScriptExecutionContext* context) |
+ : m_context(context) |
abarth-chromium
2013/06/12 23:11:41
Why do you need to hold m_context?
James Simonsen
2013/06/13 00:01:36
Done.
|
{ |
} |
-NavigatorDoNotTrack::~NavigatorDoNotTrack() |
+WorkerContextPerformance::~WorkerContextPerformance() |
{ |
} |
-const char* NavigatorDoNotTrack::supplementName() |
+const char* WorkerContextPerformance::supplementName() |
{ |
- return "NavigatorDoNotTrack"; |
+ return "WorkerContextPerformance"; |
} |
-NavigatorDoNotTrack* NavigatorDoNotTrack::from(Navigator* navigator) |
+WorkerContextPerformance* WorkerContextPerformance::from(ScriptExecutionContext* context) |
{ |
- NavigatorDoNotTrack* supplement = static_cast<NavigatorDoNotTrack*>(Supplement<Navigator>::from(navigator, supplementName())); |
+ WorkerContextPerformance* supplement = static_cast<WorkerContextPerformance*>(Supplement<ScriptExecutionContext>::from(context, supplementName())); |
if (!supplement) { |
- supplement = new NavigatorDoNotTrack(navigator->frame()); |
- provideTo(navigator, supplementName(), adoptPtr(supplement)); |
+ supplement = new WorkerContextPerformance(context); |
+ provideTo(context, supplementName(), adoptPtr(supplement)); |
} |
return supplement; |
} |
-String NavigatorDoNotTrack::doNotTrack(Navigator* navigator) |
+WorkerPerformance* WorkerContextPerformance::performance(ScriptExecutionContext* context) |
{ |
- return NavigatorDoNotTrack::from(navigator)->doNotTrack(); |
+ return from(context)->performance(); |
abarth-chromium
2013/06/12 23:11:41
You can just pass context in here.
James Simonsen
2013/06/13 00:01:36
Yep. Thanks.
|
} |
-String NavigatorDoNotTrack::doNotTrack() |
+WorkerPerformance* WorkerContextPerformance::performance() |
{ |
- return frame() ? frame()->loader()->client()->doNotTrackValue() : String(); |
+ if (!m_performance) { |
+ ASSERT_WITH_SECURITY_IMPLICATION(m_context->isWorkerContext()); |
+ WorkerContext* workerContext = static_cast<WorkerContext*>(m_context); |
+ m_performance = WorkerPerformance::create(workerContext); |
+ } |
+ return m_performance.get(); |
} |
} // namespace WebCore |