OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/worker/websharedworkerclient_proxy.h" | 5 #include "content/worker/websharedworkerclient_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "content/child/webmessageportchannel_impl.h" | 10 #include "content/child/webmessageportchannel_impl.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 : route_id_(route_id), | 40 : route_id_(route_id), |
41 appcache_host_id_(0), | 41 appcache_host_id_(0), |
42 stub_(stub), | 42 stub_(stub), |
43 weak_factory_(this), | 43 weak_factory_(this), |
44 devtools_agent_(NULL) { | 44 devtools_agent_(NULL) { |
45 } | 45 } |
46 | 46 |
47 WebSharedWorkerClientProxy::~WebSharedWorkerClientProxy() { | 47 WebSharedWorkerClientProxy::~WebSharedWorkerClientProxy() { |
48 } | 48 } |
49 | 49 |
50 void WebSharedWorkerClientProxy::postMessageToWorkerObject( | |
51 const WebString& message, | |
52 const WebMessagePortChannelArray& channels) { | |
53 // TODO(marja): Clean up the interface; this function doesn't need to exist. | |
54 NOTREACHED(); | |
55 } | |
56 | |
57 void WebSharedWorkerClientProxy::postExceptionToWorkerObject( | |
58 const WebString& error_message, | |
59 int line_number, | |
60 const WebString& source_url) { | |
61 Send(new WorkerHostMsg_PostExceptionToWorkerObject( | |
62 route_id_, error_message, line_number, source_url)); | |
63 } | |
64 | |
65 void WebSharedWorkerClientProxy::postConsoleMessageToWorkerObject( | |
66 int source, | |
67 int type, | |
68 int level, | |
69 const WebString& message, | |
70 int line_number, | |
71 const WebString& source_url) { | |
72 WorkerHostMsg_PostConsoleMessageToWorkerObject_Params params; | |
73 params.source_identifier = source; | |
74 params.message_type = type; | |
75 params.message_level = level; | |
76 params.message = message; | |
77 params.line_number = line_number; | |
78 params.source_url = source_url; | |
79 Send(new WorkerHostMsg_PostConsoleMessageToWorkerObject(route_id_, params)); | |
80 } | |
81 | |
82 void WebSharedWorkerClientProxy::confirmMessageFromWorkerObject( | |
83 bool has_pending_activity) { | |
84 Send(new WorkerHostMsg_ConfirmMessageFromWorkerObject( | |
85 route_id_, has_pending_activity)); | |
86 } | |
87 | |
88 void WebSharedWorkerClientProxy::reportPendingActivity( | |
89 bool has_pending_activity) { | |
90 Send(new WorkerHostMsg_ReportPendingActivity( | |
91 route_id_, has_pending_activity)); | |
92 } | |
93 | |
94 void WebSharedWorkerClientProxy::workerContextClosed() { | 50 void WebSharedWorkerClientProxy::workerContextClosed() { |
95 Send(new WorkerHostMsg_WorkerContextClosed(route_id_)); | 51 Send(new WorkerHostMsg_WorkerContextClosed(route_id_)); |
96 } | 52 } |
97 | 53 |
98 void WebSharedWorkerClientProxy::workerContextDestroyed() { | 54 void WebSharedWorkerClientProxy::workerContextDestroyed() { |
99 Send(new WorkerHostMsg_WorkerContextDestroyed(route_id_)); | 55 Send(new WorkerHostMsg_WorkerContextDestroyed(route_id_)); |
100 // Tell the stub that the worker has shutdown - frees this object. | 56 // Tell the stub that the worker has shutdown - frees this object. |
101 if (stub_) | 57 if (stub_) |
102 stub_->Shutdown(); | 58 stub_->Shutdown(); |
103 } | 59 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // page. It's ok to post several of theese, because the first executed task | 131 // page. It's ok to post several of theese, because the first executed task |
176 // will exit the message loop and subsequent ones won't be executed. | 132 // will exit the message loop and subsequent ones won't be executed. |
177 base::MessageLoop::current()->PostDelayedTask( | 133 base::MessageLoop::current()->PostDelayedTask( |
178 FROM_HERE, | 134 FROM_HERE, |
179 base::Bind(&WebSharedWorkerClientProxy::workerContextDestroyed, | 135 base::Bind(&WebSharedWorkerClientProxy::workerContextDestroyed, |
180 weak_factory_.GetWeakPtr()), | 136 weak_factory_.GetWeakPtr()), |
181 base::TimeDelta::FromSeconds(kMaxTimeForRunawayWorkerSeconds)); | 137 base::TimeDelta::FromSeconds(kMaxTimeForRunawayWorkerSeconds)); |
182 } | 138 } |
183 | 139 |
184 } // namespace content | 140 } // namespace content |
OLD | NEW |