OLD | NEW |
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 Loading... |
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( |
| 82 const std::set<uint32_t>& use_counter) { |
80 listener_->connected(); | 83 listener_->connected(); |
| 84 for (uint32_t use_counter_id : use_counter) |
| 85 listener_->countFeature(use_counter_id); |
| 86 } |
| 87 |
| 88 void WebSharedWorkerProxy::OnWorkerDestroyed() { |
81 delete this; | 89 delete this; |
82 } | 90 } |
83 | 91 |
| 92 void WebSharedWorkerProxy::OnCountFeature(uint32_t use_counter_id) { |
| 93 listener_->countFeature(use_counter_id); |
| 94 } |
| 95 |
84 } // namespace content | 96 } // namespace content |
OLD | NEW |