Chromium Code Reviews| Index: third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp |
| diff --git a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp |
| index 2ba42a23abf2a2dbbcc21f99e7df660e33cf1740..177f81c95e7d8f2ac4ef763bde3bedb31fcf11ce 100644 |
| --- a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp |
| +++ b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp |
| @@ -225,16 +225,28 @@ WebSharedWorkerImpl::createClientMessageLoop() { |
| // WorkerReportingProxy -------------------------------------------------------- |
| -void WebSharedWorkerImpl::countFeature(UseCounter::Feature) { |
| - // TODO(nhiroki): Support UseCounter for SharedWorker. Send an IPC message to |
| - // the browser process and ask each connected document to record API use in |
| - // its UseCounter (https://crbug.com/376039). |
| +void WebSharedWorkerImpl::countFeature(UseCounter::Feature feature) { |
| + static_assert(UseCounter::NumberOfFeatures < UINT32_MAX, |
| + "uint32_t must be larger than number of features"); |
| + m_parentFrameTaskRunners->get(TaskType::UnspecedTimer) |
| + ->postTask(BLINK_FROM_HERE, |
| + crossThreadBind(&WebSharedWorkerClient::countFeature, |
| + crossThreadUnretained(m_client), |
| + static_cast<uint32_t>(feature))); |
| } |
| -void WebSharedWorkerImpl::countDeprecation(UseCounter::Feature) { |
| - // TODO(nhiroki): Support UseCounter for SharedWorker. Send an IPC message to |
| - // the browser process and ask each connected document to record API use in |
| - // its UseCounter (https://crbug.com/376039). |
| +void WebSharedWorkerImpl::countDeprecation(UseCounter::Feature feature) { |
| + static_assert(UseCounter::NumberOfFeatures < UINT32_MAX, |
| + "uint32_t must be larger than number of features"); |
| + |
| + // Go through the same code path with countFeature() because a deprecation |
| + // message is already shown on the worker console and a remaining work is just |
| + // to record an API use. |
| + m_parentFrameTaskRunners->get(TaskType::UnspecedTimer) |
| + ->postTask(BLINK_FROM_HERE, |
| + crossThreadBind(&WebSharedWorkerClient::countFeature, |
| + crossThreadUnretained(m_client), |
| + static_cast<uint32_t>(feature))); |
|
kinuko
2017/01/24 13:56:31
nit: if we do exactly same as countFeature, we can
nhiroki
2017/01/25 10:16:12
Done.
|
| } |
| void WebSharedWorkerImpl::reportException(const String& errorMessage, |