OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/worker/websharedworker_stub.h" | 5 #include "chrome/worker/websharedworker_stub.h" |
6 | 6 |
7 #include "chrome/common/child_thread.h" | 7 #include "chrome/common/child_thread.h" |
8 #include "chrome/common/file_system/file_system_dispatcher.h" | 8 #include "chrome/common/file_system/file_system_dispatcher.h" |
9 #include "chrome/common/webmessageportchannel_impl.h" | 9 #include "chrome/common/webmessageportchannel_impl.h" |
10 #include "chrome/common/worker_messages.h" | 10 #include "chrome/common/worker_messages.h" |
11 #include "third_party/WebKit/WebKit/chromium/public/WebSharedWorker.h" | 11 #include "third_party/WebKit/WebKit/chromium/public/WebSharedWorker.h" |
12 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
13 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
14 | 14 |
15 WebSharedWorkerStub::WebSharedWorkerStub( | 15 WebSharedWorkerStub::WebSharedWorkerStub( |
16 const string16& name, int route_id, | 16 const string16& name, int route_id, |
17 const WorkerAppCacheInitInfo& appcache_init_info) | 17 const WorkerAppCacheInitInfo& appcache_init_info) |
18 : WebWorkerStubBase(route_id, appcache_init_info), | 18 : WebWorkerStubBase(route_id, appcache_init_info), |
19 name_(name), | 19 name_(name), |
20 started_(false) { | 20 started_(false) { |
21 // TODO(atwilson): Add support for NaCl when they support MessagePorts. | 21 // TODO(atwilson): Add support for NaCl when they support MessagePorts. |
22 impl_ = WebKit::WebSharedWorker::create(client()); | 22 impl_ = WebKit::WebSharedWorker::create(client()); |
23 } | 23 } |
24 | 24 |
25 WebSharedWorkerStub::~WebSharedWorkerStub() { | 25 WebSharedWorkerStub::~WebSharedWorkerStub() { |
26 impl_->clientDestroyed(); | 26 impl_->clientDestroyed(); |
27 } | 27 } |
28 | 28 |
29 void WebSharedWorkerStub::OnMessageReceived(const IPC::Message& message) { | 29 bool WebSharedWorkerStub::OnMessageReceived(const IPC::Message& message) { |
| 30 bool handled = true; |
30 IPC_BEGIN_MESSAGE_MAP(WebSharedWorkerStub, message) | 31 IPC_BEGIN_MESSAGE_MAP(WebSharedWorkerStub, message) |
31 IPC_MESSAGE_HANDLER(WorkerMsg_StartWorkerContext, OnStartWorkerContext) | 32 IPC_MESSAGE_HANDLER(WorkerMsg_StartWorkerContext, OnStartWorkerContext) |
32 IPC_MESSAGE_HANDLER(WorkerMsg_TerminateWorkerContext, | 33 IPC_MESSAGE_HANDLER(WorkerMsg_TerminateWorkerContext, |
33 OnTerminateWorkerContext) | 34 OnTerminateWorkerContext) |
34 IPC_MESSAGE_HANDLER(WorkerMsg_Connect, OnConnect) | 35 IPC_MESSAGE_HANDLER(WorkerMsg_Connect, OnConnect) |
| 36 IPC_MESSAGE_UNHANDLED(handled = false) |
35 IPC_END_MESSAGE_MAP() | 37 IPC_END_MESSAGE_MAP() |
| 38 return handled; |
36 } | 39 } |
37 | 40 |
38 void WebSharedWorkerStub::OnChannelError() { | 41 void WebSharedWorkerStub::OnChannelError() { |
39 OnTerminateWorkerContext(); | 42 OnTerminateWorkerContext(); |
40 } | 43 } |
41 | 44 |
42 const GURL& WebSharedWorkerStub::url() const { | 45 const GURL& WebSharedWorkerStub::url() const { |
43 return url_; | 46 return url_; |
44 } | 47 } |
45 | 48 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 81 } |
79 } | 82 } |
80 | 83 |
81 void WebSharedWorkerStub::OnTerminateWorkerContext() { | 84 void WebSharedWorkerStub::OnTerminateWorkerContext() { |
82 impl_->terminateWorkerContext(); | 85 impl_->terminateWorkerContext(); |
83 | 86 |
84 // Call the client to make sure context exits. | 87 // Call the client to make sure context exits. |
85 EnsureWorkerContextTerminates(); | 88 EnsureWorkerContextTerminates(); |
86 started_ = false; | 89 started_ = false; |
87 } | 90 } |
OLD | NEW |