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" |
| 8 #include "chrome/common/file_system/file_system_dispatcher.h" |
7 #include "chrome/common/webmessageportchannel_impl.h" | 9 #include "chrome/common/webmessageportchannel_impl.h" |
8 #include "chrome/common/worker_messages.h" | 10 #include "chrome/common/worker_messages.h" |
9 #include "third_party/WebKit/WebKit/chromium/public/WebSharedWorker.h" | 11 #include "third_party/WebKit/WebKit/chromium/public/WebSharedWorker.h" |
10 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
11 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
12 | 14 |
13 WebSharedWorkerStub::WebSharedWorkerStub( | 15 WebSharedWorkerStub::WebSharedWorkerStub( |
14 const string16& name, int route_id, | 16 const string16& name, int route_id, |
15 const WorkerAppCacheInitInfo& appcache_init_info) | 17 const WorkerAppCacheInitInfo& appcache_init_info) |
16 : WebWorkerStubBase(route_id, appcache_init_info), | 18 : WebWorkerStubBase(route_id, appcache_init_info), |
(...skipping 22 matching lines...) Expand all Loading... |
39 | 41 |
40 void WebSharedWorkerStub::OnStartWorkerContext( | 42 void WebSharedWorkerStub::OnStartWorkerContext( |
41 const GURL& url, const string16& user_agent, const string16& source_code) { | 43 const GURL& url, const string16& user_agent, const string16& source_code) { |
42 // Ignore multiple attempts to start this worker (can happen if two pages | 44 // Ignore multiple attempts to start this worker (can happen if two pages |
43 // try to start it simultaneously). | 45 // try to start it simultaneously). |
44 if (started_) | 46 if (started_) |
45 return; | 47 return; |
46 | 48 |
47 impl_->startWorkerContext(url, name_, user_agent, source_code, 0); | 49 impl_->startWorkerContext(url, name_, user_agent, source_code, 0); |
48 started_ = true; | 50 started_ = true; |
| 51 url_ = url; |
49 | 52 |
50 // Process any pending connections. | 53 // Process any pending connections. |
51 for (PendingConnectInfoList::const_iterator iter = pending_connects_.begin(); | 54 for (PendingConnectInfoList::const_iterator iter = pending_connects_.begin(); |
52 iter != pending_connects_.end(); | 55 iter != pending_connects_.end(); |
53 ++iter) { | 56 ++iter) { |
54 OnConnect(iter->first, iter->second); | 57 OnConnect(iter->first, iter->second); |
55 } | 58 } |
56 pending_connects_.clear(); | 59 pending_connects_.clear(); |
57 } | 60 } |
58 | 61 |
(...skipping 12 matching lines...) Expand all Loading... |
71 } | 74 } |
72 } | 75 } |
73 | 76 |
74 void WebSharedWorkerStub::OnTerminateWorkerContext() { | 77 void WebSharedWorkerStub::OnTerminateWorkerContext() { |
75 impl_->terminateWorkerContext(); | 78 impl_->terminateWorkerContext(); |
76 | 79 |
77 // Call the client to make sure context exits. | 80 // Call the client to make sure context exits. |
78 EnsureWorkerContextTerminates(); | 81 EnsureWorkerContextTerminates(); |
79 started_ = false; | 82 started_ = false; |
80 } | 83 } |
OLD | NEW |