Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Unified Diff: Source/core/workers/DedicatedWorkerGlobalScope.cpp

Issue 342103003: Support UseCounter in dedicated workers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/workers/DedicatedWorkerGlobalScope.h ('k') | Source/core/workers/WorkerGlobalScope.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/workers/DedicatedWorkerGlobalScope.cpp
diff --git a/Source/core/workers/DedicatedWorkerGlobalScope.cpp b/Source/core/workers/DedicatedWorkerGlobalScope.cpp
index 357ca79f4e1cafceb28918280d18aed9bac204e2..cf30616813de29cddb3ce78f5ce786a5550588a7 100644
--- a/Source/core/workers/DedicatedWorkerGlobalScope.cpp
+++ b/Source/core/workers/DedicatedWorkerGlobalScope.cpp
@@ -78,11 +78,30 @@ void DedicatedWorkerGlobalScope::importScripts(const Vector<String>& urls, Excep
thread()->workerObjectProxy().reportPendingActivity(hasPendingActivity());
}
-DedicatedWorkerThread* DedicatedWorkerGlobalScope::thread()
+DedicatedWorkerThread* DedicatedWorkerGlobalScope::thread() const
{
return static_cast<DedicatedWorkerThread*>(Base::thread());
}
+class CounterTask : public ExecutionContextTask {
haraken 2014/06/19 05:29:01 CounterTask => UseCounterTask ?
tkent 2014/06/19 05:34:09 Done.
+public:
+ static PassOwnPtr<CounterTask> create(UseCounter::Feature feature) { return adoptPtr(new CounterTask(feature)); }
+
+private:
+ CounterTask(UseCounter::Feature feature) : m_feature(feature) { }
haraken 2014/06/19 05:29:01 Add explicit.
tkent 2014/06/19 05:34:09 Done.
+ virtual void performTask(ExecutionContext* context) OVERRIDE
+ {
+ UseCounter::count(*toDocument(context), m_feature);
+ }
+
+ UseCounter::Feature m_feature;
+};
+
+void DedicatedWorkerGlobalScope::countFeature(UseCounter::Feature feature) const
+{
+ thread()->workerObjectProxy().postTaskToMainExecutionContext(CounterTask::create(feature));
+}
+
void DedicatedWorkerGlobalScope::trace(Visitor* visitor)
{
WorkerGlobalScope::trace(visitor);
« no previous file with comments | « Source/core/workers/DedicatedWorkerGlobalScope.h ('k') | Source/core/workers/WorkerGlobalScope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698