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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 return; 71 return;
72 thread()->workerObjectProxy().postMessageToWorkerObject(message, channels.re lease()); 72 thread()->workerObjectProxy().postMessageToWorkerObject(message, channels.re lease());
73 } 73 }
74 74
75 void DedicatedWorkerGlobalScope::importScripts(const Vector<String>& urls, Excep tionState& exceptionState) 75 void DedicatedWorkerGlobalScope::importScripts(const Vector<String>& urls, Excep tionState& exceptionState)
76 { 76 {
77 Base::importScripts(urls, exceptionState); 77 Base::importScripts(urls, exceptionState);
78 thread()->workerObjectProxy().reportPendingActivity(hasPendingActivity()); 78 thread()->workerObjectProxy().reportPendingActivity(hasPendingActivity());
79 } 79 }
80 80
81 DedicatedWorkerThread* DedicatedWorkerGlobalScope::thread() 81 DedicatedWorkerThread* DedicatedWorkerGlobalScope::thread() const
82 { 82 {
83 return static_cast<DedicatedWorkerThread*>(Base::thread()); 83 return static_cast<DedicatedWorkerThread*>(Base::thread());
84 } 84 }
85 85
86 class CounterTask : public ExecutionContextTask {
haraken 2014/06/19 05:29:01 CounterTask => UseCounterTask ?
tkent 2014/06/19 05:34:09 Done.
87 public:
88 static PassOwnPtr<CounterTask> create(UseCounter::Feature feature) { return adoptPtr(new CounterTask(feature)); }
89
90 private:
91 CounterTask(UseCounter::Feature feature) : m_feature(feature) { }
haraken 2014/06/19 05:29:01 Add explicit.
tkent 2014/06/19 05:34:09 Done.
92 virtual void performTask(ExecutionContext* context) OVERRIDE
93 {
94 UseCounter::count(*toDocument(context), m_feature);
95 }
96
97 UseCounter::Feature m_feature;
98 };
99
100 void DedicatedWorkerGlobalScope::countFeature(UseCounter::Feature feature) const
101 {
102 thread()->workerObjectProxy().postTaskToMainExecutionContext(CounterTask::cr eate(feature));
103 }
104
86 void DedicatedWorkerGlobalScope::trace(Visitor* visitor) 105 void DedicatedWorkerGlobalScope::trace(Visitor* visitor)
87 { 106 {
88 WorkerGlobalScope::trace(visitor); 107 WorkerGlobalScope::trace(visitor);
89 } 108 }
90 109
91 } // namespace WebCore 110 } // namespace WebCore
OLDNEW
« 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