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

Unified Diff: content/renderer/shared_worker/websharedworker_proxy.cc

Issue 2586863002: Worker: Enable UseCounter for SharedWorkerGlobalScope (Closed)
Patch Set: ready to review Created 3 years, 11 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
Index: content/renderer/shared_worker/websharedworker_proxy.cc
diff --git a/content/renderer/shared_worker/websharedworker_proxy.cc b/content/renderer/shared_worker/websharedworker_proxy.cc
index 628b14df5a38d8dc74af916a4e38f19eb6199d4c..91989938c95ae7edbe668f9c2e7d033866ca49c0 100644
--- a/content/renderer/shared_worker/websharedworker_proxy.cc
+++ b/content/renderer/shared_worker/websharedworker_proxy.cc
@@ -10,6 +10,7 @@
#include "content/child/webmessageportchannel_impl.h"
#include "content/common/view_messages.h"
#include "content/common/worker_messages.h"
+#include "content/common/worker_use_counter.h"
#include "ipc/message_router.h"
namespace content {
@@ -60,6 +61,8 @@ bool WebSharedWorkerProxy::OnMessageReceived(const IPC::Message& message) {
OnWorkerScriptLoadFailed)
IPC_MESSAGE_HANDLER(ViewMsg_WorkerConnected,
OnWorkerConnected)
+ IPC_MESSAGE_HANDLER(ViewMsg_WorkerDestroyed, OnWorkerDestroyed)
+ IPC_MESSAGE_HANDLER(ViewMsg_CountFeatureOnSharedWorker, OnCountFeature)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -76,9 +79,22 @@ void WebSharedWorkerProxy::OnWorkerScriptLoadFailed() {
delete this;
}
-void WebSharedWorkerProxy::OnWorkerConnected() {
+void WebSharedWorkerProxy::OnWorkerConnected(std::vector<char> features) {
listener_->connected();
+ WorkerUseCounter counter(features);
+ for (size_t i = 0; i < counter.GetNumberOfBits(); ++i) {
+ if (!counter.IsCounted(i))
+ continue;
+ listener_->countFeature(i);
+ }
+}
+
+void WebSharedWorkerProxy::OnWorkerDestroyed() {
delete this;
}
+void WebSharedWorkerProxy::OnCountFeature(uint32_t feature) {
+ listener_->countFeature(feature);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698