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

Side by Side Diff: content/renderer/shared_worker/websharedworker_proxy.cc

Issue 2586863002: Worker: Enable UseCounter for SharedWorkerGlobalScope (Closed)
Patch Set: replace ExecutionContext with ScriptState Created 3 years, 10 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/shared_worker/websharedworker_proxy.h" 5 #include "content/renderer/shared_worker/websharedworker_proxy.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "content/child/child_thread_impl.h" 9 #include "content/child/child_thread_impl.h"
10 #include "content/child/webmessageportchannel_impl.h" 10 #include "content/child/webmessageportchannel_impl.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 54
55 bool WebSharedWorkerProxy::OnMessageReceived(const IPC::Message& message) { 55 bool WebSharedWorkerProxy::OnMessageReceived(const IPC::Message& message) {
56 bool handled = true; 56 bool handled = true;
57 IPC_BEGIN_MESSAGE_MAP(WebSharedWorkerProxy, message) 57 IPC_BEGIN_MESSAGE_MAP(WebSharedWorkerProxy, message)
58 IPC_MESSAGE_HANDLER(ViewMsg_WorkerCreated, OnWorkerCreated) 58 IPC_MESSAGE_HANDLER(ViewMsg_WorkerCreated, OnWorkerCreated)
59 IPC_MESSAGE_HANDLER(ViewMsg_WorkerScriptLoadFailed, 59 IPC_MESSAGE_HANDLER(ViewMsg_WorkerScriptLoadFailed,
60 OnWorkerScriptLoadFailed) 60 OnWorkerScriptLoadFailed)
61 IPC_MESSAGE_HANDLER(ViewMsg_WorkerConnected, 61 IPC_MESSAGE_HANDLER(ViewMsg_WorkerConnected,
62 OnWorkerConnected) 62 OnWorkerConnected)
63 IPC_MESSAGE_HANDLER(ViewMsg_WorkerDestroyed, OnWorkerDestroyed)
64 IPC_MESSAGE_HANDLER(ViewMsg_CountFeatureOnSharedWorker, OnCountFeature)
63 IPC_MESSAGE_UNHANDLED(handled = false) 65 IPC_MESSAGE_UNHANDLED(handled = false)
64 IPC_END_MESSAGE_MAP() 66 IPC_END_MESSAGE_MAP()
65 return handled; 67 return handled;
66 } 68 }
67 69
68 void WebSharedWorkerProxy::OnWorkerCreated() { 70 void WebSharedWorkerProxy::OnWorkerCreated() {
69 // The worker is created - now send off the connection request. 71 // The worker is created - now send off the connection request.
70 router_->Send( 72 router_->Send(
71 new ViewHostMsg_ConnectToWorker(route_id_, message_port_id_)); 73 new ViewHostMsg_ConnectToWorker(route_id_, message_port_id_));
72 } 74 }
73 75
74 void WebSharedWorkerProxy::OnWorkerScriptLoadFailed() { 76 void WebSharedWorkerProxy::OnWorkerScriptLoadFailed() {
75 listener_->scriptLoadFailed(); 77 listener_->scriptLoadFailed();
76 delete this; 78 delete this;
77 } 79 }
78 80
79 void WebSharedWorkerProxy::OnWorkerConnected() { 81 void WebSharedWorkerProxy::OnWorkerConnected(std::set<uint32_t> features) {
80 listener_->connected(); 82 listener_->connected();
83 for (uint32_t feature : features)
84 listener_->countFeature(feature);
85 }
86
87 void WebSharedWorkerProxy::OnWorkerDestroyed() {
81 delete this; 88 delete this;
82 } 89 }
83 90
91 void WebSharedWorkerProxy::OnCountFeature(uint32_t feature) {
92 listener_->countFeature(feature);
93 }
94
84 } // namespace content 95 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698