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" |
(...skipping 21 matching lines...) Expand all Loading... |
32 IPC_MESSAGE_HANDLER(WorkerMsg_TerminateWorkerContext, | 32 IPC_MESSAGE_HANDLER(WorkerMsg_TerminateWorkerContext, |
33 OnTerminateWorkerContext) | 33 OnTerminateWorkerContext) |
34 IPC_MESSAGE_HANDLER(WorkerMsg_Connect, OnConnect) | 34 IPC_MESSAGE_HANDLER(WorkerMsg_Connect, OnConnect) |
35 IPC_END_MESSAGE_MAP() | 35 IPC_END_MESSAGE_MAP() |
36 } | 36 } |
37 | 37 |
38 void WebSharedWorkerStub::OnChannelError() { | 38 void WebSharedWorkerStub::OnChannelError() { |
39 OnTerminateWorkerContext(); | 39 OnTerminateWorkerContext(); |
40 } | 40 } |
41 | 41 |
| 42 const GURL& WebSharedWorkerStub::url() const { |
| 43 return url_; |
| 44 } |
| 45 |
42 void WebSharedWorkerStub::OnStartWorkerContext( | 46 void WebSharedWorkerStub::OnStartWorkerContext( |
43 const GURL& url, const string16& user_agent, const string16& source_code) { | 47 const GURL& url, const string16& user_agent, const string16& source_code) { |
44 // Ignore multiple attempts to start this worker (can happen if two pages | 48 // Ignore multiple attempts to start this worker (can happen if two pages |
45 // try to start it simultaneously). | 49 // try to start it simultaneously). |
46 if (started_) | 50 if (started_) |
47 return; | 51 return; |
48 | 52 |
49 impl_->startWorkerContext(url, name_, user_agent, source_code, 0); | 53 impl_->startWorkerContext(url, name_, user_agent, source_code, 0); |
50 started_ = true; | 54 started_ = true; |
51 url_ = url; | 55 url_ = url; |
(...skipping 22 matching lines...) Expand all Loading... |
74 } | 78 } |
75 } | 79 } |
76 | 80 |
77 void WebSharedWorkerStub::OnTerminateWorkerContext() { | 81 void WebSharedWorkerStub::OnTerminateWorkerContext() { |
78 impl_->terminateWorkerContext(); | 82 impl_->terminateWorkerContext(); |
79 | 83 |
80 // Call the client to make sure context exits. | 84 // Call the client to make sure context exits. |
81 EnsureWorkerContextTerminates(); | 85 EnsureWorkerContextTerminates(); |
82 started_ = false; | 86 started_ = false; |
83 } | 87 } |
OLD | NEW |